Nabeel Arshad
Nabeel Arshad

Reputation: 487

Displaying Page numbers from HTML in TCPDF

I am writing HTML to PDF from TCPDF using

$pdfobject->writeHTML($PrintingFile, true, false, true, false, '');

I want to add the Page numbers on all the Pages.

If I use $pdf->Footer($pdfobject) it prints the page number only on the last page. Can you please help me how can I print the page numbers on All pages ?

Upvotes: 1

Views: 6551

Answers (2)

Brett
Brett

Reputation: 2010

Ensure you are calling the Footer() method before adding any pages.

I found i was adding the footer content after the pages had been generated. It needs to be done before any pages are added

If you use a custom Footer method in your own MyTCPDF class. Ensure the value is set before calling any AddPage calls

Upvotes: 0

Hilarius L. Doren
Hilarius L. Doren

Reputation: 757

you can put this on top or footer of your page

$pdf->writeHtmlCell($widhheader,3,20,4,'<p>Page '.$pdf->getAliasNumPage().' of  '.' '.$pdf->getAliasNbPages().'</p>','',1,0,false,'R');

Upvotes: 1

Related Questions