Php implements ppt-to-image conversion, and php calls the com component,

Source: Internet
Author: User

Php implements ppt-to-image conversion, and php calls the com component,

PHP calls the com component to convert the ppt file into an image.

 

Must be enabled in php. ini

Extension = php_com_dotnet.dll
The test code com. allow_dcom = true is as follows:
<? Php $ powerpnt = new COM ("powerpoint. application ") or die (" Unable to instantiate Powerpoint "cannot exceed file1_'1.ppt '; echo realpath ($ file); $ addr = $ _ SERVER ['document _ root']. '/ppt/1.ppt'; echo $ addr; $ presentation = $ powerpnt-> Presentations-> Open ($ addr, false) or die ("Unable to open presentation"); $ presentation-> Fonts-> Replace ('simhei ', 'youyuan '); $ presentation-> Fonts-> Replace ('Ms Gothic ', 'youyuan'); $ presentation-> Fonts-> Replace (' 正 ', ''); $ presentation-> Fonts-> Replace (' 正 ', 'youyuan '); $ presentation-> Fonts-> Replace ('arial Black', 'youyuan '); $ presentation-> Fonts-> Replace (' 文中 ', 'youyuan'); $ presentation-> Fonts-> Replace ('arial Unicode Ms ', 'youyuan '); $ presentation-> Fonts-> Replace (' 正 ', 'youyuan '); $ presentation-> Fonts-> Replace ('times New Roman ', 'youyuan'); foreach ($ presentation-> Fonts as $ c) {echo $ c-> name. "<br/>"; // echo $ c-> Replac E ('','');} foreach ($ presentation-> Slides as $ slide) {$ slideName = "Slide _". $ slide-> SlideNumber; $ uploadsFolder = 'II'; $ exportFolder = realpath ($ uploadsFolder); $ slide-> Export ($ exportFolder. "//". $ slideName. ". jpg "," jpg "," 1920 "," 1080 ") ;}$ presentation-> Close (); $ powerpnt-> Quit (); $ powerpnt = null;?>

  

Run on win7. No problem. Put it on 2008 with an error. There is an exception called unknown...

Solution:

Cmd-"dcomcnfg

 

Reference URL:

Http://blog.csdn.net/bleurever/article/details/50783133

 

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.