Confluence administrators and space administrators can customise the PDF exports for individual spaces. Please take note of the following points:
|
Customising the PDF Layout
You can add your own HTML to customise the title page, page headers and page footers in the PDF output.
To customise 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.
Customising the PDF Stylesheet
You can adjust the appearance of the PDF pages by making CSS customisations in the PDF Stylesheet screen as required.
- To get started, you can download the default CSS rules of 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 PDF customisations are defined in the PDF Stylesheet screen, the default CSS rules will be applied to your PDF exports. By default, the export does not include a title page, headers or footers.
To customise 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.
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 locale 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:
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:
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:
To set the margins independently, edit the @page rule as follows:
To set margins to provide a gutter for binding a printed document, use the :left and :right pseudo-classes, as follows:
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:
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:
Use CSS rules in the PDF Stylesheet to control the appearance of the title page and the title text:
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:
- Attach the image to a Confluence page.
- View the list of attachments on that page, then right-click the image and copy its location.
- Paste the link into the appropriate
src=""attribute in your PDF Stylesheet, as shown above. - 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 rule to the PDF Stylesheet and set its display property to none:
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:
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.
Page Numbering
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
#pageNumrule selects the HTML element with the specified ID of "pageNum", which is thespanelement we created for the header or footer. - The
:beforepart of the selector is a pseudo class that allows the insertion of content before thespanelement is processed. - The
counter(page)is a function that returns the current page number as its content. - The
contentproperty 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:
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.
Notes
- 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.







122 Comments
Hide/Show CommentsJun 03, 2009
Tim Lindsay
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.
tks
..oops... should hav checked the doco first, can prolly do something like this in the stylesheet...
div.pagebreak
{
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!!!!
May 10, 2011
Pankaj Jangid
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?
May 10, 2011
Hanna Nelson
Do they get translated as h1-level heads? I did this:
May 12, 2011
Pankaj Jangid
No this does not work. I have raised and improvement request for this. http://jira.atlassian.com/browse/CONF-22489
Jun 04, 2009
Matthias Alder
If you want to have a footer on a page-export (not just on a space-export) you could do something like that:
Jul 29, 2009
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?
Jul 29, 2009
Ryan Ackley
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("http://some.image.url.here")where you replace the url with your image url.
Oct 23, 2009
Anonymous
This solution isn't working for me. It should... But it isn't.
Dec 21, 2010
Gerald Yong
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.
Gerald
Sep 01, 2009
Wim Deblauwe
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?)
regards,
Wim
Sep 01, 2009
Wim Deblauwe
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.
Sep 03, 2009
Anonymous
Same question as above. Anyone who has manage to use the url workaround:content: url("http://some.image.url.here");
Atlassian: I´m very disappointed that you only have released an half finished solution of the pdf export function.
Dec 21, 2010
Gerald Yong
Refer to CSS3 Module Paged Media, Table 1.
Available margin box definitions:
Centering - use the following:
Each type of margin box has certain default centering; refer to Table 2 on the page.
Jun 10, 2009
Anders Raneland
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).
Regards
Anders
Dec 09, 2009
Giles Gaskell [Atlassian Technical Writer]
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
ggaskell@atlassian.com
ATLASSIAN - http://www.atlassian.com
Sep 18, 2009
Corey Hampton
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:
Jan 29, 2010
Andreas Camenzind
This would be great, because I do have the same issues here as well. Could that then work for a Space as well?
Jun 10, 2009
Ryan Bovorasmy
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:
Taken together, this is the workflow behind changing PDF output, for a typical user and admin:
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
.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..
Jun 10, 2009
Ryan Bovorasmy
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.
Jun 19, 2009
Corey Hampton
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?
Aug 12, 2009
Azwandi Mohd Aris [Atlassian]
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.
Cheers,
Azwandi
Aug 12, 2009
Corey Hampton
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.
Jul 03, 2009
Anonymous
Hello,
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?
Regards
Mathias
Jul 05, 2009
Hugo Lassiège
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 (http://confluence.atlassian.com/download/attachments/190480945/confluencedefaultpdf.css?version=1&modificationDate=1243580667083) and I found that :
By the way, I didn't find any reference to page attribute in w3c reference (http://www.w3schools.com/CSS/CSS_reference.asp). I guessed it's an atlassian addon ?
However it didn't work for me if it should display the page title.
Jul 15, 2009
Hugo Lassiège
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... ?)
Jul 15, 2009
Corey Hampton
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?
Thanks!
Jul 16, 2009
Hugo Lassiège
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) :
Nov 18, 2009
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
Introduction
Because of this problem I am getting the following auto numeration:
1 User Manual
0.0.0.1 Chapter 1 Introduction
But actually the exported page has the same structure:
Mar 26, 2010
Niall Teskey
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.
Apr 05, 2011
Vladimir Alexiev
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:
Apr 05, 2011
Vladimir Alexiev
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)
Sep 16, 2011
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!
thanks,
MIke C in AZ
Jul 30, 2009
Ryan Ackley
Here is a link to the appropriate standard
http://www.w3.org/TR/css3-page/
Jul 22, 2009
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...
Aug 03, 2009
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.
Aug 04, 2009
Azwandi Mohd Aris [Atlassian]
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,
Azwan
Aug 04, 2009
Hugo Lassiège
@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
Aug 06, 2009
Anonymous
Hi,
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,
Aurélien
Aug 11, 2009
Sashidaran Jayaraman [Atlassian]
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
Cheers
JSashi
Sep 15, 2009
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?
Thanks
Apr 04, 2011
Vladimir Alexiev
Try this (I haven't)
Sep 17, 2009
Oliver Junker
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
. 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 :-(
Nov 03, 2011
Giles Gaskell [Atlassian Technical Writer]
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.
Regards,
Giles Gaskell
Technical Writer
ggaskell@atlassian.com
ATLASSIAN - http://www.atlassian.com
Oct 21, 2009
Dermot O'Halloran
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
Oct 26, 2011
Anonymous
Dermot.
Have you figured the story with column widths anyhow ?
Cheers
Pavel
Oct 26, 2009
Kees Leune
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?
Nov 26, 2009
Ryan Ackley
Kees, this sounds like a bug. Can you file an issue in http://jira.atlassian.com that details how to reproduce the problem.
Oct 08, 2010
Brian Carr
We are seeing the exact same thing. Was this ever addressed? It would be very nice to get this working the right way.
Nov 01, 2009
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.
Dec 03, 2009
Thomas Ho
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-row>
<fo:table-cell color="grey">
<fo:block>$pageTitle</fo:block>
</fo:table-cell>
</fo:table-row>
I find the following in the sample css file:
pagetitle
{
page-break-before: always;
}
pagename
{
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>.
</fo:block>
and it would print:
This page last changed on December 2, 2009 by Joe
Thanks,
Thomas.
Feb 09, 2010
John Amabilino
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].
Thanks
Feb 12, 2010
Azwandi Mohd Aris [Atlassian]
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.
Feb 10, 2010
Andreas Camenzind
How can I get the comments printed in the PDF as well?
Feb 11, 2010
Sashidaran Jayaraman [Atlassian]
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
Cheers
JSashi
Feb 18, 2010
Matthias Born
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.
thx!
matze
Mar 08, 2010
Anonymous
Where can one find documentation on the functions used in these examples? For instance:
"content: counter(pages);"
"content: url(http...);"
"content: element(footer);"
etc...
I want to add the page name to each page footer and I am trying to figure out if there is a function available.
May 03, 2010
Almar
How can I remove the Page Title using the PDF Stylesheet?
I tried this .atb-title {display:none;} but that doesn't work.
May 04, 2010
Husein Alatas [Atlassian]
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
Cheers,
Husein
May 06, 2010
Almar
Thanks Husein, it works fine.
Jan 12, 2012
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!
Jun 09, 2010
Lauren Womack
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?
Jun 23, 2010
Niall Teskey
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
Dec 10, 2010
Lauren Womack
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>
<DIV ALIGN=CENTER>
Copyright © 2010 Tektronix Communications. All rights reserved.
</DIV>
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?
Dec 21, 2010
Gerald Yong
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.
Apr 29, 2011
Hanna Nelson
I used HTML tables and it worked beautifully.
Jul 23, 2010
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
Title2
Bah blah blah
Bah blah blah
Aug 04, 2010
HengHwa Loi [Atlassian]
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.
Regards,
HengHwa
Aug 04, 2010
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.
@top-left
{
content:url(/download/attachments/123456/test_header.png);
}
or
@top-left
{
background-image:url(/download/attachments/123456/test_header.png);
}
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.
Dec 21, 2010
Gerald Yong
Try
Make sure your image is not too big though.
Jun 16, 2011
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.
Jun 16, 2011
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.
Sep 02, 2010
Jos Donners
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
Sep 14, 2010
Lauren Womack
This is BRILLIANT! I just implemented it. Thank you.
Mar 30, 2011
Anonymous
thanks! Exactly what I was looking for!
Sep 07, 2010
Philip Jones
About a year ago somebody asked for the ability to add the following to PDF exports:
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?
Sep 29, 2010
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?
Thanks!
Sep 30, 2010
Jos Donners
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.
With
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.
Regards
jos
Oct 08, 2010
Brian Carr
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?
Oct 10, 2010
Klaus Feldmann
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.
Cheers.
Dec 10, 2010
Lauren Womack
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.
Dec 11, 2010
Klaus Feldmann
Confluence is the most flexible WiKi available right now.
Did you read the documentation of Confluence?
Dec 11, 2010
Lauren Womack
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.
Thanks.
Jun 06, 2011
Klaus Feldmann
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.
Cheers.
Feb 08, 2011
Corey Hampton
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.
Thank you!
Nov 03, 2011
Klaus Feldmann
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/atlassian-bundled-plugins.zip
After unpacking atlassian-bundled-plugins.zip 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.
Feb 09, 2011
Corey Hampton
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.
Feb 09, 2011
Klaus Feldmann
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.
Jan 07, 2011
Anonymous
Hi,
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?
Thanks!
Mar 24, 2011
David Dawson
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?
Thanks!
Jan 30, 2011
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.
Jan 30, 2011
Klaus Feldmann
search for break on this page and you will find it!
Jan 30, 2011
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.
Jan 31, 2011
Anonymous
OH no - now my headers and footers have disappeared!! Any ideas?
Jan 31, 2011
Klaus Feldmann
did this thread pagebreak and following comments on this page not help? Including html is not the best way!
Mar 03, 2011
Don Willis
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 http://jira.atlassian.com/browse/CONF-21920
Mar 03, 2011
Derwing Medina
¿How can I show the page name or the page url in the footer for a PDF export?
Apr 05, 2011
Vladimir Alexiev
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:
Apr 26, 2011
Steve Goldberg
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: http://www.w3schools.com/css/tryit.asp?filename=trycss_content_url
Except it doesn't actually work. It works with text but not images. Anybody know why?
Thanks.
Apr 29, 2011
Hanna Nelson
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?
Thanks!
May 03, 2011
Hanna Nelson
OK, found that this is not supported (yet). If you use thumbnails and care about image quality in PDF, vote for this issue: http://jira.atlassian.com/browse/CONF-19706
May 11, 2011
Hanna Nelson
The workaround is to use the {show-if} macro for each thumbnail image:
May 06, 2011
Hanna Nelson
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).
Ideas?
May 11, 2011
Hanna Nelson
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.
Jul 04, 2011
Anonymous
Could you explain how you supressed the numbers in the TOC? Im also trying to remove them...
Thanks!
Jul 05, 2011
Hanna Nelson
I think this is what I did. In the PDF Stylesheet (supplied by Atlassian):
Jul 06, 2011
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 ?
May 20, 2011
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?
May 20, 2011
Klaus Feldmann
check your admin rights! and if you have rights to admin a space and its still not there than check your theme layout.
May 20, 2011
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?
May 20, 2011
Klaus Feldmann
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.
May 20, 2011
Anonymous
Right. I'll ask the admin about that. Thank you!
Jun 21, 2011
Steve Goldberg
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.
Jul 01, 2011
Anonymous
I use this stylesheet for pdf exporting, it does its job really nice.
Jul 11, 2011
George Abitbol
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; @top-left { content: element(header); } @bottom-left { 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.
Thanks
Jul 19, 2011
Steve Goldberg
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:
Thanks
Oct 12, 2011
Daniel Schmidt
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?
Nov 28, 2011
Nirdesha
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?
Nov 28, 2011
Paul Watson [Atlassian Technical Writer]
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
Nov 28, 2011
Anonymous
Hi Paul,
It works well. Thanks for the quick feedback.
Nov 29, 2011
Paul Watson [Atlassian Technical Writer]
Great!
Nov 30, 2011
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.
@page
{
@top-center
{
content: someUnknownFunction(h1);
}
}
Thanx
Chris
Jan 24, 2012
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
Thanks
Mark
Add Comment