I've used html2pdf myself and couldn't find such a feature either. However, you can use the well-known ImageMagick library after generating your PDF to retrieve the number of pages:
$im = new Imagick();
$im->pingImage('generated.pdf');
echo $im->getNumberImages();
Has helped me, hope you can use that too.