Based on R Ubben's answer I found the following PHP code to give good results:
function count_pages($pdfname) {
$pdftext = file_get_contents($pdfname);
$num = preg_match_all("//PageW/", $pdftext, $dummy);
return $num;
}
W
matches any non-alphanumeric character and excludes things like /Pages
, /PageMode
etc.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…