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
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
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.
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