It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Why does Confluence ignore heading margin CSS values in PDF output?

Chuck Martin Jun 23, 2014

Using the Documentation theme, I am attempting to output PDF. But the output ignores margin values for headings, specifcially the top margin values. The default CSS look like this:

h1
{
font-size: 26px;
margin: 36px 0 4px 0;
}

h2
{
font-size: 20px;
margin: 27px 0 4px 0;
}

h3
{
font-size: 18px;
margin: 21px 0 4px 0;
}

My current PDF Export Stylesheet contains the following:

h1 {
font-size: 22pt;
margin: 120px, 0, 20px, 0;
page-break-before: always;
page-break-after: avoid;
break-after: avoid;
}
h2 {
font-size: 20pt;
margin: 100px, 0, 20px, 0;
page-break-before: always;
page-break-after: avoid;
break-after: avoid;

I have also tried using pt for values (much better than pixel values, especially for print), but in every case, the PDF output leaves no space before headings. The only way I can get space before headings is to manually add blank paragrpahs at the end of eevery topic, clearly not a "solution" and a very painful workaround.

What do I have to do to get the PDF output to correctly use the defined margin values?

2 answers

0 votes
Nils Bier (K15t) Jun 23, 2014

Hi Chuck,

have you already had a look at the Scroll PDF Exporter? It might be the perfect answer for your question 'What do I have to do to get the PDF output to correctly use the defined margin values?' ;-)

Please read the following blog post to learn more about the benefits of the Scroll PDF Exporter.

If you have any questions, please contact support@k15t.com. I'll be happy to help.

Cheers,
Nils

Chuck Martin Jun 26, 2014

Nils, if I need to purchase an add-on got the a product to work correctly, something is fundamentally wrong.

0 votes
Reto Eggenberger Jul 09, 2014

Hi Chuck

You have to use !important in your CSS. Then it works correct.

h1 
{
font-size: 26px;
margin-top: 50px !important;
}

Cheers

Reto

Chuck Martin Jul 15, 2014

Thanks Reto. I'll give that a try.

Can anyone explain why that is? Why the Consfluence system simply doesn't use the default CSS as a starting point, and then "cascade" subsequent CSS properly?

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

6 Awesome Ways to Apply Trello, JIRA and Confluence to your Project

I attended  Atlassian Summit 2019  and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...

2,508 views 11 28
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you