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

CSS Version of Adding Images to Headers and Footers

Lawrence Ho June 24, 2012

On the page:

https://confluence.atlassian.com/display/DOC/Advanced+PDF+Export+Customisations#AdvancedPDFExportCustomisations-headerfooter

It illustrates how to add an image to header or footer in HTML:

<div style="margin-top:10mm">
<img src="/download/attachments/12346/header-image.png"/>
</div>
However what is the CSS StyleSheet version of the above? I tried to incorporate the HTML in the layout and it doesn't seem to work for me. However, changes in the stylesheet seems to work...but I haven't figured out how to get the image into a header.

3 answers

3 votes
Alejandro Conde Carrillo
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.
December 4, 2012

CSS does not do content, but there is a way to insert a background image. If you give the rigth format to the image, you can get good results. An example using as a base the one provided in the manual coudl be:

@page
{
    @top-center
    {
        background-image:url('/download/attachments/12345/image.jpeg');
        background-repeat:no-repeat;
        background-position:right top;
        content: "Document Title Goes Here";
        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;
    }
}

This example takes an image which has been attached to Confluence. You will need to replace the URL for the one for your attachment.

1 vote
Deleted user October 9, 2012

I have the same problem 'Lawrence Ho' has.

Add an Image via 'PDF stylesheet' as background-image works fine but adding an image via 'PDF Layout' and HTML

<div style="margin-top:10mm">
<img src="/download/attachments/12346/header-image.png"/>
</div>
does not work.
This is a pitty because there are much more things that you do with HTML than with CSS
You will find the reason in the confluence manual: The custom styles defined in the PDF export stylesheet will be applied to all pdf exports, but the customizations of the PDF layout only take effect when exporting in the Browse Space section. They won't be applied when you export a single page over Tools => Export to PDF.
Lawrence Ho October 24, 2012

Not sure how to add an image such that it appears as the header for every page....

1 vote
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.
June 25, 2012

I'd be somewhat surprised if a CSS background image would show up on a PDF export. Use an image :)

Frode Evensen September 6, 2018

I can confirm that CSS background does in fact show up on PDF export on Confluence 6.8.0 :-)

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.
September 6, 2018

🙌

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events