How To get the current page number in mpdf

Issue

I am generating the pdf report using the mpdf and library , i wanted to get the current page number so that i can get the current page number while iam generating the pdf.

Thanks

Solution

add this to a main mPDF class:

function getPageCount() {
    return count($this->pages);
}

and use something like this:

$PageCount = $this->getPageCount();

Answered By – Mehdi

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published