Several Issues with PDF Stylesheet Output for Confluence 4.3
Asked by Phil Gochenour:

I have been trying to edit the PDF export stylesheet, and have run across several issues that I think may be bugs. I'm able to change certain elements of the styles (such as font color) and these render correctly, but even in consultation with our resident CSS guru, we have not been able to resolve the following:

1) Side bar content renders on consecutive pages, rather than as a sidebar on the page.

For example, if I have a page with two Info panel elements in the right sidebar, when this is exported to PDF, the original page will print, followed by two pages that print each info panel on a separate page on the left. If the side bar contains just paragraph copy, this will be printed below all the other content on the page, rather than in the sidebar. We suspect that this is a problem with the sidebar definition (if it exists) in the rendering engine.

2) I have attempted to remove the numbers that precede each chapter/section in the TOC by removing this CSS style:

span.tocnum:before   
{  
content: target-counter(attr(href), page);  
}

However, when I remove it, the numbers are still there.

3) The h1.pagetitle style rule is not being rendered correctly.

Specifically, page-break-before: always is not being observed. I'm actually not sure if the correct element is h1.pagetitle or h1.pagename, but I want to have each new topic appear on a new page, and I assumed that one of these would be the correct style. However, since the rendering engine decreases the heading number for each level of hierarchy, I'm not sure if I should create new h2, h3, etc. pagename/title styles, or if there is something awry with the h1.pagetitle style. I tried increasing the h1.pagetitle and h1.pagename to be huge (48 point), and since this didn't render, I am assuming that something is wrong with the rendering image.

Assistance would be most appreciated, since eventually I do need to create PDF customer docs, and what I'm getting so far is not ready for prime time.


Answers:
author: Steffen Heller
body: I would like to get back to question no1 from Phil:

What is the policy for the export of page layouts? If a page layout with different colums is used should the column structure be preserved in PDF output? Or is the standard setting that the columns are rendered underneath each other?

In my pages the columns are underneath each other. Can I change this?


author: Greg Roll
body: I am having the same issues as you mention in #2) Unable to remove chapter from title page and #3) unable to have page breaks consistently work.

I performed the changes found on the Atlassian site for dynamic formatting of the title page and the number does not get removed.

For the pagebreaks, I created a pagebreak macro as mentioned at [](https://confluence.atlassian.com/display/DISC/pagebreak+user+macro)<https://confluence.atlassian.com/display/DISC/pagebreak+user+macro>. It works sometime but not always and I can't determine why its so inconsistent.

Has anyone else had these issues and found a way to address them? We are using Confluence v5.4.1


author: Guenter Huber
body: Hey Phil,  
I share your frustrations! Did you try K15t s support? They have been EXTREMELY responsive with us! (We got their Scroll HTML export.)

I tried to do the opposite to your #2. Somehow I got this crazy idea: If you got heading numbering in the TOC you should have it in the body too.

I opened a support ticket (because of the deafening silence on Answers) and believe me, I ll have this solved! \<argh\>  
Regards  
G.


author: Steffen Heller
body: Hi,

1) no idea, sorry

2) Check my answer to Matthew at [https://answers.atlassian.com/questions/44440/pdf-stylesheet-any-guides-out-there?page=1#75579](/questions/44440/pdf-stylesheet-any-guides-out-there?page=1#75579)

3) There is a

```
h1.pagetitle {    page-break-before: always; }
```

in the confluencedefaultpdf.css.

If I check the confluence page's html source code the h1.pagetitle corresponds to the pages main headline. In other words: If you export a set of different confluence pages into one PDF file then every new confluence page should create a pagebreak (because of this h1.pagetitle that the page starts with).

This is probably NOT what you are looking for. You talk about "new topics" and I don't fully understand what you mean by that. If it means that you have different paragraphs of text on ONE confluence page and you want these paragraphs to create a pagebreak in the resulting PDF then you must define some new css code for this. But this is tricky!

Basically, code like

```
h1, h2, h3 {page-break-before: always; }
```

would create pagebreaks for all h1, h2, h3 elements. But I never managed to find the right combination of headings that works for all my file. I always got documents with either too many or too few pagebreaks. And the fact that a h1 on the confluence page can turn into anything between h2 and h10 dependant on what level of hierarchy the page is in doesn't make it easier!

In short: I think I can understand your problem but I don't have a real solution.

comments: author: Phil Gochenour
body: Nine months later and I'm still unable to resolve these issues. I just installed a trial version of K15's PDF Exporter plugin, set up a template, and when I exported - nothing. None of the template settings for that space were expressed in the output. I also tried to update the space CSS to with what appears to be a fix for the excerpt-macro formatting bug described here: <https://jira.atlassian.com/browse/CONF-26613> but it also won't "take." Can someone from Atlassian please tell me what the problem is, or in what version it is corrected, because I have a serious need to output professional quality customer documentation.


author: Phil Gochenour
body: Following the various bugs in Jira, it seems that there are many people having substantial problems with the PDF export functionality. Since some of our vendors require us to submit PDF versions of our documentation as part of the bid process, the inability to provide clean copy poses a risk to our bottom line. I've escalated this to Atlassian and commented on the relevant Jira bugs, but so far, no action or response. If anyone else is having problems with overrides of their custom stylesheets or inability to render styled content correctly, I urge you to comment and vote on this bug: <https://jira.atlassian.com/browse/CONF-26970>.


Tags: pdf

stylesheet