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

Problem with Header & Footer in single page PDF export

Jonas Schilling Feb 04, 2016

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

1 vote
Steffen Heller Feb 05, 2016

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";
}
}
0 votes
Kerim Incedayi Jun 16, 2016

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

945 views 0 19
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