PHP calls the COM component to convert the PPT to a picture.
Need to be opened in php.ini
Extension=php_com_dotnet.dll
com.allow_dcom = True test code is as follows:
<?PHP$POWERPNT = new COM ("PowerPoint.Application") or Die ("Unable to instantiate PowerPoint"); $file = ' 1.ppt '; echo Realpath ($file); $addr = $_server[' Document_root ']. ' /ppt/1.ppt '; echo $addr; $presentation = $powerpnt->presentations->open ($addr, False, False, false) or die ("unable To open presentation "); $presentation->fonts->replace (' blackbody ', ' Young Circle '); $presentation->fonts->replace (' MS Gothic ', ' Young Circle '); $presentation->fonts->replace (' Founder's coarse Qian ', ' young Circle '); $presentation->fonts->replace (' founder small Mark Song Simplified ') , ' Young Circle '), $presentation->fonts->replace (' Arial Black ', ' Young Circle '), $presentation->fonts->replace (' XXFarEastFont-Chinese song ', ' Young Circle ') ; $presentation->fonts->replace (' Arial Unicode MS ', ' Young Circle '); $presentation->fonts->replace (' Founder Fine Circle ', ' Young Circle ') ; $presentation->fonts->replace (' Times New Roman ', ' young Circles '); foreach ($presentation->fonts as $c) {echo $c Name. " <br/> ";//echo $c->replace (', ');} foreach ($presentation->slides as $slide) {$slideName = "Slide_". $slide->slidenumber; $uploadsFolder = 'iii '; $exportFolder = Realpath ($uploadsFolder); $slide->export ($exportFolder. " ". $slideName.". JPG "," jpg "," 1920 "," 1080 "); $presentation->close (); $powerpnt->quit (); $powerpnt = null;? >
Run on the Win7, no problem, put to 2008 above error, there is a exception called unknown ...
Solution:
CMD-"dcomcnfg
Reference URL:
http://blog.csdn.net/bleurever/article/details/50783133
PHP implementation ppt to picture, PHP calls COM component problem