Documentation for Confluence 5.8 (Server).
Documentation for Confluence Cloud and earlier versions of Confluence is available too.

Skip to end of metadata
Go to start of metadata

Confluence administrators and space administrators can customise the PDF exports for individual spaces.

Please note:

  • PDF customisations are unique to each space.
  • PDF customisation only applies to space exports (not single page exports via Tools > Export to PDF)
  • Confluence's PDF customisations use a combination of HTML and CSS (Cascading Style Sheets). 
  • To achieve a particular requirement in the exported PDF file, you make changes in one or both of the following:
    • The PDF Layout, where HTML is used to define the structure of the exported content, including features such as the title page, headers and footers.
    • The PDF Stylesheet, where CSS is used to define the style of elements in the exported content, such as page size and margins, font, colour, and list numbering.

For further customisations, see the Advanced PDF Export Customisations page.

On this page:

Related pages:

Customising the PDF Layout

You can add your own HTML to customise the title page, page headers and page footers in the PDF output.

Setting a global PDF layout

  1. Choose the cog icon , then choose General Configuration under Confluence Administration
  2. Choose PDF Layout. You can enter HTML and CSS that will be rendered on the PDF title page, as well as page headers and footers.

Setting the PDF layout at space level

  1. Go to the space and choose Space tools > Look and Feel from the bottom of the sidebar You'll need Space Admin permissions to do this. 
  2. Choose PDF Layout.
  3. Choose Edit.

If your space uses the Documentation theme:

  1. Choose Browse > Space Admin from the header

    Note: The Space Admin option appears only if you have space admin permissions, or if you're part of the 'confluence-administrators' group.

  2. Choose PDF Layout in space administration options.
  3. Choose Edit.

You can customise the HTML that is generated for the following areas when the space is exported to PDF:

  • PDF Space Export Title Page – title page.
  • PDF Space Export Header – page headers.
  • PDF Space Export Footer – page footers.

Enter your customisations into each text box as required. The PDF layout section accepts HTML code. You can include inline CSS in the HTML too.

Customising the PDF Stylesheet

You can adjust the appearance of the PDF pages by customising the CSS in the PDF Stylesheet screen.

To get started, download the default CSS rules for the PDF stylesheet - confluencedefaultpdf.css.

Any rule defined in this file can be customised and added to the PDF Export Stylesheet section. Your customisations override any default CSS rule.  If no customisations are defined, the default CSS rules will be applied. 

By default, the export does not include a title page, headers or footers. You can define these in the PDF layout. 

To customise the PDF Stylesheet:

Setting a global PDF Stylesheet

  1. Choose the cog icon , then choose General Configuration under Confluence Administration
  2. Choose Look and Feel > PDF Stylesheet. The following screen allows you to enter and save CSS code that will render content on each page.

Setting a space PDF stylesheet

  1. Go to the space and choose Space tools > Look and Feel from the bottom of the sidebar You'll need Space Admin permissions to do this. 
  2. Choose PDF Stylesheet.
  3. Choose Edit.
  4. Enter your customisations.

If your space uses the Documentation theme:

  1. Choose Browse > Space Admin from the header

    Note: The Space Admin option appears only if you have space admin permissions, or if you're part of the 'confluence-administrators' group.

  2. Choose PDF Stylesheet in the space administration options. 
  3. Choose Edit
  4. Enter your customisations.

The The 'PDF Export Stylesheet' page shows the current (e.g. customised) contents of your PDF stylesheet. 

Example Customisations

This section provides examples of typical customisations that you can add. See also Advanced PDF Customisations.

Page Size

The default page size is based on the location of your Confluence server. For example, if this server is located in the US then the default paper size of your PDF export will be US Letter (8.5 inches wide by 11 inches long). If the server is located in Australia, the default paper size will be A4 (210 mm wide by 297 mm long). More information about paper sizes can be found on Wikipedia.

To modify the page size to A4, edit the PDF Stylesheet to add a size property to the CSS@page rule, like this:

CSS - PDF Stylesheet

Page Orientation: Landscape or Portrait

To change the page orientation of your PDF document, simply reverse the order of the values declared in the @page rule's size property. The first and second values of this property represent the width and height of the page, respectively.

For example, to generate PDF space exports in A4-sized landscape orientation, your @page rule might look like this:

CSS - PDF Stylesheet

Page Margins

To set all margins to 15 mm, with a paper size of A4, edit the CSS @page rule in the PDF Stylesheet, like this:

CSS - PDF Stylesheet

To set the margins independently, edit the @page rule as follows:

CSS - PDF Stylesheet

To set margins to provide a gutter for binding a printed document, use the :left and :right pseudo-classes, as follows:

CSS - PDF Stylesheet

Note the use of the :first pseudo-class in the example above to define distinct margins for a cover or title page.

Page Breaks

By default, Confluence pages are exported without page breaks, so that shorter pages will appear on the same PDF page.

To make each Confluence page appear on a separate page in the PDF file, add the following rule in the PDF Stylesheet:

CSS - PDF Stylesheet

Title Page

You can add a title page to your PDF document by adding HTML to the Title Page section of the PDF Layout screen. The following example creates the title page and adds a title:

HTML - PDF Layout: Title Page Section

Use CSS rules in the PDF Stylesheet to control the appearance of the title page and the title text:

CSS - PDF Stylesheet
Adding an Image to the Title Page

In the example above, the title page includes an image called 'titlepage.png', centred in the middle of the page. The "590719" in the src attribute is the ID number of the page to which the image is attached.

Follow these instructions to include an image on your title page:

  1. Attach the image to a Confluence page.
  2. View the list of attachments on that page, then right-click the image and copy its location.
  3. Paste the link into the appropriate src="" attribute in your PDF Stylesheet, as shown above.
  4. Edit the image URL so that it is relative, by removing the first part of the URL before /download/....

Table of Contents

By default, a table of contents will be generated after the title page, or at the beginning of the PDF document if no title page is defined in the PDF Layout. To see the default CSS rules applied to the table of contents, download the default CSS rules (confluencedefaultpdf.css) and examine the specific rules with toc in their name.

To make changes to the appearance of the table of contents, define CSS rules in the PDF Stylesheet.

Disabling the Table of Contents

To prevent the table of contents from being generated in your PDF document, add the div.toc-macro rule to the PDF Stylesheet and set its display property to none:

CSS - PDF Stylesheet

Changing the Leader Character in the Table of Contents

The leader character is used to link a heading in the table of contents with its page number. By default, the leader character is the '.' (dot) character. Leader values of dotted, solid and space are allowed. You can also use a string, for example leader(". . . ").

To change the leader character to a solid line, modify the leader() value on the content property of the CSS rule as follows:

CSS - PDF Stylesheet

Headers and Footers

You can add headers and footers to your PDF pages using the 'Header' and 'Footer' sections of the PDF Layout screen. By default, headers and footers only apply to a space export and not to exports of single pages (however, see Advanced PDF Export Customisations). The following example adds a simple copyright notice.

HTML - PDF Layout: Footer Section

Page Numbering

To add page numbering, you need to combine customised HTML in the PDF Layout with customised CSS in the PDF Stylesheet.

  1. PDF Layout HTML: In the Footer section (or the Header section), use an empty span element with a unique ID, for example pageNum, to act as a place holder for the page number.

    HTML - PDF Layout: Footer Section
  2. PDF Stylesheet CSS: Create the following CSS selector rule for the empty span:

    CSS - PDF Stylesheet

Analysing the above CSS selector rule in more detail:

  • The #pageNum rule selects the HTML element with the specified ID of "pageNum", which is the span element we created for the header or footer.
  • The :before part of the selector is a pseudo class that allows the insertion of content before the span element is processed.
  • The counter(page) is a function that returns the current page number as its content.
  • The content property tells the CSS processor that dynamic content (that is, an incrementing page number) is to be inserted at the span tag.

Wrapping Long Words

In order to break long words or words that are not separated by whitespace, add a selector to the PDF stylesheet containing the word-wrap property with a value of break-word:

CSS - PDF Stylesheet

General Formatting

You can use the stylesheet to customise the output of just about anything else that will influence the look and feel of the final document. This includes fonts, tables, line spacing, macros, etc. The export engine works directly from the HTML output produced by Confluence. Therefore, the first step in customising something is to find a selector for the HTML element produced by Confluence or the Confluence macro. Then add a CSS rule to the PDF stylesheet. Your customisation will appear in the PDF export.


  • Demotion of heading elements: h1, h2, and so on. Due to the hierarchical manner in which a space is exported, Confluence will modify the heading elements to generate a uniform appearance for the entire space export. This means that headings will be demoted. This will affect the application of custom PDF Stylesheets. It is possible to calculate the amount by which a heading will be demoted in order to have the correct CSS styling applied. A heading will be demoted by the value of its depth in the export tree. A page at the first level will be demoted by 1 (all <h1> elements will become <h2> elements, and so on). A page at the second level will be demoted by 2, and so on.
  • Atlassian support for PDF customisation is limited. We support the mechanism for customising the PDF layout with HTML and CSS, and we will help if the mechanism is broken or does not work as we say it should in our published examples. But, since custom HTML and CSS offer potentially limitless possibilities, Atlassian will not support issues that are caused by or related to PDF customisations.


  1. hi,

    In version 2.10 I was able to make modifications to xhtmlfo.xsl to implement things such as inserting page breaks, just wondering if this is still possible or is there a simpler/better way of doing this.


    ..oops... should hav checked the doco first, can prolly do something like this in the stylesheet...
    page-break-before: always;

    and then put a div on my page where I want the pagebreak to go, with a classname of "pagebreak"

    ...YEP!!! it works, this rocks!!!!

    1. This works. But what I want is to put page break before the beginning of selected pages (top level pages) of a space. This is to mark them as chapter beginning in the generated PDF. How to go about that?

      1. Do they get translated as h1-level heads?  I did this:

        1. No this does not work. I have raised and improvement request for this.

          1. Anonymous

            Overriding the h1 class in PDF Stylesheet using the following seems to work:

            The padding is an example only, but the "!important" bit is needed for any other conditions you want to add to override the default stylesheet.


            1. I've tried various things to force this page break, but none of them worked. I'm on version 5.4.4.

              This article says:

              page-break-before: always;
              That doesn't work for me. Neither does:
              .pagetitle h1
              padding-top30px !important;
              padding-bottom30px !important;
              Neither does:

              h1 {
              font-size: 18pt;

              Confluence folks, how do you get this to work?
  2. If you want to have a footer on a page-export (not just on a space-export) you could do something like that:

    1. Anonymous

      great. at least someone (not Atlassian) is being very helpful here.

      do you know how to make the top of the pdf show a company logo?

      1. The easiest way to export a single page with all of the customizations is to go to the Space PDF Export, insert the appropriate HTML for your image in the header or footer section of the PDF stylesheet and then select only the single page you wish to export.

        Matthias posted a great work around above. You might be able to do something like (I haven't tried this)

        The key part is

        content: url("")

        where you replace the url with your image url.

        1. Anonymous

          This solution isn't working for me. It should... But it isn't.

          1. I managed to get this to work.

            The header has a height limit determined by the margin-top that you set. If you have a larger image it will appear to be truncated.


    2. Thanks for this. How did you know about those @bottom-right, @bottom-left ? Is there something equivalent for the top? Is there something for centering (@bottom-center?)



      1. I just tried and @bottom-center and @top-left all work fine. I just don't manage to use an url. Is there anybody who has this working? I already double-checked my image url. I tried with png and gif image, nothing seems to work. The place where the image should appear stays blank. I can use the image fine using the html with the space export, but in this single page workaround it does not seem to work.

        1. Anonymous

          Same question as above. Anyone who has manage to use the url workaround:content: url("");

          Atlassian: I´m very disappointed that you only have released an half finished solution of the pdf export function.

      2. Refer to CSS3 Module Paged Media, Table 1.

        Available margin box definitions:

        • top-left-corner
        • top-left
        • top-center
        • top-right
        • ... etc

        Centering - use the following:

        • text-align: center; /*centers horizontally within the margin box */
        • vertical-align: center; /* centers vertically within the margin box */

        Each type of margin box has certain default centering; refer to Table 2 on the page.

  3. Is it possible to use the "old" (2.10 etc..) pdf creation style(sheet) method in the 3.0 version? The old way was to edit common_footer_fop.vm, common_fop.vm, common_header_fop.vm, Page.pdfexport.vm.

    We have a solution that works for us now (the old way on a 2.10 installation) and the new improved way breaks this. When we exports a page we and our customers always use the export to pdf feature from the Tools menu.
    1 page = 1 document/user manual. We are working on a publishing solution (to an external site) with confluence on both sites, and with the new improved confluence we can´t proceed. up to now we have solved all our problems
    with extrnal scrips etc. but this new way of creating pdf stops us from moving on.
    We could theoretically go ahead with our project running on 2.10, but 3.0 offers so many improvements and as we don´t know how confluence will evolve in the future, i´m not sure we are willing to take that risk.
    I believe that it´s fine that you do and upgrade of the functionality but don´t break the backward compatibility until you have solved all of the problems. For instance, why not have a global settings for pdf export that
    can be overridden on space and even page level?
    The new way to setup pdf exports is a step i the right direction tho we don´t need to keep track of all our modifications on an upgrade. Thats one of the problems with the old way of configuring pdf export (as I see it).



    1. Hello Anders,

      Unfortunately, it's not possible to use the old PDF export customisation methods you're referring to (also described on this page) in Confluence 3.0.

      The PDF export engine in Confluence 3.0 has effectively been re-written from the ground up to provide much greater flexibility over PDF export customisations. This in itself has addressed many customer improvement requests that were limited by the older PDF export engine in Confluence 2.10.3 (and earlier versions). All PDF export styling modifications in Confluence 3.0 are now implemented via the PDF stylesheet customisation approach described on this page.

      If you would like to implement headers and footers for single-page exports, you could try using the method described in Matthias Alder's comment (above).

      If you have any other improvement requests for this feature, then I recommend raising a JIRA feature request.

      I hope this information helps.

      Kind regards,

      Giles Gaskell
      Technical Writer

      1. Since Atlassian is aware of the problem of users not knowing how to write code for the PDF Export, is it possible to post some common options used.  We typically export a page, not the entire space.   I have been able to get the page number to work, but that's it.  I would like to have the space name with the location of the page, basically the breadcrumbs, along with the date.  I have posted my code below.  Any assistance would be appreciated, or even how to made the exports look like the 2.10 version.

        Such as:

        • Adding the space name
        • Adding the location of the document
        • Adding the page number
        • Adding the date
        1. This would be great, because I do have the same issues here as well. Could that then work for a Space as well?

    2. Anders,

      you are absolutly right. I woud use the customisation-option for PDF-Export, but it has to by more flexible.

      Since Conf 5.x I have the option to choose a template for creating a new page just with on click. That should be the way for exporting to PDF. Just use export to PDF and in the next dialog I want to have the option to choose a template out of a list of avaiable templates, which are created before as global templates.

      That would be the first step for me. Everthing on top will be benefit.


      Regards Oliver


      Uups, I missed the date of this post

  4. I like the idea behind being able to edit PDF output, but IMHO this feature will almost never be used due to the non-functional aspects of it's implementation. Here's why:

    • Only admins can use this feature. As stated in some of the comments above, admins usually can also just edit the velocity templates anyway.
    • The templates are stored by space

    Taken together, this is the workflow behind changing PDF output, for a typical user and admin:

    1. User: Ask an admin to change the output for your space
    2. Admin: determine if the CSS for that space has already been modified. If it has, manually track down, or remember which user requested the last change.
      1. Admin: if changed before, talk to old user and determine if they rely on the previous PDF format in that space. At this point, the "pecking order" of the two users may need to be evaluated.
    3. Admin: notify all affected users of a space that a global change has been requested.
    4. Admin: if approved, work with user to make the style modifications.

    By this time, the user could have just opened the page in word and manually made the changes. It also creates too much work for the admin (if it ever even gets this far), and allows the tastes of 'more important' users to be forced upon less-privileged users. For some situations this makes sense, but not printing.

    Does anyone else think it would make more sense for each user to have their own PDF style, as opposed to each space having one (or any other similar solution)? It makes very little sense to me why a user should a) need space admin privs in order to pretty-print a page they can already view, or b) have to ask me to do it for them (smile) .It also doesn't make sense that when one user wants to change the way something is printed, that all other users have to print it that way. Or that two documents in the same space must be printed the same way. You get the idea..

    1. I should add that most users would probably request a change like this be made for a single document. After the document it exported, they won't care again until they need a different document printed: and they'll know that you, the admin, have the ability to change it for them... so in the end, most users will get stuck with what's in there after the honeymoon phase for this feature is over.

  5. Does anyone know what I need to enter in the stylesheet to get the PDF to export the same as it did in 2.10?  We thought it worked just fine and now when we export the font is smaller, and there's no header or footer.  This is just for a page export. 

    I'm really surprised to see the defualt export completely removed.  Now I need to re-create it and go back and add it it every space.  Couldn't it function as the other style sheets where it can be set globally and then changed at the space level?

    1. Hi Corey,

      Confluence 3.0 introduced a new PDF export functionality, which is directly based on the HTML and CSS of the page. There is no more conversion from HTML -> XSL-FO + FOP -> PDF. However, the following are the feature requests that I think might be helpful for you:

      Feel free to vote for them, add your comments and 'watch' the requests for future updates.


      1. Thanks Azwandi, I have voted for all of the PDF changes.

        My problem still stands that I don't know how to add the Space name in the header, like it was in version 2.10 or how to add the date it was printed.  We typically export 1 page and do it from the page instead of the full PDF export due to the volume of pages we have.  No one is allowed to modify the CSS files so it's hard to figure out what is going on.   

        It seems that there are a lot of people that don't know how to use the new PDF export feature and who are waiting for the requests to be completed.  In the interim is it possible to post a quick how to guide for common fields?  Things that people are requesting link: Page name, Space name, Path to page, date, time, page numbers, logo, etc...  It's frustrating for such a drastic change to be made without having instructions on how to use the new feature.

        Any help would be much appreciated.

  6. Anonymous


    today I tried to change PDF-Export Header to show an image in the header.
    I wrote:

    The Image is still in the unexpected size.
    What can i do to enlarge the image in the header section?



  7. Hi,

    Is there any way to add the title page in the PDF ?
    I would like to add the title of the current page in the "PDF Export Title Page" section.

    (maybe the document title does have sense only for single page export ?)

    I looked at the standard css ( and I found that :

    By the way, I didn't find any reference to page attribute in w3c reference ( I guessed it's an atlassian addon ?
    However it didn't work for me if it should display the page title.

    1. The multiple page export is interessting, but there is a limitation as it is not possible to have several documentations with the same structure in the same space.

      I tried to import several of our documentation in one space, however if all your documentation have a chapter : Introduction (or whatever you want), the page name is unique in a space so you will have to delete or rename the page.

      So I choosed to use the single page import and the single page PDF export.

      I've succeeded to have a single page export quite good for our purpose with :

      - a table of content (not the true table of content, but the rendering of toc macro)

      - a header with page number and our corporate styling

      - auto numbering in front of each section (h1, h2 etc...)

      If I would like to share some of those settings, what is the  best place to write it ? (confluence forum, this thread etc... ?) 

      1. Hugo,

        I would like to see how you did the auto numbering and corporate header, so if you could include the code here it would be great.  Do you also know how to add a page name to the export? 


        1. For the header, it's just a CSS style
          In "PDF Space Export Header (HTML)" :

          and in the CSS stylesheet :

          that way it just gives a little header with the company name and the page numbering.

          For section numbering I've added the following in the CSS stylesheet (it's just an extract of my own stylesheet, hope it will works for you) :

          1. Anonymous

            Hello, Hugo!

            I am trying to tune auto generation of toc (Conflunce 3.0.xx)

            I faced a problem - when exporting to PDF a single document from one page, the doc header has h1. style, but the page internals starts from h4.

            User Manual


            Because of this problem I am getting the following auto numeration:

            1 User Manual

   Chapter 1 Introduction

            But actually the exported page has the same structure:

          2. Can you say which version of Confluence you were using? I have tried this with 3.0 and the counters are re-set on every page, so I get 1s and 0' as in the previous POST. If it works on 3.2 then I will take the pain of upgrading.

            I did try to check this out on the on-line sandbox but I couldn't see the PDF Stylesheet edit, just the HTML headers and footers.

          3. Has anyone been able to make section numbering work? The above doesn't work for me: section counters are reset for every wiki page (only sections within a page are incremented).

            I also tried this simpler CSS to no avail:

            I am therefore forced to remove numbering in the TOC like this:

            1. This is impossible to fix. As Mikko writes in CONF-19430: page.vm wraps each page in a div, and css counters don't work across <div>s (new counter instances are created)

              1. Anonymous

                I've run down the same rabbit hole!  After spending a few hours learning the basics of CSS and getting all excited about how 'easy' it is to number HTML headings with the sort of basic code Vladimir shows, above, I beat my head into the wall wondering why it didn't work with the PDF export...

                This is a critical issue for us, as the ability to export good looking linear (PDF) documents from page tree slices of a space is pretty much required to get document-centric management and technical staff to accept moving key material into Confluence in our organization.

                If anyone has other ideas for workarounds, please post them!


                MIke C in AZ

  8. Anonymous

    Is it possible to view the intermediatary HTML that is used to generate the PDF's?  It is hard to understand the CSS tags without refering to the HTML that is generated.

    It is frustrating that the (former) ability to customize the single page PDF export has been overlooked / removed from 3.0...

  9. Anonymous

    I desperately need a way to pull the space name onto the cover page when exporting an entire space to a PDF. Has anyone figured out a way to do this yet? We use Confluence for our client documentation with each client having it's own space. This brings me to my second question - is there a way to apply a global style sheet? If not I'm faced with manually creating 60+ style sheets which doesn't feel like an efficient use of my time.

    1. Hi,

      There are some limitations exposed by the new PDF export, hence, the following feature requests might be helpful:

      Feel free to add your comments, cast your vote and 'watch' those requests to be notified on future updates.

      Hope that helps,

  10. @anonymous1 : you can export the space in HTML (same location as for PDF export). In theory this HTML is used to generate the PDF.

    @anonymous2 : as a workaround I suggest you to make a selenium script

  11. Anonymous

    My company uses confluence 3.0.
    I need to add the title of a parent wiki page in each PDF pages.
    I tried to modify my PDF stylesheet to do this, to no avail.
    Do you have a solution for this?

    Thank You,


    1. Hi Aurélien,

      I have tried to accomplish this too in my instance and I am not able to achieve it. However, I have found an improvement request that is related to this issue. I have voted myself for this improvement request. Please add yourself as a watcher, vote for this feature and add your own comments to this feature request. For further details on how we include new features and improvements, you might want to read this page


  12. Anonymous

    Is there a simple way to turn off the section numbering in the export?  We have some topics with numbers and some without.  The PDF export works well as is - except the number in the TOC.  Any chance there is an example out there for modifying the PDF export CSS to turn off the number?


    1. Try this (I haven't)

  13. Unfortunately, this is a really lousy documentation. We need to  have our coporate logo on space exports, but neither way i tried from the documentation succeeds (thumbs down) . How can we manage to have our logo in the upper right corner, at a certain size, and with certain margins to the top and right side? I'd really appreciate some sample code here :-(

    1. Hello Oliver,

      Thank you for your feedback on the documentation. Have you seen the Advanced PDF Export Customisations page which was published recently? Perhaps the Adding Images to Headers and Footers section on that page might be helpful to you.

      If none of the information these pages help, then I'd be really grateful if you could be more specific about your requirements to help us improve our documentation in line with the requirements of our customers.

      All of the examples on this and the Advanced PDF Export Customisations pages have been tested to work successfully in accordance with our documentation. If you find it does not, then please raise a support request.

      Also bear in mind that the purpose of this documentation is to provide guidelines on how best to use the PDF export functions in Confluence, along with typical/popular CSS and XHTML examples of PDF customisations. It is not meant to be an in-depth tutorial on CSS.

      The W3C CSS3 Module on Paged Media provides information on additional CSS rules that you could use in your PDF stylesheets.


      Giles Gaskell
      Technical Writer

  14. Hi all,

    Is it possible to control the column width of what seem to be "grid" tables (i.e. imported or autogenerated tables). For example, my Confluence page imports an external JIRA table using the following macro:

    However, when I export this to PDF format using the new PDF export stylesheet the table content overflows the PDF page. I want to be able to reduce the width of a table to say 75% for example or control column widths and how the content in a column is wrapped.

    I can reduce the width of a standard table when rendered in PDF using the ".wiki-content .confluenceTable, .grid" CSS selector in the PDF Export Stylesheet section. However, this selector does not seem to work for ".grid" tables.

    Can anyone explain how to control these so-called grid tables?

    Rgds, Dermot

    1. Anonymous


      Have you figured the story with column widths anyhow ?



  15. Another PDF export question: When using generating PDF based on a custom stylesheet, the index is always off by one. For example, the table of content refers me to page 12, while the actual text starts on page 13. This is undoubtedly caused by me forcing a page break before every h2, but it makes for a sloppy document. Is there a way to correct this?

    1. Kees, this sounds like a bug. Can you file an issue in that details how to reproduce the problem.

      1. We are seeing the exact same thing. Was this ever addressed? It would be very nice to get this working the right way.

  16. Anonymous

    I too am having a fun time trying to guess what HTML is being generated when exporting to PDF.

    Assume the following style:

    This renders a 2px green border around the entire page contents, not the page title.

  17. Hi,

    I am trying to do export pages within a space.  Is there anyway I can include the page title as the header in the pdf header on a page by page basis, and page specific information in the pdf?

    E.g. I am exporting the spaces "Archiving Mail Overview".  Is it possible to  add "Importing mail", "Deleting mail", "Fetching mail" as title to the top of the header when those pages are converted in PDF?

    The old version 2.10.2 supports these by allowing me to modify the velocity templates file.

    I did this with common_header_fop.vm in the old version.

                <fo:table-cell color="grey">

    I find the following in the sample css file:


        page-break-before: always;


        margin-top: 0;

    And can I also include the last modified person and the version in the header?

    That's how I did it in the old version by modifying the Space.pdfexport.vm

    <fo:block color="grey" font-size="8pt" space-after.optimum="12pt">
                    This page last changed on $dateFormatter.format($page.lastModificationDate) by <fo:inline color="#0050B2">$!page.lastModifierName</fo:inline>.

    and it would print:

    This page last changed on December 2, 2009 by Joe



  18. Is there a way of integrating the export details of a pdf somewhere in the exported document? In other words, I wish to include details such as Exported by [username] on [date] from [name of space].


    1. This might be possible if this feature request is realised. Feel free to drop your comments in the feature request, cast your vote and watch it for future updates.

  19. How can I get the comments printed in the PDF as well?

    1. Hi Andreas,

      I am sorry to inform that starting from Confluence 3.0, this feature is no longer available. However, I have found a similar feature request. Please add yourself as a watcher, vote for this feature and add your own comments to this feature request. For further details on how we include new features and improvements, you might want to read this page


  20. Hello Atlassian,

    i'd like to use a css-file rather than the pdf-styleheet-textfield.

    Can u give me a hint, how i have to place a css file and set the CSS "@import" instruction in the textfield?!

    I've been using the same method with the normal css (global and spaces), but these paths dosn't work for pdf expórt.



  21. Anonymous

    Where can one find documentation on the functions used in these examples?  For instance:

    "content: counter(pages);"

    "content: url(http...);"

    "content: element(footer);"


    I want to add the page name to each page footer and I am trying to figure out if there is a function available.

  22. How can I remove the Page Title using the PDF Stylesheet?

    I tried this    .atb-title {display:none;}    but that doesn't work.

    1. Hi Almar,

      You can try to insert the following CSS to PDF Stylesheet:

      Please take note this should work fine in single Page PDF Export, or Space PDF Export of multiple pages only if they are all in the same level.

      Hope that helps (smile)


      1. Thanks Husein, it works fine.

        1. Anonymous

          Why can't I get a background colour to appear on a h1 which is within a table. I'm using this css

          .wiki-content h1 { 
          background: #CDF2F7;

          I just don't get it, please help!

  23. I have a question that seems basic, to me.

    Is there a way to customize the placement of page numbers, in the footer?

    I'd like the page number to be far right - on odd pages, far left - on even pages.

    Surely this is possible. Why can't I figure it out?!

    Does anyone have the answer?

    1. The following changes to the PDF style sheet is not a full answer but it will put stuff on the left and right of the footer:

      and this to the Export Footer

      1. You know, I tried this, and it didn't change anything.

        That's weird, right?

        And, now, I have a further need - I'd like to have my page numbers right and left, but I'd also like a copyright notice in the center of every page's footer.

        At this point, though, I'd settle for a centered copyright notice, and a page number that isn't nestled up right next to it.

        So I did, using this:

        <div align=right><span  id="pageNum"/></div>
        Copyright © 2010 Tektronix Communications. All rights reserved.

        I fianlly suspected something I didn't know, that I didn't read anywhere, that no one ever told me, which is: Confluence responds pretty well to standard HTML.

        Is that a basic assumption about Confluence programming that I just didn't know?

        Are there any notable exceptions?

        Can I now run wild with it?

    2. I looked at the CSS3 Module Paged Media page and found what you needed under Example V.

      Have not tried this, but based on the page, it should work.

      1. I used HTML tables and it worked beautifully.

  24. Anonymous

    Basic question - I have gone to Space Admin to edit the PDF Stylesheet, but the option "PDF Stylesheet" doesn't appear in the left hand side panel. Have I missed a setting or is there another way to access the Stylesheet.

    What I want to do is preserve the columns in sections when the page is printed to PDF. Currently on export, the columns are ignored and the text placed vertically.

    This typical is mark-up for the pages:

    Title 1

    Bah blah blah


    Bah blah blah

    Bah blah blah

    1. Hi,

      For your information, the PDF Stylesheet have to be enabled by global admin in order for a space admin to be able to see the option.


  25. Anonymous

    Why are we still not able to fully configure "all" css rules for a single page export, for example a header logo?
    Here are severals ideas and I wonder why they don't work.




    It would also be nice to have wiki variables, since you already have "page numbers". I would also preciate a full documentation about all stylesheet and layout abilities and how far we're able to use it. And specially what the changes affects. I have to go through comments to see that the variable "page" defines the actual page number and "pages" the total of all pages.

    1. Try

      Make sure your image is not too big though.

      1. Anonymous

        Hi Gerald,

        i tried your solution but it doesn't work. Is there any new solution for handling the problem with the single page export? I want to insert a company logo on top of the heading.

      2. Anonymous

        Hi Gerald,

        i tried your solution but it doesn't work. Is there any new solution for handling the problem with the single page export? I want to insert a company logo on top of the heading.

  26. Finally got a version working the way I want it to be. I wanted to create a new page for every article (wiki-page).

    The standard item as mentioned in the standard CSS didn't seem to work:

    The point to get a new page for every wiki-page is solved with:

    You can even add ".pagetitle h1 h2 h3 h4" to force it on every header, but that seems the same as adding the page-break-before in the standard h1 notation

    1. This is BRILLIANT! I just implemented it. Thank you.

    2. Anonymous

      thanks! Exactly what I was looking for!

    3. Anonymous

      Anyone know how to make this create a new file for each article?  I'd rather have 300 files created than 300 articles in one massive PDF I can't email, share, push to the iPad easily, etc.

    4. I was hoping to do the same, and I added the same code as you suggested above, but I still don't get a page break before each Confluence topic. I choose Browse > Space Admin. Then select PDF stylesheet in the left nav bar, and then click Edit on the page. I entered the following:

          page-break-before: always;
      Am I missing another step?
  27. About a year ago somebody asked for the ability to add the following to PDF exports:

    • Adding the space name
    • Adding the location of the document
    • Adding the page number
    • Adding the date

    These are features I desperately need - an exported document (we use Confluence for documenation) should include its name on every page, its version and the date it was printed - basic stuff. Is this possible yet? If not does anyone know when?

    1. Anonymous

      I also need these features. In particular I need to add the date to the top of the page.

      Could anyone provide examle of how to do this?


  28. Hi,

    played a little around with it and came up with 2 (not so good) solutions:

    1. Create a gif file, upload it and put it in the PDF Export Header. This works only when you have full control yourself and can create the gif file upfront.

    2. This is a tricky one:

    Edit the PDF Stylesheet and create a new table class:

    Then put this on top of your pages or create a user Macro with

    This places a table above the Header on your PDF Doc. Disadvantage is you have to put this macro everywhere on all your pages. The advantage is that you can create several macros to change the layout per page or page-type.


    macro you can show this information only on your PDF's and not on your screen.

    By the way: ro remove the Edit Document Button on PDF prints when Word documents are viewed by the viewdoc macro, these lines in your PDF Stylesheet will remove this:

    I still have't found a way to remove the border on these PDF prints.
    The .office-container class doesn't seem to work.


  29. For the life of me, I cannot change the font size for the main content of the pages I am trying export. This seems like it should be about the easiest thing to control. I am adding the following code to my Stylesheet:

    I'm sure I am missing something simple. Anyone know what I am doing wrong?

    1. Hope that I got you right, so the following might be an advice to you to solve this.

      The appearance depends to that what comes after this bit of code you did apply, depending also where you did place bits of code’s.

      If you set this at the top of the style sheet followed by other instructions in the style sheet for a space, it will get overwritten. Inside a style sheet confluence does apply the latest bit of code - so the latest gets validity against any prior occurred.

      Confluence is using its default setting if no other code is applied!

      Global and default settings get overwritten by space settings! If you have code set on global level but no code applied on space level it takes the global one.

      If you did not apply code on global style sheet, confluence will use the default CSS which seems to be the same as used for PDF Style sheet.

      3rd. party themes might also overwrite standard settings or overwrite whole areas so that you have to know where to embed code. So it could be that your code is actually applied to an standard container but which is not displayed because the theme uses a different named container to display this content.

      If you take a glance at the CSS instructions for PDF Styles you might find out how to apply a better bit of code to the correct place that fit’s to what is expected.

      Such a behavior or such an order of validity of code is a main feature of CSS and gives you the ability to customize any space individually to your demand.

      The font size of the main content (assumed to be the body of the wiki-page) I got changed by e.g.

      Works on my installation - it might work also on yours.


  30. Hey Atlassian!

    General comment - maybe you want to beef up this section? We clearly want to edit our stylesheets, and you really don't provide much info.

    Some more samples and examples would be very much appreciated.

    1. Confluence is the most flexible WiKi available right now.

      Did you read the documentation of Confluence?

      1. Hi Klaus,

        I did actually, thanks for asking and for offering your opinion.

        IS there a section I missed, with the information I was looking for? Editing stylesheets with some samples or examples?

        If not, you don't have to bother to reply.

        1. Wow…you might be the first one who did read the whole manual after me but you might want to go through it again. You maybe missed to figure out the "Structure of Confluence" or how confluence is organized.

          Well if Confluence tech-writers would write down all those possibilities and would give sufficient examples about it, it would be more easy for sure, but it would also mean to add 10000 pages and more, I guess.

          I went through this process of understanding how and where to apply which kind of code to get what I want and by the end it was almost much easier than I thought at the beginning.

          You can do all with HTML but thats not keen.

          Confluence uses different coding on different levels and it does distinguish whether you display something or print it out.

          You have stylesheets for global, space and page settings. You can use macros, usermacros, plugins, templates to achieve what you want.

          If you go deeper you can change .vm or .jar or add custom CSS files and images to change presets and global appearance.

          The most easy way to figure out what you need to do is to use Firebug PlugIn in Firefox.

          Confluence Dokumentation is not a place to ask questions which are to specialised, you will get much sooner an answer if you sign into Atlassian Answers.

          So if you applied some code anywhere and you did not got what you wanted or you even got no change at all, you must have just either the wrong place, wrong code or wrong syntax or simply do not know what code to use. If you look for missing code this documentation is the right place to do and I if someone asked kindly he always got an answer.

          You could use the style-macro to apply CSS right into a page first for testing whether those results do what you want and than apply your final CSS to a space-stylesheet, global-stylesheet, or using a macro or assign it to a template. This is just a fast way - you can use preview.


          1. Klaus,

            I don't think Lauren was referring to every possibility in Confluence.  The problem that users are experiencing is the PDF Stylesheet/Export.  When this changed in 3.0 the users were not provided documentation on how to make the PDF Export look the way it did in earlier versions.  It was blank, meaning no page numbers, dates, page headers etc. 

            All the users want to know is how to add basic header/footer information to their PDF's.  As you can see by all the posts on this page the users do not understand how and are not getting answers.  We are only asking for documentation to add the same information that was exported by default in earlier versions of Confluence.  I find it really frustrating since my first post was in 2009 and a solution still hasn't been provided.  A change of this nature shouldn't be made without comprehensive documentation.

            I am familiar with HTML and CSS, but when it's done in Confluence to gather information for Confluence fields it is different.  Just sending the user to a W3C site is not going to help them.  The users would really appreciate documentation on how to do the following.

            • Adding the space name
            • Adding the location of the document
            • Adding the page number
            • Adding the date
            • Adding an image

            Thank you!

            1. I have no answer for "how to get dynamic content into PDF stylesheet" if you don't use available plugins or macros.

              My prior comment might sound some kind of arrogant to those users working with confluence prior 3.0 (or all) – I did start using confluence from version 2.9 and used to work with PDF export since 3.0, so I am not aware of any problems those people that have upgraded their systems to 3.x.

              I did try following: image and page number.

              On this page and Advanced PDF Export Customisations i did found a number of examples of how to get an image and page numbering placed into a stylesheet and both did work for me.

              All the rest is dynamic content and I do apply such through macros placed placed in live templates, templates or pages.

              I hide dynamic content either from being displayed using macros such like noprint or show-if.

              I never tried to customize stylesheets any further to embed dynamic content into it and you are right, there is no documentation available of how to do so.

              I did check completeexport.vm and master.css to find out what is possible and needed. You will find those files here:

              your-confluence install directory/confluence-3.x.x-std/confluence/WEB-INF/classes/classes/com/atlassian/confluence/setup/

              After unpacking you will find completeexport.vm and other relating files within  .jar called confluence-flyingpdf-plugin-1.xx which you have to unpack also. The corresponding file is called : completeexport.vm; you will find it under following directory: confluence-flyingpdf-plugin-1.12/templates/extra/pdfexport/completeexport.vm

              But this is for sure something to be modified by programers.

              You might want to raise an support request or ask Atlassian technical writers to enhance current documentation.

              1. Thanks for your response Klaus.  I appreciate it.

                I have voted and added my comments for dynamic content.  My main problem with the PDF change in 3.0 is the dynamic

                content. Our managers really liked having the location of the document printed so they would know where it came from. 

                I was disappointed to see that a new exciting feature was added, but it actually was a step backwards because of

                the limitations.  I just wish it was more of an important issue to Atlassian since many users have expressed their

                need for the dynamic content since the new feature back in 2009.

                1. OK. I understand your problem.  Is it really a step backward or is it a question of workflows? 

                  It might be better to swap this issue to the confluence form and it would be also good to raise an support ticket soon, if you did run into a problem after upgrading to 3.x.

                  I dont vote for dynamic content to be included on an easy way – as it is now confluence is more secure and it is more easy to customize it.

                  Keep in mind that available macros like reporting plugin and meta-data do what you want.

  31. Anonymous


    When I go to space admin and change the pdf stylesheet, these changes apply to all spaces in our wiki. How do I make changes to the PDF stylesheet for a single room?

    I have inserted a logo using the PDF layout, but it is written over by the content of the page. How do I change the top-margin for the content?


    1. Same problem. If I apply PDF Stylesheet changes to a space in Confluence 3.1, this change is replicated across all spaces automatically.

      The remaining elements of the 'Look and Feel' section: space logo, PDF Layout, Themes etc. remain space-specific.

      Anyone else encountered this? And found a way to stop it?


  32. Anonymous

    Please can someone tell me how to get a page break after the title page - so that the Table of Contents starts on a new page. Thanks very much.

    1. search for break on this page and you will find it!

      1. Anonymous

        Thanks - I read this page but it didn't help me. Anyway - I just added a simple page break in html code on the page title bit and that worked. Thanks anyway.

        1. Anonymous

          OH no - now my headers and footers have disappeared!! Any ideas?

        2. did this thread pagebreak and following comments on this page not help? Including html is not the best way!

    2. Change the sample to:

      It does seem like a bug to me that this doesn't automatically happen, but I'm not convinced. I've filed it anyway

  33. ¿How can I show the page name or the page url in the footer for a PDF export?

  34. If I use a custom stylesheet, is it added to the default, or replaces the default? Atlassian, please clarify in the documentation.

    And two questions about confluencedefaultpdf.css attached to this page:

    • why would you hide something that is .print-only ?
    • the documentation talks about #pageNum, what is this used for?
  35. I'm trying to put an image before h1 text, which is simple enough, but it does seem to be working. I use:

    This is correct, as you can see by visiting:

    Except it doesn't actually work. It works with text but not images. Anybody know why?


  36. Is there a way to specify how big images (that are "thumbnails" in the wiki) appear in the PDF?

    I downloaded the Confluence PDF Stylesheet and am customizing it. 

    I'm also interested in removing the numbers from the TOC. Any idea how that's done? 


    1. OK, found that this is not supported (yet). If you use thumbnails and care about image quality in PDF, vote for this issue:

      1. The workaround is to use the {show-if} macro for each thumbnail image:

    2. I figured out how to remove the numbers from the TOC, but now I want to right-align the numbers (while keeping the headers in the TOC left-aligned).  


      1. Answering all my questions today. The reason I wanted to right-align the numbers is that I've changed the font size for the different levels in the TOC - which then made the left-aligned numbers look sort of awful. I used the following to right-align the whole toc (I think), which looks less awful.

      2. Anonymous

        Could you explain how you supressed the numbers in the TOC? Im also trying to remove them...

        1. I think this is what I did. In the PDF Stylesheet (supplied by Atlassian):

          1. Look for the lines for each TOC level, such as div.toclvl1:before.
          2. Comment out the lines that look like:
            So, my stylesheet has:
          1. Anonymous

            Thanks! I figured it out by putting

            content: " ";

            to remove those numbers. You method is cleaner and works !
            I'm now trying to add a title (Table of Contents) to that toc page, have you done so by any chances ?

            1. Have you tried something along the lines:

                  display: block;
                  margin-top: 40pt;
                  margin-bottom: 20pt;
                  font: 24pt/34pt "Open Sans" !important;
                  color: #EF2B2D !important;
                  content:  "Table of Contents ";

              BTW, the above assumes that you do not want the automatic numbering.  That was my need. 

  37. Anonymous

    I'm having trouble actually finding the PDF Stylesheet. It's not where it should be (in the left-hand panel of the Space Admin page). Any reason why it wouldn't be there, and any idea how I can get to it?

  38. check your admin rights! and if you have rights to admin a space and its still not there than check your theme layout.

    1. Anonymous

      I have full admin rights as far as I can tell (looking under Space Admin / Permissions, everything's green), and the theme is just the default Confluence theme.

      Is there any sort of admin rights that I might not have that aren't displayed under Space Admin / Permissions?

      1. no. If you are a space admin and dont see a stylesheet link than someone managed it somehow to disappear by changing .vmd files somewhere on the server or your confluence administrator did switch it of as a confluence-admin -- which I know is possible to do so. 

        1. Anonymous

          Right. I'll ask the admin about that. Thank you!

  39. Just wanted to share how to hide any slides from a PPT / office document you may have included, in order to get rid of those annoying "click here to download Flash" messages. 

  40. Anonymous

    I use this stylesheet for pdf exporting, it does its job really nice.

    1. Anonymous

      Thanks - this was a great basis to work from!

  41. Hey

    Does anybody know how to display an image across all the header. I mean from the left to the right edge of the header.

    I've defined the "PDF Space Export Header" as follows:

    My PDF stylesheet has the following page properties:

    @page {
    size: 210mm 297mm;
    {        content: element(header);    }
    {        content: element(footer);    }

    As a result, my image appears at left but has a left blank margin. I was able to delete this margin by setting the @page left-margin to 0px but it affects the left-margin of all the page, which I don't want.

    Does anybody know how to proceed ? The top-left, top-center and top-right properties might be really useful for page numbering and other staff, in my case I just want to get rid of them.


  42. Anybody know how to get the PDF exporter to repeat the table headers when a table breaks across a page? The standard HTML/CSS trick doesn't seem to work:


    1. Anonymous

      Steve, you found a solution? I have the same problem

      1. Steve, you found a solution? I have the same problem

    2. Does anyone know of a solution to this? This is exactly why I was searching the confluence information to see how I could solve.

  43. We use some special table layout in our confluence, using td:first-child, td:nth-child() and td:last-child. In the global stylesheet these work fine, but in the PDF stylesheet only the :first-child attribute works. Is there any way to make the other attributes work as well?

  44. My space contains 1000+ pages. The table of contents do not display 1000th page in 4 digits. It shows them in 3.

    1002 is shown as 100

    1500 is shown as 150

    How can I fix this please?

    1. Hi Nirdesha, I think the following CSS will fix this for you (just add this to the PDF Stylesheet as described on this page):

      Please let me know how that works for you.

      You might like to vote for this issue: CONF-24004

      regards, Paul

      1. Anonymous

        Hi Paul,

        It works well. Thanks for the quick feedback.

  45. Anonymous

    How can I get the actual value of a chapter h1,h2,... in a pdf-space-export ?

    I wanna use chapter's name in page header, e.g.

             content: someUnknownFunction(h1);




  46. Anonymous

    Is it possible to get the page title of the root element of my export?

    I want to repeat this on every page as a footer and have it on the first page as document tilte.

    No clue how to start (sad)




  47. Anonymous

    Is there any possibility to get numbered page titles within the content after exporting as PDF from space?


    1. Unfortunately, section numbering in the PDF export is unavailable. Please vote on this issue: CONF-19430.

  48. HI,

       How can we automatically embed the page title dynamically on the title page instead of a hard coded value as the example shows?

    <div class="fsTitlePage">
     <img src="/download/attachments/590719/titlepage.png" />
    <div class="fsTitle">Planning for Confluence 4.0</div>
    is there something like $pageTitle or another macro?
    1. Hi Abhishek,

      A somewhat irregular approach is described on this page: Advanced PDF Export Customisations, under the 'Adding a Dynamic Title to the Title Page' section.

      1. Anonymous

        Hi Paul,

                     That doesn't seem to indicate what exactly we need to do to have the image and dynamic title?

        <div class="fsTitlePage">

         <img src="/download/attachments/590719/titlepage.png" />

        <div class="fsTitle">Planning for Confluence 4.0</div>



        I tried removing the hard coded title and adding the CSS but it doesn't seem to work?

  49. Is there anyway to do this using Confluence OnDemand?

  50. I have been trying to use the following to add the Page Title to my PDF exports with no luck - it appears that the string(xyz) method has not been implemented in the PDF generation tool used by Confluence. Anybody else had any luck with this?

    @page { 
       @top {
          content: string(doctitle)
    h1 { string-set: doctitle content() }
  51. any way to have different first page footer?

    esp to not have a page number on the title page

    tia for any help

  52. Anonymous

    I also need a different header and footer on my title page.


  53. Why are all table columns set to the same size on PDF export? I want them to size like they do in HTML.

    1. This is not a direct answer to your question, but here is a copy of a comment that I added yesterday to the "Confluence 4 Editor - Customer Feedback" page (I'm copying the comment here, rather than linking to it, because the number of comments on that page have been causing timeout issues; try adding a comment to that page, you'll see what I mean):

      Suggestion: To control table column widths, use Firebug (or similar browser add-on) to add a style attribute to a table cell element, specifying a CSS width property.

      I have performed only limited testing of the following technique, so there might be gotchas that I have not noticed, but this seems to work both in view and on PDF export:

      1. Open a page in the Confluence rich text editor.
      2. Using Firebug (or similar), select the topmost cell (probably a header cell) of a table column whose width you want to set (use the Firebug toolbar button that shows a pointer-shaped cursor pointing inside a rectangular outline, with the tooltip "Click an element in the page to inspect").
      3. Click the HTML tab in Firebug to view the HTML (if it isn't already shown).
      4. Ensure that the appropriate <th> (or <td>) start tag is selected (highlighted), rather than, say, a <p> element that is nested inside the cell.
      5. In the right-hand pane of Firebug, click the Style tab.
      6. Right-click anywhere (I think!) inside the body of the Style tab, and select "Edit Element Style...". The following empty template appears:

      7. Specify a width property. For example:

          width: 20em;


        Notice that the HTML view (in the left-hand pane of Firebug) shows a new style attribute on the <th> or <td> element.

      The style attribute is preserved when you save the page.

      I have tested this in Confluence 4.2.

      Does this help?


      I cannot promise that some future version of Confluence will not stomp on these style attributes. Atlassian, can you make this promise?


      I feel dirty suggesting using Firebug to sidestep (what I see as) restrictions in the Confluence user interface (rich text editor). I feel doubly dirty suggesting using style attributes. I do not use style attributes in situations where I can refer to properties in a stylesheet. If, in OnDemand, you can specify a custom CSS (I have no experience with OnDemand), then do that instead of using style attributes; if possible, use CSS selectors such as :first-child to avoid having to add class attributes to elements. My sincere hope is that the only real function of this "use Firebug to add attributes" suggestion is to prompt Atlassian to denounce it, and describe a cleaner, more practical solution.


    2. Try the following in your PDF stylesheet

          table-layout: auto;
      1. Perfect - that was it. Thanks!

      2. But when the conten is overflow, the part on the right side is cut off.

        Is there any solution?

        1. The solution from Atlassian is to also use  table-width: auto too. See

          I think the tables might have changed in 4.x, because apparently they now contain paragraphs, which can affect stylesheet customisations. 

  54. Atlassian,

    I note that Confluence (4) uses iText to generate PDFs (I opened a PDF exported from Confluence 4.2, and then clicked File > Properties... The "PDF Producer" property value was "iText 2.0.8 (by". Odd: SourceForge shows 5.2.1 as the latest version. 2.0.8 is so old that I wonder if that part of the property value is correct.)

    Are you also using the XMLWorker add-on for iText?

    If so, could you please add this information to the body of this page, and include a link to the (appropriate version of) the XMLWorker CSS support?

    If you are not using XMLWorker, or you are customizing the CSS Support provided by XMLWorker, then could you please document that support here a little more comprehensively?

    I'm not expecting a complete dump of the CSS specs: just a comprehensive list of the properties (and property values) supported. Or even (perhaps less work) just a reference to the relevant CSS spec, with a comprehensive list of the properties (and property values) that are not supported.


    1. Anonymous

      Slight correction - I believe Confluence uses Flying saucer engine which in turn uses iText.

  55. Duplicate comment (timeout issues) - please remove.


  56. Atlassian,

    I note that Confluence (4) uses iText to generate PDFs (I opened a PDF exported from Confluence 4.2, and then clicked File > Properties... The "PDF Producer" property value was "iText 2.0.8 (by". Odd: SourceForge shows 5.2.1 as the latest version. 2.0.8 is so old that I wonder if that part of the property value is correct.)

    Are you also using the XMLWorker add-on for iText?

    If so, could you please add this information to the body of this page, and include a link to the (appropriate version of) the XMLWorker CSS support?

    If you are not using XMLWorker, or you are customizing the CSS Support provided by XMLWorker, then could you please document that support here a little more comprehensively?

    I'm not expecting a complete dump of the CSS specs: just a comprehensive list of the properties (and property values) supported. Or even (perhaps less work) just a reference to the relevant CSS spec, with a comprehensive list of the properties (and property values) that are not supported.


    1. Hi Graham,

      You may find that Confluence 4 is still using the same renderer (called flying pdf) as 3.x. It is based on the flying saucer renderer, which uses the itext library. However, outside of the standard features of the default PDF output with the default stylesheet, I have noticed some small changes in the behaviour of the export between v3.x and v4.x, which may mean that the renderer has changed...

      Best regards,


  57. Anonymous

    If I do not use a page break, I have a problem with titles.
    If I use a page break, I have a problem with blank pages. Is there any solution?

  58. I'm having a problem with the page numbers in the table of contents - I wonder if anyone else has seen this. I use the following to prevent page breaks immediately after headings:

    h1, h2, h3, h4, h5, h6, h7, h8, h9
        page-break-after: avoid;

    Any time a heading gets pulled to the next page so it's not right before a page break, the page number shown in the table of contents for that heading is one less than it should be - it's showing the number of the page where the heading would have been if it hadn't been moved.

    1. How do you get page numbers in your TOC in the first place?? I've been trying to find out how, but can't find anything...


      1. Hi Emma,

        The page numbers should appear in the PDF export by default, but this may depend on what version of Confluence you're using. I've just tried with a new local version of 5.6.3 and the TOC appears with page numbers in the PDF export.

        1. We're also running version 5.6.3, but I don't get page numbers...

          1. Hi Emma - are you by any chance just trying to export a single Confluence page (that maybe includes the TOC macro so you're getting a Table of Contents) using the Export to PDF choice on the Tools menu? When you do that, even if the content is long enough to generate multiple pages in the PDF, those pages aren't numbered. The page numbering happens when you use the PDF Export function from Space Operations.

            1. Ah, yes, that's exactly what I'm doing. So is there no way to get the page numbers in the TOC from a single page export?

              1. Based on my experience with an older version of Confluence, I think if it's just one page you're interested in, you can create a macro with a style sheet to add page numbers and add it to the page and export that page.

                1. OK, but, erm, I have no idea how to create macros! Any guidance on how I would do this? Thx!

  59. Anonymous


    I have a problem with the images that I put as the title page and header and footer. They reach a certain size and do not span across the whole page, even when I put in width and height size. I think it is a problem with the margins that prohibits them from stretching. Please help me with this problem?

    Below is what I put in for title in PDF space exports:


    <div class="fsTitlePage" style="text-align:center">
    <img src="/download/attachments/7372983/NetD+bigger+title.png" width="1260" height="1628"/>


    <div style="text-align:center">
    <img src="/download/attachments/7372983/header+big.png">



    1. Anonymous

      In the confluencedefaultpdf.css file, there is a -fs-fit-images-to-width setting that sizes images to fit. You'll want to override this setting in the PDF Stylesheet by adding CSS for the title page images:

      I actually added id parameters to the PDF Layout settings, then referenced the div in the CSS.

      PDF Layout example:

      I used 7.5 inches for the page so my image width is 720 inches (7.5 inches * 96dpi =720px).

  60. Anonymous

    Regardless of the page hierarchy, I want every page to appear with the heading level in the topic.

    Can the heading demotion be overridden or controlled?


    1. One long way around to override it is to use include and build a single page for PDF output

      hX. My heading

      include: My page

      I did this because I wanted to use numberedheadings and the disadvantage was that I had to manually control the heading levels on each page.

      1. Our company wrote a small plugin called "treeinclude" that handles a subtree of pages and "merges" them correctly into one page, the main reason for using this macro is the pdf export (wink)

        If someone could make use of it, we might be able to open source it.


        1. If it works with the numberedheadings macro, then I'd be interested, thanks!

  61. it would be nice if PDF export could pick one of the pages (root?) to be the title page, and treat the rest as pages in the document.

    1. Yes, that's true. That's one reason why we've developed the Scroll PDF Exporter add-on, which does exactly that and also let's you filter the pages by label. Scroll PDF Exporter is available on the Atlassian Marketplace

      1. Well plugged, if it weren't for the annoying nature of license management, i'd get it. What I mean is, we are considering expanding our licenses for our Atlassian products, but we're staying away from plugins because the price of the product becomes rather exponential.

        1. Fair enough. I just wanted to let you know about our plugin. It is up to you to decided whether it saves you enough time and money to justify the purchase.

  62. Anonymous

    So why do we need "!important" for EVERYTHING? This is crap. Include the Stylesheets in reversed order so the own tyles overwright the defaults without using "!important".

  63. Just a quick tip on something I discovered (maybe this is already common knowledge): I do a particular PDF Export of a multi-page document that always ends up at about 6 MB. I found that if I open the file in Acrobat and resave it from there, the new file is only about 1 MB.

    1. Thank you, that's very helpful as we send out PDF manuals by email!

  64. While exporting to PDF, is there any tags that we can apply for pagination control-- such as, 'Keep with next', 'widow/orphan control'.

    After exporting some confluence pages to PDF, I see some instances like:

    • only Heading at the bottom of the page, and the paragraph moves to the next page. So I need 'Keep with next' control.
    • If there are 10 lines in a paragraph then (a) only last line of the paragraph moves to the next page, or (b) only the first line of the paragraph remains on the page and the remaining 9 lines moves to the next page. So here I need 'widow/orphan' control.

    Whats the solution for this issue?

  65. Does anyone know of a way to export all the history versions of a given WIKI page at one time into one large pdf?

    1. There isn't a way AFAIK. Why do you need to do this? What's your underlying need?

  66. Four questions:

    1. How can I change the font size and color of the page name (in the PDF)?
    2. How can I change the font size of lists (bullet lists)?
    3. Is it possible to change to width/style of the horizontal bar? It does not look nice in the PDF?
    4. Is it possible to change the format of the output that is generated by the children macro?

    Many thanks in advance. Made a lot of progress thanks to your ideas and comments!



  67. A little late to answer, but:

    1. I'm not certain what you mean by "page name", unless you're exporting a single page, but any of the text can have its colour changed by employing the PDF Stylesheet in the Space Admin tools.
    2. Likewise, changing 

      would change the font size of bullet lists.

    3. I'm not sure which bar you mean, but probably stylesheet as well.
    4. I don't know what the children macro is, unfortunately, so for that one you're on your own.

    Hope that helps!

  68. Anonymous


    I have a stylesheet created, but would like to know how to add it to just one page in the area space and no the whole are itself?

    Is this even possible?

    Any information would be greatly appreciated.



    1. If you install the Content Formatting macros then you can use the Style macro to do this. There may be other ways but this is the only one that I know of.

  69. Hiding the table of contents doesn't work:

    display: none;

    Any suggestions what's wrong?

    1. I've just tested this in my personal space and it does suppress the TOC. So there doesn't appear to be anything wrong with the CSS itself. Did you add it to the global Stylesheet or the space Stylesheet? It might be worth trying it in the space stylesheet and seeing if that works.

      Good luck.


      1. I don't have access to the global stylesheet, so I added it to the space stylesheet in Space Admin.

        Full CSS:

        The Confluence version is 4.3.3, and the TOC is added using the macro, not wiki markup.

        1. That explains it. The div.toc style controls the style of the full TOC that's added to the PDF export when you export a whole space. This is generated as part of the export and is not added by a macro.

          If you want to exclude all TOC macros from all PDF exports in the space, then you'd need to identify the right CSS element for that - unfortunately I can't help with this as it's not something that I've needed to do. There are a couple of Answers that you might find useful:

          If you only want to exclude some TOC macros from PDF export then you may be better off setting up a "noprint" user macro and associated CSS style.

        2. You can use the Table of Contents Zone macro for local tocs too. If you can add your toc to this macro, you can control printing through the macro.


          1. Thanks! I solved it. The solution was very simple. Just untick Printable in the macro settings. (smile)

  70. Anonymous



    I have spent many hours trying without success to achieve what should be very simple things (and I have read this page and many other ones on Internet to this purpose!), this being :

    • set a PDF page break before any h1 header, except for the h1 header located on the page title
    • avoid PDF page break after any heading h1, h2, etc
    • repeat table title when the table content is split over two or more PDF pages
    • display the confluence page name on the page title and within the header (I don't understand this parameter not being available although this title is displayed on the first page of the PDF export...)


    I did the following so far:

    1. change the PDF export style sheet
    2. set html code for the PDF export


    But the changes I tried to the headings or other standard HTML tags (<h1>, <p>, <thead>, etc) do not take effect, I don't know why, any help would be much appreciated (and I don't succeed neither in getting rid of the bullet style in the TOC list, I did make use of the TOC macro, specifying the "mytoc" class name but I get both the numbering and disc bullets being displayed). What do I have to do in the PDF export stylesheet in order to modify the style for the standard <h1>, <p>, <thead> tags ?


    I use Confluence 4.2.13, and I am a member of a really big French corporation, therefore I am not the administrator of the confluence platform, only the administrator of my Confluence projet space, nor do I have the possibility to get them to make global changes the Confluence spaces.


    PS : surprisingly the changes I made to the h1 heading impact the h1 header on the page title (and only on this page)

    PPS : the changes I made to the TOC are all effective in the PDF export except for the "list-style-type" property that does not seem to work. Actually I have the same bullet issue within the Confluence page itself, although I used the "none" value for the "list-style" option, so the issue may not be with the export but rather with the TOC macro itself)

    PPS it would be much simpler if I could override the toc style (using the .toc class which did not work) without having to create a specific class (.mytoc) for this


    Sorry this is quite a long request, although the objective is fairly simple

    PDF Style Sheet

    /* définir les marges du document complet*/
    @page {
        margin-top: 2cm;
        margin-bottom: 2cm;
        margin-left: 1cm;
        margin-right: 1cm;

    /* police du document généré */
    body {
        font-family: Verdana;

    /* minimum 3 lignes d'un paragraphe avant rupture sur une autre page */
    p {orphans: 3}

    /* répéter la ligne de titre d'un tableau lors de rupture sur plusieurs pages */
    thead {display: table-header-group;}

    /* ajout d'un numéro de page à gauche dans le pied de page */
        content: "Page " counter(page) " de " counter(pages) ;

    .pagetitle h1 {

        page-break-before: none;


    h1 {
        page-break-before: always;

    /* Eviter que le corps d'un chapitre soit séparé du titre, attention dans des versions précédentes cela créait un pb sur la numérotation des chapitres dans la table des matières, à vérifier */
    h2, h3, h4, h5, h6, h7, h8, h9 {
        page-break-after: avoid;

    .mytoc {
        page-break-after: always;
        counter-reset: chapter 0;

    .mytoc a:link {
        font-family: Verdana;
        text-decoration: none;
        list-style-type: none;
        color: black;  

    PDF Export HTML code

    <img src="download/attachments/106301970/Medium_Logo.png"/>  





    PDF Header HTML Code

          <td><img src="download/attachments/106301970/Small_Logo.png"></td>
          <td style="text-align:right; vertical-align:middle;">TITRE</td>

    PDF Footer HTML Code

    <div style="text-align:rightvertical-align:middle">C1. Diffusion interne</div>

    1. Your CSS/XML looks fine to me.  You might be running into the "push down" in the H level behavior.  If you use the built-in PDF generation engine, the heading level of the page title is determined by its level among the pages you choose to export to PDF.  If you choose to export the entire space, the title of the landing page is H1.  The pages immediately under that are H2; the pages under them are H3, and so on.

      In addition, all headings in a page are pushed down to be below the heading level of the title.  So, if the title of the page is an H3, if you have an H1 in that page, it is pushed down to be an H4 in the export. 

      This makes it look like your CSS is being ignored.   

      If export to PDF is important to you, I think that the best work around this "push down" behavior is to break up the space so that the page title is the only heading level needed.  Then make sure that you arrange the pages in whatever hierarchy is appropriate to the content. So, your "chapters" have their head pages immediately below the landing page.  The n.1, n.2, n.3, etc headings are all sub-pages of the "chapter" pages.  ... and so on.  If you want something to be an a h3, is should be the sub-page of an h2 page, which should be a sub-page of an H1 page, which should be the top level of the set of pages that you export to PDF. 

      Also, if you set it up so that no you do not need to export the landing page.  This saves you a heading level.  If you do not export the heading page, then the export tool uses H1 for the next level of pages.

      Finally, I should mention that, even if your "page-break-before: always;" is honored, it messes up your TOC and your links.  For some reason, the link in the TOC (or anywhere else) will fall short of the target by one page.  To work around that, you might want to define .pageBreakBefore { page-break-after: always; } and add that in a class= string in the last content of the before the page where you want the break.  So, something like <p class="pageBreakAfter"> </p>.  This is a nightmare to maintain, but at least the TOC links and xrefs work. 

  71. I asked can I change the name of the file of the export?

    By default it names it <space>-title-<ddmmyy>-<hhmm>-<no>

    Is it possible to adjust this? For instance: <title> only?

  72. Anonymous

    Hi, I'm on Confluence OnDemand... about PDF export:

    There's one simple thing and one more difficult that I want to do.

    1. I want to have a title on the generated toc. Where do I modify the pdf stylesheet (div.toc?) and how? I also need "Table of Contents" title in a specific color.
    2. I want to have the toc as a side navigation column in the pdf. I haven't found this topic anywhere. The generic pdf stylesheet doesn't have this code.
    3. Wish list: to get rid of the numbers in the toc. I tried a could of things but they don't seem to work.
  73. I've used the basic page numbering CSS described above, but have an odd problem: it works fine on the first two pages, but starting on the third page I get the page number twice: once in the left corner of the page, and again in the center. I've not made any other modifications to the CSS that should affect this, any hints on what I should look for?

  74. Hi, I have a need to put a watermark on the pdf space exports. I know how to do it as a background image, but that doesn't really work because of the many elements that have background colors (and you can't get rid of all of them, some need it). So, the only way to do a good watermark is overlaying an image, however I have no access to the HTML to put in the necessary divs. Any ideas or experiences of successfully overlaying a watermark on a space export PDF?

    1. Hi Julia, I've used Acrobat to put watermarks on PDF exports after I generate them. Usually I've done text, like adding the word DRAFT, but Acrobat also lets you select an image file to use for the watermark. Acrobat also lets you set the opacity for your watermark, and if you use a low number then your watermark looks like it's in the background, even though it's overlaid on your pages.

  75. How do you include a page that must always be right after the toc for all space/custom space exports? We need to ensure that our copyright statement is always included as the page right after the TOC and I don't want to rely on a user to select it (and that assumes it is always at the top of the tree). I need for it to be there.

    1. in case you are talking about space exports in PDF format, this can be done in the PDF Layout configuration, see space admin -> look and feel -> PDF Layout , or in system admin -> look and feel -> PDF Layout.

      Make the TOC part of the PDF Space Export Title Page, then add your copyright statement. You can also add it to each page at top or bottom

      1. Yes, this is the space export.  We have a TOC added; however, we need to reference our copyright statement which needs to be on a new page after the TOC and it is approximately 3/4th of a page long - this is the page that talks about disclaimers, we don't warrant to the documentation, etc.  I would prefer to reference another wiki page that has the full content to ensure that it is always current since it could change. Is there a way to include another page after the TOC?

  76. Is there a way to control whether a single page is exported as portrait or landscape? Or at least a single document (a single part of the tree)?

    This is an important feature for us. I don't want all pages in all PDFs to be landscape pages.

    Is there any plugin that has that capability?

    1. In standalone Confluence installations, I think you can do it yourself if you have access to the stylesheet. I think you just need to use the div macro to separate the landscape text in the Confluence page and add CSS to format it in landscape. And then I think you may need to fiddle around with the margins a little.

  77. Hi, could someone please tell me if I wanted to add a Heading 2 that says 'Table Of Contents' before the actual table of contents, where would I type it the global PDF stylesheet and what would I type? Sorry new to html and css.

    Is this the correct section to add it?


    Also, my page numbering is very left aligned. If I wanted to make it right aligned and to say "Page X of Y" where Y = total pages, how would I do that?

    Is this the correct section to add it?

    content: counter(page);



    1. Hi Debbie, you can do this in the PDF layout, rather than the stylesheet.  Just add:

      Where 'Contents" is the title you want above the table of contents. 

      Here's what we have in the PDF Layout and the stylesheet for the PDFs we produce of the Confluence docs - CAC_PDF_stylesheet.txt

      1. Hi Rachel,

        Thank you, my PDF exports are looking better.

        A couple of questions please:

        1. Currently the page number is on the top right of the page. If I want it to be on the bottom right of the page and say Page x of y where y = total pages, how would I do that?
        2. If I want to centre the 'Table Of Contents' how would I do that?
        3. Some images, not all are enlarged in the PDF and missing their right hand side in places. It appears to have nothing to do with the pixel size of the images on the screen and is random. Any idea why?

        Thank you very much. Appreciate your help (smile)

        1. Hi Debbie, I'm afraid i'm no CSS expert and am not sure how to achieve the changes you're after.  You could try asking at Answers, the Confluence community is usually pretty helpful. 

          As for the images, what version of Confluence are you using?  there was a problem with this around Confluence 5.4.3 I think. There are a few other issues to do with images in PDFs tracked here.  For the ones that are not enlarged, I'm pretty sure they should appear in the PDF the same size you've set in the editor (e.g. if you have a 900px wide image that you've sized to be 300px wide, it should be 300px wide in the PDF).  Feel free to raise a bug for the team to look at if this isn't what you're seeing happening. 

  78. Thanks Rachel. I've posted my questions as you suggested here:

    We are using Confluence 5.5.3. I will see if others have any suggestions about the image sizes and will raise a bug if I need to. Thanks again.

  79. Hi, people.

    I'm trying to put one image in just all the first page. Can you help me?

    1. Hi Patricia,

      Not sure if I totally understand what you're trying to do, but I'd suggest this section of the page.

      Otherwise, you could try asking over at answers.

  80. I've found that for the page break macro, I needed to make a modification to make it work correctly. Posting my answer here for others.

    If I didn't include the &nbsp;my page layouts were crazy messed up.

  81. Hi,

    How can we get the PDF export to include the title numbering on the PDF export? I want it to add a number to each of the big bold title labels on each page.


    Thanks, Dan.

    1. Hi Daniel,

      Unfortunately, I'm not aware of a way to do it. You could try asking over at answers to see if someone's done it before.

  82. Hi,

    This issue is still open.

    CONF-24004 - PDF export: TOC page numbers overflow the right margin when more than 999 pages New  

    Your workaround

    div.toc { text-align:right; }

    does not work on Confluence 5.6.6.

    Any idea?

    Thanks, Josef



  83. One of my users recently came up with the question why the PDF export (multiple pages , from Space Export) does not create the PDF index on the left side of the PDF document, as it is common in PDF documents.

    Actually, when exporting Confluence pages, there is one entry per page in the PDF TOC. The user expected to see all the headers in the PDF TOC.

    How do other people feel about such a functionality, and (to Atlassian) why doesn't it already exist?


    My personal opinion is that Confluence's PDF Export should be able to create the PDF TOC for headers (and not only for pages), but there should be check-boxes where the user can control /  choose which level of headers should be included in the TOC. (Including all header levels in the TOC may be too much in certain circumstances)