Closed GoogleCodeExporter closed 9 years ago
Thanks for clarifying this. I believe the former issue was deleted because it
was thought to be invalid and we did not get a response when asking for a URL
which demonstrated the behaviour. I didn't think the numpages.php was actually
used any longer by our php scripts for counting pages but was rather a remnant
from how it was done in previous versions. We will of course fix and update
this script, thanks again
Original comment by erik.eng...@devaldi.com
on 27 Jan 2013 at 4:39
Just confirmed it - the numpages.php isn't used any longer so you just have an
older version of our php scripts. If you update to the latest version of the
php scripts we supply. We count pages using a different method since a few
versions back:
var numPages = <?php echo getTotalPages($pdfFilePath . $doc . ".pdf") ?>;
which traces to the function getTotalPages in common.php, which reads this from
the actual PDF:
function getTotalPages($PDFPath) {
$stream = @fopen($PDFPath, "r");
$PDFContent = @fread ($stream, filesize($PDFPath));
if(!$stream || !$PDFContent)
return false;
$firstValue = 0;
$secondValue = 0;
if(preg_match("/\/N\s+([0-9]+)/", $PDFContent, $matches)) {
$firstValue = $matches[1];
}
if(preg_match_all("/\/Count\s+([0-9]+)/s", $PDFContent, $matches))
{
$secondValue = max($matches[1]);
}
return (($secondValue != 0) ? $secondValue : max($firstValue, $secondValue));
}
Numpages.php will be removed to avoid any future confusion.
Original comment by erik.eng...@gmail.com
on 27 Jan 2013 at 4:53
Many thanks for the info and your support!
Original comment by mentur...@gmail.com
on 28 Jan 2013 at 9:27
Original issue reported on code.google.com by
mentur...@gmail.com
on 27 Jan 2013 at 12:20