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

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

Robert Lauriston
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.
July 25, 2013

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Guilherme Nedel [Atlassian]
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 30, 2013

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!

KP11
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.
August 26, 2013

Will the above work on Confluence 4.3.3

1 vote
Guilherme Nedel [Atlassian]
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 25, 2013

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
0 votes
Robert Lauriston
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.
July 30, 2013

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.

Guilherme Nedel [Atlassian]
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 4, 2013

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.

0 votes
Robert Lauriston
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.
July 25, 2013

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?

0 votes
Robert Lauriston
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.
July 25, 2013

I'd need to build the plugin myself?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events