Can I distinguish between different levels of pages from the LH menu when they are on a PDF page?
Asked by Rosalind BANWELL:

Hi all,

We recently upgraded to Confluence Server **6.13** and see that how Page Titles and Headings are treated for PDF export has changed (see [CONFSERVER-16557).](https://jira.atlassian.com/browse/CONFSERVER-16557?src=confmacro&_ga=2.115821318.1488393400.1548150062-496737084.1497025428)

The way my pages are set up, I need different headings for the different levels in my LH menu. However looking at the HTML code, I see no way to distinguish between the different levels now... they all have the same structure:

\<h1 id="title-heading" class="pagetitle"\>

\<span id="title-text"\>

Risk Management - RM - 8.8 : **Enablon Risk Management Overview (User)**

\</span\>

\</h1\>

So **before** 6.13 I had:

![Before613.jpg](/t5/image/serverpage/image-id/43382i36AA1C606E1287A2/image-dimensions/471x211?v=v2 "Before613.jpg")

And now I have:

![After613.jpg](/t5/image/serverpage/image-id/43385i7DE4A7B6BE6E30FB/image-dimensions/486x214?v=v2 "After613.jpg")

My workaround is to modify the top level pages by adding the other pages as includes. Can I avoid having to restructure my content?

Thanks, Rosalind


Answers:
author: Chikara Takahashi
body: Hello, I have same issue as Rosalind.. I found another friend in here. I also need workaround to set different heading level by page tree structure.

<https://jira.atlassian.com/browse/CONFSERVER-57998>


author: Stephen Sifers
body: Hello Rosalind,

With this change to Confluence 6.13+, you will have a few options to adjust how your PDF's are exported. There are 2 options you have to consider.

Your first option is going to use PDF Stylesheets which will allow you to place your own styling (via CSS) to your PDF Exports. You may find more about this option at [Customize Exports to PDF (Confluence 6.13)](https://confluence.atlassian.com/conf613/customize-exports-to-pdf-964960311.html).

Your second option would be to use a marketplace add-on to adjust your PDF exports. Here is a preset search of [Atlassian Marketplace \| PDF Export](https://marketplace.atlassian.com/search?hosting=server&product=confluence&query=pdf%20export). Within there you have a few options to review an add-on which may allow you to adjust your PDF exports within needing to understand CSS Stylesheets.

I hope these solutions prove helpful and you're able to find a solution to adjusting your PDF exports.

Regards,

Stephen Sifers

comments: author: Rosalind BANWELL
body: Hi Stephen,

Thanks for your reply :-)

We do use a PDF CSS. Before our upgrade to 6.13 heading levels were automatically decremented, so my style sheet reflected this. From 6.13 this is no longer the case.

I can see how to differentiate between h1.pagetitle and h1 headings in pages BUT what I can't work out is how to distinguish between pages at different levels in the LH menu... I would need something like h1.pagetitlelevel1, h1.pagetitlelevel2, etc. so that when I export to PDF and put Confluence pages on the same page I can uses classes to distinguish between the different types of h1, so that I can have different headings...

I am using the following, to not have the auto pagebreaks:

    .pagetitle {    page-break-before: auto;}

Do you know a way to identify the heading levels? I didn't see anything in the HTML...

Thanks, Rosalind


author: Stephen Sifers
body: Hello Rosalind,

Thank you for the response and further clarification. Your answer helps to understand.

I tested the following Stylesheet on Confluence 6.13 and found I was able to adjust how the TOC (Table of Contents) is displayed along with the headers of pages and content headers of Confluence. Here is a screenshot of an export:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/43970iDA279C33A764CC5E/image-dimensions/318x266?v=v2 "image.png")

Here is the stylesheet which was used:

```
 div.toc
{
}

div.toclvl0
{
color:red;
font-size: 30px;
}

div.toclvl1
{
color:blue;
font-size: 20px;
}

div.toclvl2
{
color:green;
font-size: 15px;
}

.wiki-content h1 {
color:red;
font-size: 60px;
}

.wiki-content h2 {
color:blue;
font-size: 40px;
}

.wiki-content h3 {
color:green;
font-size: 20px;
}

.pagetitle {
 page-break-before: auto;
}
```

The above should allow you to customize your TOC along with your page and content headers.

I did find the following documented, which helps to understand how headers are being processed when exporting a PDF:
> Please note that Confluence have a **Demotion of heading elements** which means that *.wiki-content h1* is the element for Page Title, while *.wiki-content h2* is the element for Header 1 and so forth. This information is quoted from this documentation: [Customize Exports to PDF](https://confluence.atlassian.com/doc/customize-exports-to-pdf-190480945.html#CustomizeExportstoPDF-Notes)

Source document: [How do I change the font sizes in PDF export?](https://confluence.atlassian.com/confkb/how-do-i-change-the-font-sizes-in-pdf-export-833938097.html)

Please let us know if this helps and if you need anything further assistance with PDF export stylesheets.

Regards,  
Stephen Sifers


author: Rosalind BANWELL
body: Hi again Stephen,

Thanks for the CSS. I ran a test with it to illustrate my problem on a page, the "Pr?sentation..." and "Introduction..." headers are the same size, although at different levels of the hierarchy in the bookmarks (I would expect to have "Introduction..." a level below "Pr?sentation..." as in the bookmarks and LH menu in Confluence):

![StephenSiferCSS.gif](https://community.atlassian.com/t5/image/serverpage/image-id/44063iD718C9329E5EC985/image-size/large?v=v2&px=999 "StephenSiferCSS.gif")

The link that you sent goes to the 6.14 documentation. Has the behavior for headings changed again?

Is it worth us installing a test 6.14 version on our dev site?

Thanks, Rosalind


author: Stephen Sifers
body: Hello Rosalind,

Thank you for testing this and bringing back your results, this is very much appreciated.

The way the headers have a structure within a PDF export is as follows:

1. H1 = Page title
2. H2 = H1 Header within a page
3. H3 = H2 Header within a page
4. And so on.

Within your page tree (LH menu), the pages are sorted by hierarchical order. The headers on the export are managed by the above logic. So while you will have pages within the PDF with the same header levels, they will not be presented the same within the page tree on the left side.

The documentation was 6.14; it still applies to 6.13. There is no need to upgrade in this case (You're welcome to upgrade if you wanted to).

Regards,  
Stephen Sifers


Tags: atl-adm

confluence-server

pdf

server