Search code examples
phppdfdoc

creating pdf from word document in php


I am trying to convert word(doc, docx) document to pdf but its not happening.... I have used

<?php 
    $oLoader = new COM("easyPDF.Loader.6"); 
    try
    {
       $oPrinter = $oLoader->LoadObject("easyPDF.Printer.6");
       $oPrintJob = $oPrinter->PrintJob;
       $oPrintJob->PrintOut("F:\wamp\www\index\q.docx", "F:\wamp\www\index\q.pdf");
       print "Success";
    }

    catch(com_exception $e)
    {
      print "error code".$e->getcode(). "\n";
      print $e->getMessage(); 
    }
?> 

this code but its returning error like

Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `easyPDF.Loader.6' in F:\wamp\www\index\index.php on line 2

com_exception: Failed to create COM object `easyPDF.Loader.6': Invalid syntax in F:\wamp\www\index\index.php on line 2

please help me in this


Solution

  • Have a look at your event log, it should have more detailed information. Most likely your web server is not logged in as the "correct user":

    http://www.pdfonline.com/easypdf/sdk/usermanual/running_on_server/printer_sdk/about_loader.htm