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

Templates / CSS / whatever to make PDFs like Atlassian's?

Looking at the properties for the PDFs in the Confluence Documentation Directory, I see that they're using iText:

http://itextpdf.com

Which is the library Confluence uses to generate PDFs.

So how do they get their PDFs to look so much better than the default?

5 answers

1 accepted

Hello Robert, I heard back from the documentation crew, please consider this regarding the PDF Export:

Confluence uses the confluence-flyingpdf plugin, which does indeed include a component that is called Flying Saucer PDF Document builder. This is bundled with Confluence. From what I can see, we are using exactly the same plugin on CAC.
However what we are doing is using a PDF layout to add the title page, header and footer, and a PDF style sheet. All the info can be found on this page https://confluence.atlassian.com/display/DOC/Customising+Exports+to+PDF and I have attached the layout and stylesheet that we use.
So if you would like to format exports to look like our docs, just apply the following to yout custom PDF stylesheet:
------------------------------------------
PDF LaYOUT > PDF Space Export Title Page
------------------------------------------

<div class="fsTitlePage">
<div class="fsDocTitle">Documentation for Confluence 5.0</div>
</div>
<div class="tocTitle">Contents</div>


---------------
PDF STYLESHEET
---------------

@page
{
   /* standard A4 paper size: 210mm wide by 297mm high */
   size: 210mm 297mm;
}
@page :left
{
    @top-left
    {
        content: element(header);
        font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
        font-size: 10pt;
        font-style: italic;
    }
    @top-right-corner
    {
        content: counter(page);
        font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
        font-size: 16pt;
    }
    @bottom-left
    {
        content: element(footer);
        font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
        font-size: 10pt;
        font-style: italic;
    }
}
@page :right
{
    @top-left
    {
        content: element(header);
        font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
        font-size: 10pt;
        font-style: italic;
    }
    @top-right-corner
    {
        content: counter(page);
        font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
        font-size: 16pt;
    }
    @bottom-left
    {
        content: element(footer);
        font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
        font-size: 10pt;
        font-style: italic;
    }
}
@page :first
{
    @top-left
    {
    }
    @top-right-corner
    {
    }
    @bottom-left
    {
    }
}

@page frontmatter 
{ 
@top-left
    {
        content: element(header);
        font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
        font-size: 10pt;
        font-style: italic;
    }
    @top-right-corner
    {
        content: counter(page);
        font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
        font-size: 16pt;
    }
    @bottom-left
    {
        content: element(footer);
        font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
        font-size: 10pt;
        font-style: italic;
    }
}


.fsTitlePage
{
margin-left: auto;
margin-top: 150mm;
margin-right: auto;
page-break-after:always
} 

.fsDocTitle
{
 font-size: 32px;
 margin: 36px 0 24px 0;
}


div.fsFrontMatter
{
page: frontmatter;
page-break-after: always;
margin-left:auto;
margin-top:10mm;
margin-right:auto;
}


div.toc 
{
    page: frontmatter;
    page-break-after: always;
}

div.tocTitle
{   
    page: frontmatter;
     font-size: 32px;
    margin: 36px 0 24px 0;
    page-break-after: none;
}

div.toclvl0:before, div.toclvl1:before, div.toclvl2:before, div.toclvl3:before, div.toclvl4:before
{
    content:  none;
}


body,p,li,td,table,tr,.bodytext,.stepfield 
{
 font-size: 10pt;
}

.header, .footer
{
        font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
        font-size: 10pt;
        font-style: italic;
}

Hope this was what you were looking for!

Will the above work on Confluence 4.3.3

Hello Robert, Confluence uses confluence-flyingpdf-plugin. The pom.xml for this artifact can be found here.

1
2
3
<groupId>com.atlassian.confluence.extra</groupId>
<artifactId>confluence-flyingpdf-plugin</artifactId>
<version>2.5.6</version>
source

I'd need to build the plugin myself?

I see references to Flying Saucer PDF options in the default stylesheet, so I guess Confluence uses that as well. I don't really care what's happening under the hood, my question is what tweaks is Atlassian making to the PDF stylesheet and layout to get better output than the default?

Due to the lack of documentation and samples for getting professional-looking PDF output using the native export I'm using Scroll PDF Exporter. It's not perfect but I can work around its flaws.

Hi Robert, it took some time because we had to reach other teams, but I have added the requested information. Hope that can stack on top of your findings.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted 7 hours ago in Jira

Upcoming Enterprise releases targeting Q3 2019: Jira Software 8.5 & Jira Service Desk 4.5

Since launching the Jira Software 8.0 and Jira Service Desk 4.0 platform releases in February, many of you have been asking when the next Enterprise release will be so you can take advantage of the m...

179 views 0 3
Join discussion

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