my Cheng
my Cheng

Reputation: 1

MPDF Total Page Issues

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

Upvotes: 0

Views: 1272

Answers (2)

Madhuri Patel
Madhuri Patel

Reputation: 1270

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

Upvotes: 0

Finwe
Finwe

Reputation: 6725

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.

Upvotes: 1

Related Questions