在php中从word文档创建pdf

在php中从word文档创建pdf,php,pdf,doc,Php,Pdf,Doc,我正在尝试将word(doc,docx)文档转换为pdf,但它没有发生。。。。我用过 <?php $oLoader = new COM("easyPDF.Loader.6"); try { $oPrinter = $oLoader->LoadObject("easyPDF.Printer.6"); $oPrintJob = $oPrinter->PrintJob; $oPrintJob->PrintOu

我正在尝试将word(doc,docx)文档转换为pdf,但它没有发生。。。。我用过

<?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(); 
    }
?> 

请帮我查看一下您的事件日志,它应该有更详细的信息。很可能您的web服务器未以“正确用户”身份登录:


我使用了libreoffice、unoconv和PHP-unoconv

您可以从这里安装libreoffice 雨衣

Ubuntu:
sudo apt get install-y libreoffice libreoffice脚本提供程序python uno-libs3 python3 uno python3

对于unoconv: 雨衣:
brew安装unoconv--HEAD

Ubuntu:
sudo-apt-get-install-unoconv

然后您可以使用:

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