Hello Everybody,
Is there a way to count total number of pages of word and pdf files with PHP?
Thanks.
Printable View
Hello Everybody,
Is there a way to count total number of pages of word and pdf files with PHP?
Thanks.
as for PDF files, you could try this solution from PHP.net. for DOC files, I haven't seen anything with a very limited search. I'd suggest trying to Google it on your own, too.
You could open the document in binary and pull out the word count manually:
http://www.microsoft.com/interop/doc...rmats.mspx#EFB
If you look at the word document PDF, the page count (if calculated) can be found in the document properties. This may not reflect the current page count however.
If you are downloading onto a Windows machine, you can open the document using a VB Script and execute a page count. You can modify the code below to output the filename and page count to a document or database.
Code:ActiveDocument.Repaginate
MsgBox ActiveDocument.BuiltInDocumentProperties(wdPropertyPages)
Try on Google code, i am sure you will get that.
Would you please tell me how to send filename like c:\abc.pdf to this function?
Thanks everybody.Code:public function getNumPagesInPDF(array $arguments = array())
the function itself was taken out of a class, I'm sure, so you could redefine the function so that it just takes a string variable as a path. you'll need to remove the first line of the function that defines $PDFPath, however, and make sure the parameter you take for the function is named $PDFPath instead. if you were to use it as is, you would just need an array with the first value being the path, but I'd suggest doing what I described above instead.
Great, thanks.