Fatal Error in convert PPT to PNG in PHP

佐手、 提交于 2019-12-24 06:48:41

问题


I want to convert PPT to PNG with PHP. I wrote the following piece of code to solve the problem:

$powerpnt = new COM("PowerPoint.Application") or die('could not create the powerpoint instance');
$powerpnt->Visible = True;

$strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"])));

$FileName = "MyPP";

$powerpnt->Presentations->Open("D:\\MySlide.ppt"); /* This is line #16 */

$powerpnt->ActivePresentation->SaveAs($strPath."/".$FileName,17);

$powerpnt->Quit;
$powerpnt = null;

But I got the following Fatal error:

Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Office PowerPoint 2007<br/><b>Description:</b> PowerPoint could not open the file.' in C:\wamp\www\ppt2jpg\ppt2jpg.php:16 Stack trace: #0 C:\wamp\www\ppt2jpg\ppt2jpg.php(16): variant->Open('D:\MySlide.ppt') #1 {main} thrown in C:\wamp\www\ppt2jpg\ppt2jpg.php on line 16

How can I solve this problem?

Thanks in advance.

来源:https://stackoverflow.com/questions/8786379/fatal-error-in-convert-ppt-to-png-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!