How to get a page count in an mPDF document?

mpdf, php

Solution

add this to a main mPDF class:

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

then add a html-parser such string:

$html = str_replace('{PAGECNT}', $this->getPageCount(), $html);

after these actions you can insert {PAGECNT} directly in your parsed HTML to get the result. This is useful is you need to indicate a page:

Problem

Does anybody knows how to get the number of generated pages if a PDF document using mPDF library?

Original source

Related problems