6

I have code like this:

$html2pdf = new HTML2PDF('P','A4','en');
$html2pdf->WriteHTML($html);
$html2pdf->Output();

How add page number at the bottom of the document?

Marcin Zaremba
  • 253
  • 1
  • 3
  • 11

4 Answers4

18

i'm still looking for it ... and i have just found the solution : in your template, insert a code like :

<page>
  <page_footer>
    [[page_cu]]/[[page_nb]]
  </page_footer>
</page>

complete sample here : http://wiki.spipu.net/doku.php?id=html2pdf:en:v4:bookmark

pit
  • 633
  • 6
  • 16
  • 1
    Another thing that could come in handy to pagination is how to reset the numbering for different pages! Maybe you want to add multiple documents to the same pdf and print it. You can use `pagegroup="new"` on the page tag. – aki Sep 01 '14 at 07:32
  • My situation is different. My pdf file need to show list of workers start at second page onwards. (First page is only introduction, doesn't need to show pagination page. Can we offset by minusing first page? [([page_cu]-1)]/[[page_nb]] – Varkery Dec 13 '21 at 21:52
0

I tried the following code.

<page>
    <page_header footer='page'>
        <!-- some text-->
    </page_header>
    <!--
        Content
     -->
    <page_footer>
    </page_footer>
</page>

Now in each page in footer I am getting PAGE NUMBER IN THE FOLLOWING MANNER

Page 1/3 Page 2/3 Page 3/3

But i have not got any custom format. If any body know please tell.

I have followed the link : http://wiki.spipu.net/doku.php?id=html2pdf%3aen%3av4%3apage

Dinesh Patra
  • 1,125
  • 12
  • 23
0
<page backtop="7mm" backbottom="7mm" footer="page">
<page_header>
    <!-- some text-->
</page_header>
<!--
    Content
 -->
<page_footer>
</page_footer>

Instance on de page which type of option do you want on the page. Diferents options are : (page, date, heure, form), separated by “;”

Also you have to indicate the size of the header and the footer.

mohamet monte
  • 53
  • 1
  • 10
-1

Have a look at http://www.tufat.com/docs/html2ps/calling.html and look at the footerhtml parameter.

Also see http://www.tufat.com/docs/html2ps/directives.html for directives you can use.

Hope this points you in the right direction.

Arno
  • 1,253
  • 14
  • 21