Total pages in PDF using html2pdf <p>I have some HTML using which I am printing a PDF, I would like to get the count of total pages the PDF will produce in a PHP Variable.</p> <pre><code>$html2pdf = new HTML2PDF('P', 'A4'); $html2pdf-&gt;writeHTML($html, false); $html2pdf-&gt;Output('myfile.pdf'); </code></pre> <p>I would like to do something like..</p> <pre><code>$totalpages = $html2pdf-&gt;getTotalPageCount(); //should return total pages the myfile.pdf would produce. </code></pre>