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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,476
Community Members
 
Community Events
184
Community Groups

PDF Export customization

Hi,

I'm trying to customize header and footer of a single page pdf export.

I'm mainly focusing on this guide: https://support.atlassian.com/confluence-cloud/docs/advanced-pdf-export-customizations/

Here is stated that changing header and footer on the single page is not directly supported and is possible only through CSS adding the "content" rule:

@page
{
@top-center
{
content: url('/download/attachments/xxxxxx/header.png');
}
@bottom-center
{
content: url('/download/attachments/xxxxxx/footer.png');
}
}

but this totally breaks the PDF Export: 

error.png

Looking into the community there are a lots of different topics with the same argument, but no one is working.

 

Can someone help on clarifying the functionality and it's limits?

Thanks

 

PS: also space export seems to totally ignore the header and footer definition

PPS: i would avoid external plugin

 

 

1 answer

1 accepted

Hi Francesco, you should try it with background-image instead of content.
We configured our PDF export that way and it is working fine:

{
background-image: url("/download/attachments/xxxx/header.png");
background-size: 130px;
background-repeat: no-repeat;
background-position: 0.47cm 1.27cm;
}

Maybe you can adapt this to your use case and see if it's working then.

Hi Sebastian,

thanks!

To which element should I attach this css? on page does not have any effect and if i put top-center I got the "We couldn't complete you export." exception

 

ie:

page
{

background-image: url("/download/attachments/xxxx/header.png");
background-size: 130px;
background-repeat: no-repeat;
background-position: 0.47cm 1.27cm;

}

or 

page

{

top-center{

background-image: url("/download/attachments/xxxx/header.png");
background-size: 130px;
background-repeat: no-repeat;
background-position: 0.47cm 1.27cm;

}

}

Maybe i am missing some margin?

Thanks

Here you go with our full PDF stylesheet. Hope that helps:

@page
{
/*The A4 paper size is 210 mm wide by 297 mm long*/
size: 210mm 297mm;
margin-top: 2.54cm;
margin-bottom: 2.54cm;
margin-left: 1.27cm;
margin-right: 1.27cm;

@top-left
{
background-image: url("/download/attachments/xxx/xxx-logo.png");
background-size: 130px;
background-repeat: no-repeat;
background-position: 0.47cm 1.27cm;
}
@bottom-right
{
content: "Page " counter(page); /* This is the content that will appear in the footer on the right */
font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
font-size: 6pt;
}

h1 {
display: block;
font-size: 2em;
margin-top: 0.67em;
margin-bottom: 0.67em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
page-break-before: always;
}

h2 {
display: block;
font-size: 1.5em;
margin-top: 0.83em;
margin-bottom: 0.83em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
page-break-before: always;
}

h3 {
display: block;
font-size: 1.17em;
margin-top: 1em;
margin-bottom: 1em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}

h4 {
display: block;
font-size: 1em;
margin-top: 1.33em;
margin-bottom: 1.33em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}

h5 {
display: block;
font-size: .83em;
margin-top: 1.67em;
margin-bottom: 1.67em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}

h6 {
display: block;
font-size: .67em;
margin-top: 2.33em;
margin-bottom: 2.33em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}
}

Hi @Sebastian Adam 

Thank you so much!!

I really can't understand why I was receiving export exception before, but now thanks to your example I was able to adapt the CSS.

 

Thanks again!

Like Sebastian Adam likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events