|
-
Feb 22nd, 2010, 11:16 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Counting Pages
Hello Everybody,
Is there a way to count total number of pages of word and pdf files with PHP?
Thanks.
-
Feb 22nd, 2010, 12:12 PM
#2
Re: Counting Pages
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.
-
Feb 22nd, 2010, 06:25 PM
#3
Re: Counting Pages
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)
-
Feb 23rd, 2010, 02:29 AM
#4
Banned
Re: Counting Pages
Try on Google code, i am sure you will get that.
-
Feb 24th, 2010, 12:43 PM
#5
Thread Starter
Frenzied Member
Re: Counting Pages
Would you please tell me how to send filename like c:\abc.pdf to this function?
Code:
public function getNumPagesInPDF(array $arguments = array())
Thanks everybody.
-
Feb 24th, 2010, 01:41 PM
#6
Re: Counting Pages
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.
-
Feb 25th, 2010, 10:06 AM
#7
Thread Starter
Frenzied Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|