0

MPDF How to pass the total of page number to PHP variable?

Or how to set page number start at 0.

Mpdf version 7.

Thanks

  • 1
    seems to be duplicate of https://stackoverflow.com/questions/17083746/how-to-get-the-total-number-of-pages-in-mpdf Did you try this? – Raza Rafaideen Nov 23 '18 at 08:40

2 Answers2

1

To get the number of pages to a variable, you can use

$pageCount = count($mpdf->pages);

This is however undocumented and can stop working in future versions.

As noted in the documentation,

the page numbering can be reset to any positive number.

As 0 is not positive, it is not possible to start page numbering with it.

Finwe
  • 6,372
  • 2
  • 29
  • 44
0

Please try this one, its according to the official documentation:

$mpdf=new mPDF();
$mpdf->setFooter("Page {PAGENO} of {nb}");

I means PAGENO is return current page and nb is total numbers of pages

Madhuri Patel
  • 1,270
  • 12
  • 24