Search code examples
phpmpdf

How To get the current page number in mpdf


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();