我正在尝试将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
请帮助我
答案 0 :(得分:0)
看看你的事件日志,它应该有更详细的信息。很可能您的Web服务器未以“正确的用户”身份登录:
http://www.pdfonline.com/easypdf/sdk/usermanual/running_on_server/printer_sdk/about_loader.htm
答案 1 :(得分:0)
我使用了libreoffice,unoconv和PHP-unoconv
您可以从此处安装libreoffice 苹果电脑 http://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
for unoconv:
苹果电脑:
brew install unoconv --HEAD
Ubuntu的:
sudo apt-get install unoconv
然后你可以使用: