upload file and count pages.....

I try to upload a word file and in the same time it can count the number of the pages… Did anyone know how to do it? please help me… I already done the upload part, but I don’t know how to display the number of the pages from the file that been upload… :frowning:

i believe it is possible by using using MSWord COM object.

  1. Download the MSWord COM class file somewhere in internet.
  2. Include the class in your program.
  3. Upload and store the document u want to process ( i believe u already did this)
  4. Create a MSWord COM object and assign the word file path to the object.
  5. you can use the following code

[php]
$word = new COM(“Word.Application”);
$word->visible = true;
$word->Documents->Open($filename);
$wdStatisticPages = 2; // Value that corresponds to the Page count in the Statistics
$word->ActiveDocument->ComputeStatistics($wdStatisticPages);

    echo "Total Page(s) : ". $word->ActiveDocument->ComputeStatistics($wdStatisticPages);  
    
    $word->ActiveDocument->PrintOut();
    $word->ActiveDocument->Close();
    $word->Quit();  

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service