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…
i believe it is possible by using using MSWord COM object.
- Download the MSWord COM class file somewhere in internet.
- Include the class in your program.
- Upload and store the document u want to process ( i believe u already did this)
- Create a MSWord COM object and assign the word file path to the object.
- 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]