Alex Rivera | Logout

Count the number of pages in a PDF in only PHP

Asked 2009-07-17T15:03:52.133
36

I need a way to count the number of pages of a PDF in PHP. I've done a bit of Googling and the only things I've found either utilize shell/bash scripts, perl, or other languages, but I need something in native PHP. Are there any libraries or examples of how to do this?

Edit
Report

1 Answer

0
$pdftext = file_get_contents($caminho1);

 $num_pag = preg_match_all("/\/Page\W/", $pdftext,$dummy);
answered 2012-07-06T20:10:44.680

Your Answer