Php calls com component to convert ppt to image-php Tutorial

Source: Internet
Author: User
PHP calls the com component to convert the ppt file into an image. You need to enable extensionphp_com_dotnet.dllcom.allow_dcom in php. ini. the test code is as follows: & lt ;? Php $ powerpntnewCOM (& quot; powerpoint. application & quot;) ordie (& quot; Unabl PHP calls the com component to convert the ppt to an image.

Must be enabled in php. ini

Extension = php_com_dotnet.dll
Com. allow_dcom = true

The test code is as follows:

 Presentations-> Open ($ addr, false) or die ("Unable to open presentation"); $ presentation-> Fonts-> Replace ('black ', '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."
"; // Echo $ c-> Replace ('', '');} 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...

The above is the details about converting ppt files into images by calling the com component in php. For more information, see other related articles in the first PHP community!

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.