Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Rosalind BANWELL
Contributor
January 23, 2019

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).

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

And now I have:

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

2 answers

0 votes
Chikara Takahashi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 28, 2019

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 

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 28, 2019

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).

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. 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

Rosalind BANWELL
Contributor
January 29, 2019

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

Like Stephen Sifers likes this
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 29, 2019

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

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

Source document: How do I change the font sizes in PDF export?

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

Regards,
Stephen Sifers

Like Rosalind BANWELL likes this
Rosalind BANWELL
Contributor
January 30, 2019

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

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

Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 30, 2019

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events