PDF layout in one page
Asked by DanielG:

Hi,

I know that it's imposible in Confluence to customize the PDF layout when export one page to PDF from the view of page (Tools -\> Export PDF), but I want to ask:  

It is posible to edit the PDF global layout (even if it means changing aply to all spaces of my system) to put an image of my company logo? I wonder if there is any way possible to do this, even if it means making internal or global changes ...

<br />

Thanks in advance!


Answers:
author: Alejandro Conde Carrillo
body: You can include an image in single page exports using custom PDF stylesheets. This example would insert the image (attached to your Confluence instance) in the top right corner of yoru page:

```
@page{    @top-center    {        background-image:url('/download/attachments/12345/image.jpeg');        background-repeat:no-repeat;        background-position:right top;     }}
```

comments: author: DanielG
body: Thanks Alex!

I don't know that in stylesheet I can import a image... :( i'm newbie in CSS!


author: Bruce Schlueter
body: @Alex:

Sorry, but this does not work for me. I am not able to place an image to a single page PDF export. Neither if I add the lines to the space PDF Stylesheet nor to the Global PDF Stylesheet. Where am I going wrong? The URL is correct because I can show the image in the browser.


author: Alejandro Conde Carrillo
body: Hi Bruce.

I have tested the CSS and I can confirm they work.

Are you using the PDF conferter bundled with Confluence? Note that the image should only be visible in your page exports and not whe you see the page in your browser.


author: Bruce Schlueter
body: @Alex:

I just tried in our test system and if I only add the image it will be displayed. So I will go through my CSS to see if I find any problematic entries. Thanks again for testing.


author: Bruce Schlueter
body: @Alex:

Thanks for testing, yes we use the PDF Eport functionality within Confluence (4.3.2) and I am aware that the logo only shows up in the PDF. For the pages we use the space logo. But perhaps I have problem inside my CSS. I will delete all other entries and just try the one and see where it will get me. I will keep you updated.


author: Bruce Schlueter
body: @Alex:

Some more news on this. I originally intended to have something like this

```
@page {    size: 210mm 297mm;       margin-top: 2.0cm;    margin-bottom:1.4cm;     margin-left: 1cm;    margin-right: 1cm;    padding: 1em;        @top-left    {        background-image:url('/download/attachments/5342557/image.jpg');        background-repeat:no-repeat;        background-position:center;      }        @top-center    {        content: "JUST PUT SOME TEXT HERE";                font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;                  font-size: 6pt;         }    @bottom-left      {       margin-left:0.5cm;       content: "JUST PUT SOME TEXT HERE";         font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;                font-size: 6pt;          vertical-align:top;    }    @bottom-right    {        content: counter(page) " / " counter(pages);          font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;                font-size: 6pt;          vertical-align:top;        text-align:right;    }}
```

This does not work as the text seems to hide the image. I found a workaround for now by adding the image part into the "center section" infront of the text. So now I have both text and image. This leads to my next question, is there any way to have a watermark behind the text? Or must I use something like Scroll PDF to achieve this?


Tags: export

global

layout

pdf