PHP How to implement PPT to picture and PHP call COM component Problem of the detailed introduction

Source: Internet
Author: User
PHP calls the COM component to convert the PPT to a picture.

Need to be opened in php.ini

Extension=php_com_dotnet.dllcom.allow_dcom = True

The test code is as follows:

&LT;?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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.