Add total number of pages in the bottom-of-page of a PDF export ?
Asked by Benjamin_Chevillon:

I want to add "page 3 of 143" at the bottom of the page.

It's ok for "page 3" with <http://confluence.atlassian.com/display/CONF35/Editing+the+PDF+Stylesheet#EditingthePDFStylesheet-ExamplesofBasicCustomisations>

but I cannot find the total number.


Answers:
author: Steffen Heller
body: The total number of pages is retrieved with "counter(pages)". Thus "page 3 of 143" translates as

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

comments: author: Benjamin_Chevillon
body: Works on [Atlassian Confluence](http://www.atlassian.com/software/confluence) 3.3.3. Thanks a lot !


author: DanielG
body: Thanks! Works for me :)


author: Christian Sprenger
body: Nice :D  
V4.3.1

Thx a lot!


author: miki
body: Thanks a lot!!!!

Confluence 1000.0.0


author: ronald_araujo
body: It does not work.


author: NielsJ
body: The page number is inserted with CSS counters. As far as I know there is no possibility to count all pages in CSS. So there is no chance for you to the the total page number in dhe PDF...


author: Ingo Wenke
body: I've tried following, even some comments say it won't work:

In the "PDF stylesheet" section, add following:

```
@page
{

@bottom-left
{
content: " ? my company goes here" ;
font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
font-size: 8pt;
}
@bottom-right
{
content: "Page " counter(page) " of " counter(pages); /* Page Counters */
font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
font-size: 8pt;
}

/* Any other page-specific rules */

}
```

Works fine.


author: ajajahmad786
body: ![print.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/64523i33B66744081DE627/image-size/large?v=v2&px=999 "print.JPG")

Out put showing like this. Total pages is 2 but showing 0.Please help me thanks to all


author: Mohamed Ashif
body: ```
content: "page " counter(page) " of " counter(pages); this one Generate like this page 1 of 0 . it will not come  total pages count can you suggest anything for total pages 
```

comments: author: Steffen Heller
body: What did you do exactly? Where did you enter the above code? Where is the text supposed to appear?

In short: This is CSS code. It must be entered in the PDF stylesheet and will create text in a PDF when the wiki page is exported via "Export to PDF".


author: Mohamed Ashif
body: in Dompdf inside a \<style\>#pagenumber:before {  
content: "Page " counter(page) " of " counter(pages);  
}\</style\>

I call the id inside the body

\<body\>\<span id="pagenumber"\>\</span\>

\</body\>

the Output come like **Page 1/0**


author: Steffen Heller
body: The solution proposed here, works as follows:

1. Add the following code at Browse \> Space Admin \> PDF stylesheet

   ```
   @page {
   @bottom-right {
   content: counter(page) " / " counter(pages);
   }
   }
   ```

2. Click Tools \> Export to PDF

The result will be a PDF with the page number(s) "x / x" at the bottom right of your PDF file.

You seem to try something different which I am not familiar with. So I can't help with that.


author: Mohamed Ashif
body: ![image.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/46342iDBF5455FFC6C469A/image-size/large?v=v2&px=999 "image.PNG")i marked round in picture that header side i need so i can use inside a style as a ID

#id{

```
content: counter(page) " / " counter(pages);
}
<body>
<div id="id"></div>
</body>
```

this will work or not ?


author: Mohamed Ashif
body: it will not work i checked any other option for that to print in pdf -\> page no./total page count

any solution?


Tags: export

number

pdf