如何使用php COM类将PPT转换为jpeg

时间:2018-03-12 09:58:05

标签: php com jpeg powerpoint

我正在尝试使用php COM类将ppt幻灯片转换为图像

当我尝试这样做时,我收到以下错误:

Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Office PowerPoint 2007<br/><b>Description:</b> PowerPoint could not open the file

我正在使用的代码如下:

    <html>
      <head>
          <title>ShotDev.Com Tutorial</title> 
        </head> 
        <body> <?= $ppApp = new COM("PowerPoint.Application"); 

          $ppApp->Visible = True; $strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); 

          $ppName = "MySlides.ppt"; $FileName = "MyPP"; $ppApp->Presentations->Open(realpath($ppName)); 

          $ppApp->ActivePresentation->SaveAs($strPath."/".$FileName,17); $ppApp->Quit; $ppApp = null;

          ?> PowerPoint Created to Folder 
          <b><?=$FileName?></b> 
        </body> 
    </html>

1 个答案:

答案 0 :(得分:0)