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!