Results 1 to 7 of 7

Thread: [RESOLVED] Counting Pages

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Resolved [RESOLVED] Counting Pages

    Hello Everybody,

    Is there a way to count total number of pages of word and pdf files with PHP?

    Thanks.

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    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.

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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)
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4

    Re: Counting Pages

    Try on Google code, i am sure you will get that.

  5. #5

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    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.

  6. #6
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    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.

  7. #7

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Re: Counting Pages

    Great, thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width