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