You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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:
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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;
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.