Missed Team ’24? Catch up on announcements here.

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

CSS for PDF Export

Michael Roff
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2012

I would like to customise the PDF Export of a single page in Confluence so it has the following:

A title page containing:

Page Title: "Test Page"

Space Name: "Test Space"

Last Edited by: "John Smith"

Last Edited on: "12th Nov 2011"

Headers that have:

Confidentiality Statement: "This page is the property of Test Company"

Footers that have:

Page Number details: Page 1 of 6

I do not know the correct CSS to get the space name, editor or edit date details.

I am also unsure if there is a way to get the total page number information and how to embed this in the footer.

At the moment, I have a basic version of the above which provides title page with page name and header and footer.

.pagetitle h1 { 
font-size: 36px !important;
margin-left: 250px !important;
padding-top: 300px !important;
page-break-after:always; 
}

@page
/* Any page-specific properties */
{
    @top-center
    {
        content: "Property of Company X Inc.";
        font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
        font-size: 8pt;
    }
    @bottom-center
    {
        content: "Page " counter(page);
        font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
        font-size: 8pt;
    }
    /* Any other page-specific rules */
}

Any help expanding on this with details of the CSS would be great.

I have been reviewing many of the online resources for this and can't find this information.

6 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted
Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 18, 2012

Hi Mick,

to include the total page number information just add a little somethig to your code:

content: "Page " counter(page) " of " counter(pages);

Steffen

Michael Roff
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 22, 2012

Thanks Steffen, that's very helpful!

2 votes
David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 23, 2012

You can't get hold of that information using CSS alone as it is merely a method of formatting the existing page content. You'll need to edit the underlying layouts.

Browse to Confluence Admin | Look and Feel | Layouts

Under Export Layouts click on "Create custom" next to Page Export Layout

You'll see that you can access:

  • Space Name as $page.space.name
  • Page title as $page.title
  • Last modified on as $dateFormatter.format($page.lastModificationDate)
  • Last modified by as $!page.lastModifierName

This should give you a start for editing the layout.

Use "Confluence Objects Accessible From Velocity" from the documentation as a reference

Michael Roff
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2012

Thanks David. I'll take a look - that sounds like what I have been looking for.

Michael Roff
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2012

David, I have been playing with this for a little bit and I am not that much further along, however, I would like your opinion on something. It seems that when exporting a single page to PDF through the Tools - Export to PDF option, it is only the PDF Stylesheet which is utilised - the PDF Layout is not.

The PDF Layout only seems to be used when the space export to PDF option is used.

Is that your understanding?

Andrew Snyder December 20, 2016

@Michael Roff - Correct, PDF layouts only affect space exports, not page exports.  This page from Atlassian cofirms that - https://confluence.atlassian.com/doc/customize-exports-to-pdf-190480945.html.  I also am looking for a way to add the "date printed" to the bottom of all PDF page exports from our Confluence instance, and I have not yet found a way sad

1 vote
Deleted user January 25, 2012

Hi, maybe you want to have a look at our product, the Scroll Wiki PDF Exporter. That makes it is very easy to create custom styled PDF templates for export. Let me know if you need further informatin or any help.

http://www.k15t.com

Cheers, Joe

Michael Roff
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 25, 2012

Thanks Joe.

I have already been looking at your plugin. It's pretty much what I want. Now I just need to get a purchase order approved :/

While I have your attention, can you tell me who I should speak to within K15t about your Scroll Forms plugin? I would like to know its capabilities regarding backwards compatibility with scaffolding forms / reporting.

Thanks, Mick

0 votes
GG December 13, 2017

Hi Mick,

With Content Exporter for Confluence addon you can create export profiles where you can setup headers and footers:

https://metainf.atlassian.net/wiki/spaces/CEX/pages/71338426/Export+Profiles

0 votes
Deleted user January 25, 2012

Hi Mick,

please contact support[at]k15t.com about your question concerning Scroll Forms.

We keep our fingers crossed that you get the order approved.

Cheers, Joe

0 votes
David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 22, 2012

You could likely edit the PDF layout to inject these. See the documentation: http://confluence.atlassian.com/display/DOC/Customising+Exports+to+PDF

Michael Roff
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2012

Thanks David.

I have reviewed various online resources which cover CSS and PDF Export from Confluence (including the link supplied) but I am unable to find anywhere that deals with the specific items I would like to implement. Namely, detailed page numbers, contributors and versions / dates.

I am not a CSS expert, so I might be missing something that is obvious for others and if that is the case, would appreciate some direction from those more familiar.

Mick

Andrew Snyder December 20, 2016

@David Simpson - The PDF layout customization described here - https://confluence.atlassian.com/doc/customize-exports-to-pdf-190480945.html - does not apply to page exports, only space exports:

  • PDF customizations are unique to each space.
  • PDF customization only applies to space exports (not single page exports via Tools > Export to PDF)

I have not yet found a solution that allows you to add things like the date to the header or footer for all page exports sad

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events