Problem with Header & Footer in single page PDF export

Hello guys! I am trying to customize my CSS for single page PDF export for days now - I am almost happy with the result as of now. The only problem: I'd like to add a margin to the exported PDFs text body that doesn't affect the header & footer. Somehow that does not seem to work as I alsways end up with a 1 cm margin at the right side of my header & footer. So far I tried all sorts of things yet don't get it to work. It's not a major issue yet bugs me a lot. Any chance you have a solution for me?

 

Attachment: A PDF I exported a few minutes ago for you to see what I mean.

250

 

Here's the CSS:

@page { size: 210mm 297mm; font-family: OpenSans, Helvetica, Arial, sans-serif; margin-top: 2,5cm; margin-bottom: 1,5cm; word-wrap: break-word; page-break-before: always; margin-right: 0cm; margin-left: 0cm;

@top-center { content: "Meyle+Müller GmbH + Co. KG"; font-family: OpenSans, Helvetica, Arial, sans-serif; font-weight: bold; color: white; font-size: 10pt; background-color: #979797; width: 100%; align: center; margin-right: -1cm; }

@bottom-left { content: "Exportiert aus Confluence"; text-align: center; font-family: OpenSans, Helvetica, Arial, sans-serif; color: white; background-color: #979797; font-size: 7pt; }

@bottom-center { content: counter(page) " von " counter(pages); text-align: center; font-family: OpenSans, Helvetica, Arial, sans-serif; color: white; background-color: #979797; font-size: 7pt; }

@bottom-right { content: "© Meyle+Müller GmbH + Co. KG"; text-align: center; font-family: OpenSans, Helvetica, Arial, sans-serif; color: white; background-color: #979797; font-size: 7pt; } }

 

Thank you for your suggestions!

2 answers

I don't know why, but your method really doesn't work. If you are ready for a stupid workaround you can do the following:

Define the background-color as a single-colored background-image of @page.

@page {  
size: 210mm 297mm;
background-image: url(/download/attachments/.../name_of_that_image.png);  
background-repeat: repeat-x;  
margin-top: 3cm; /* should be the same height as the background-image */

@top-center { 
content: "Meyle+Müller GmbH + Co. KG";
}
}

Where do you put this CSS? I tried putting some in global and within the space but that only works if I export multiple pages not with a single page...

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,056 views 16 14
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you