This page is part of the guide to developing technical documentation on Confluence Wiki. Confluence itself is an excellent platform for publishing online documentation. In some cases, though, you may need to produce PDF versions of your documentation for printing, or to supply to customers who cannot access the online version. Confluence itself provides an export to PDF. Plugins provide additional functionality.
The rest of this page gives more details of the above procedures. |
On this page:
|
Customising the PDF Layout and Stylesheet
If you are planning to provide PDF versions of your documentation, you may want to customise the PDF layout and styles for your space. These customisations will apply each time you export your documentation to PDF.
In the PDF layout, you can add your own HTML to customise the title page, page headers and page footers in the PDF output. In the PDF stylesheet, you can adjust the appearance of the PDF pages.
Editing the PDF Layout
Setting a global PDF layout
- Open the Confluence Admin screen.
- Select Look and Feel > PDF Layout. The following screens allows you to 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
-
Choose Browse > Space Admin.
Space Admin is displayed only if you are a space administrator for that space or you are a Confluence system administrator.
- Click PDF Layout in the 'Look and Feel' section of the left-hand panel.
- Click Edit, and customise the HTML that generates the following areas in the exported PDF document:
- 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. Save your work.
Editing the PDF Stylesheet
Setting a global PDF Stylesheet
- Open the Confluence Admin screen.
- Click 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-level PDF stylesheet
-
Choose Browse > Space Admin.
Space Admin is displayed only if you are a space administrator for that space or you are a Confluence system administrator.
- Click PDF Stylesheet in the left-hand panel. The 'PDF Export Stylesheet' section appears, showing the current contents of your PDF stylesheet. It contains all CSS rule customisations applied to the pages in the space.
- Click Edit and enter your customisations into the text box as required. The PDF stylesheet section accepts Cascading Style Sheets (CSS) rules. Save your work.
Some Useful Examples
Below are the typical customisations you may want to make for your technical documentation. For more examples, see Customising Exports to PDF.
Adding a Title Page
You can create a title or cover page to your PDF document using HTML. Use the PDF Space Export Title Page section of the PDF layout to do this.Adding a New Title Page
The following example uses HTML with an inline CSS rule to generate a title page.
Including Content Above Table of Contents in Default Title Page
The following example includes content above the automatically-generated table of contents that appears on the default title page, so that your title page includes your own content plus the table of contents.
Adding an Image to your Title Page
In the examples above, the title page includes an image called 'titlepage.png', centred in the middle of the page. The image is attached to a Confluence page and is referenced via its relative URL (that is, we use only the last part of the URL, excluding the Confluence site's base URL).
Follow these instructions to include an image on your title page:
- Attach the image to a Confluence page.
- View the list of attachments on that page.
- Right-click the image and copy its location.
- Paste the link into the appropriate
src=""
attribute within your PDF stylesheet, as shown above. - Remove the first part of the URL before
/download/...
.
Adding Headers and Footers
You can add headers and footers to your PDF pages using HTML. Use the 'PDF Space Export Header' and 'PDF Space Export Footer' sections of the PDF layout to do this. For simple headers and footers, plain text is enough. The following example adds a simple copyright notice.Adding Page Numbering to a Header or Footer
To add page numbering, you need to combine customised HTML in the PDF Layout with customised CSS in the PDF Stylesheet.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 SectionPDF 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 thespan
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 thespan
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.
Exporting a Single Page to PDF
You can export a Confluence page to PDF. This option exports a single page and is available to all users who have permission to view the page:
- Go to a page in the space and choose Tools > Export to PDF. Follow the prompts to export the page.
Exporting a Space or a Selection of Pages to PDF
Using the built-in Confluence PDF export, you can export a single page, a selection of pages or an entire space into a single PDF file.
-
Go to a page in the space and choose Browse > Advanced.
- Click PDF Export in the left-hand panel.
This option will only be visible if you have the 'Export Space' permission. - Select the pages you want to export.
- You have the option to Select All or Deselect All pages.
- When you select a page, all its child pages will also be selected. Similarly, when you deselect a page all its child pages will also be deselected.
- Click Export.
- When the export process has finished, download and save the PDF file as prompted.
Exporting a Spaces or Pages to PDF via a Plugin
For advanced PDF export, consider installing the Scroll Wiki Exporter plugin onto your Confluence site. Scroll provides flexible themes for configuring PDF layout and styles. You can select one of Scroll's built-in themes and configure your table of contents, header and title pages.
Advanced techniques for Scroll Wiki Exporter. For even more flexibility, you can add your own theme plugins. Scroll supports themes based on DocBook XSL stylesheets. See the Scroll developer's guide.
Notes
- Permissions required to export a space. To use the space export functionality, you need 'Export Space' permission. See the guide to space permissions or contact a space administrator for more information.
- Installing plugins. If you decide to use additional plugins, your site administrator will need to install the plugins into your Confluence site. Refer to the documentation on installing plugins.
- Plugin support. Before installing a plugin into your Confluence site, please check the plugin's information page to see whether it is supported by Atlassian, by another vendor, or not at all. See our guidelines on plugin support.
Next Steps
Now you know all about providing PDF versions of your documentation. What next? See other ways of Exporting and Printing Technical Documentation.