0

I want to get the page numbers of ppt files. My Code:

$filename = "aaa.ppt";
$word = new COM("Powerpoint.Application");
$word->PresentationDocument->Open($filename);
$wdStatisticPages = 2; // Value that corresponds to the Page count in the Statistics
echo $word->ActivePresentation->SlideParts->Count($wdStatisticPages);  
$word->ActivePresentation->Close();
$word->Quit();

But it gives error:

Fatal error: Uncaught exception 'com_exception' with message 'Unable to lookup `PresentationDocument': Unknown name. '

Sanjuktha
  • 1,065
  • 3
  • 13
  • 26
Ravi Sharma
  • 31
  • 1
  • 9

2 Answers2

0

This is kind of issue is due to the following factors.

  1. PHP.ini settings
  2. File/ Folder Permission
  3. allow open is not enabled in the server
  4. allowed upload size
Suyog
  • 2,472
  • 1
  • 14
  • 27
0

I got the answer, thanks Suyog for your efforts.

$filename = "aaa.ppt";
$power = new COM("Powerpoint.Application");
$power->visible = True;
$power->Presentations->Open(realpath($filename));
echo $power->ActivePresentation->Slides->Count;  
//$word->ActiveDocument->PrintOut();
$power->ActivePresentation->Close();
$power->Quit();
Ravi Sharma
  • 31
  • 1
  • 9