[PDF Export] Padding broken? - Styling Problem

padding-left-right-error.png

 

Dear Atlassian-Community,

I've read about the official "PDF Export Documentation" (https://confluence.atlassian.com/doc/customise-exports-to-pdf-190480945.html) and even the advanced guide but I am still missing some points to build a more advanced document.

Are there more describing "snippets" about the PDF export or even some practical examples ?

The biggest problem for me is when I add padding(left/right) to @page it is scaling the content correct but @top-left, @top-center, @top-right (same with bottom) feels like they are just using padding-right.

In the picture you can see @page (red), @top-center(green), and the content is white with the subtitle.

It is only styled by .CSS with the code below:

@page

{

size: 210mm 297mm;

margin: .7in .5in;

padding-left: 5em;

padding-right: 5em;

background-color: red;

@top-center {

width: 210mm !important; height: 20px; !important;

font-size: 10pt;

text-align: center;

border-bottom: 2px solid white;

background-color: green; }

}


What I am trying to achieve is a very clean page with increased padding(left/right) and a header/footer with a width of 100%.

 

Maybe one of you can help me? Would be great!

 

Thanks a lot already!

~ Marcel

3 answers

1 accepted

Hi,

I don't think what you try is possible.

If you check http://www.w3.org/TR/2006/WD-css3-page-20061010/#margin-box-def you see that the page margins translate into top-left-corner and top-right-corner in the header.

If you want a header with 100% the page margin and padding must be 0.

Perhaps you can live with some kind of a fake:

  • Define the same background-color for top-left-corner, top-center and top-right-corner and it will look as if it was a 100% header (text can only be placed in top-center though) -or-
  • Use an 100% width image as header and define it as background-image of the @page {...} -or-

  • Define page margin and padding as 0 but add margin at .wiki-content {...}

The last sentence was the one I was looking for!

Define page margin and padding as 0 but add margin at .wiki-content {...}

 

Thanks a lot already! You'll hear from me If it worked out the way I think it does =) 

 

Greetings 

~ Marcel

 

Hi Marcel,

Check out Content Exporter for Confluence addon for PDF export. You might need less or no coding at all for exporting using this addon:

https://marketplace.atlassian.com/plugins/com.metainf.confluence.plugin.pagetreeexporter.pagetree-word-exporter-plugin/cloud/overview 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published yesterday in Confluence

Think you know shares vs. @mentions in Confluence? Take this collab quiz.

To anyone who doubts that Atlassians are a little too obsessed with collaboration, and tools related thereto, let me describe a recent discussion we had (which took place on our internal Confluence, ...

116 views 2 4
Read article

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