Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have used below the code for converting PPT to IMG

<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?php

    $ppApp = new COM("PowerPoint.Application");
    $ppApp->Visible = True;
    $strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); 
    $FileName = "MyPP";
    $ppName = "MySlides.ppt";


    //*** Open Document ***//
    $ppApp->Presentations->Open(realpath($ppName));

    //*** Save Document ***//
    $ppApp->ActivePresentation->SaveAs($strPath."/".$FileName,17);  //'*** 18=PNG, 19=BMP **'
    //$ppApp->ActivePresentation->SaveAs(realpath($FileName),17);

    $ppApp->Quit;
    $ppApp = null;
?>
PowerPoint Created to Folder <b><?php $FileName?></b>
</body>
</html>

its working only in http : //localhost but if I use this same code in my web-server(cpanel hosted location) location its showing following error.

Fatal error: Class 'COM' not found in /home/domainname/public_html/index.php on line 9

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
181 views
Welcome To Ask or Share your Answers For Others

1 Answer

Your web server is running Linux.

In order to install the PHP extension required to use the Component Object Model (php_com_dotnet this gives access to the COM Class) you need to be running Windows Server and you'll also need to have Microsoft PowerPoint installed on that Windows Server in order to manipulate the PPT in the way that you are trying to.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...