Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Problem with Header & Footer in single page PDF export

Jonas Schilling February 4, 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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 5, 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
cevatkerim June 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
TAGS
AUG Leaders

Atlassian Community Events