PHP 安装COM组件
如过php版本>5.3.15,需要保证ext文件夹下有php_com_dotnet.dell 并在php.ini中加入
extension=php_com_dotnet.dll
去除com.allow_dcom = true前面的‘;’号
com.allow_dcom = true
代码部分
<?php
$powerpnt = new COM("powerpoint.application") or die("Unable to instantiate Powerpoint");
$file='E:/APP/OTHER/qwe.pptx';
$presentation = $powerpnt->Presentations->Open(realpath($file), false, false, false) or die("Unable to open presentation");
foreach($presentation->Slides as $slide)
{
$slideName = "Slide_" . $slide->SlideNumber;
$uploadsFolder = 'iii';
$exportFolder = realpath($uploadsFolder);
$slide->Export($exportFolder."//".$slideName.".jpg", "jpg", "600", "400");
}
$presentation->Close();
$powerpnt->Quit();
$powerpnt = null;
?>
注意一定要$presentation->Close();
不然会导致ppt无法再次打开。