我正在尝试将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();
}
?>
这个代码,但它的返回错误像
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
请帮我处理这个
查看您的事件日志,它应该有更详细的信息。很可能您的网络服务器没有以"正确用户"身份登录:
http://www.pdfonline.com/easypdf/sdk/usermanual/running_on_server/printer_sdk/about_loader.htm
我使用了libreoffice、unoconv和PHP unoconv
你可以从这里安装libreofficeMAChttp://mirrors.adams.edu/LibreOffice/mac/LibreOffice_4.3.7_MacOS_x86-64.dmg
Ubuntu:sudo apt-get install -y libreoffice libreoffice-script-provider-python uno-libs3 python3-uno python3
对于unoconv:Mac:brew install unoconv --HEAD
Ubuntu:sudo apt-get install unoconv
然后你可以使用:
https://github.com/alchemy-fr/PHP-Unoconv