我使用PHP脚本使用libre office将docx文件转换为pdf。
<?php
$command = 'soffice --headless --invisible --convert-to pdf C:\Users\Administrator\Desktop\php\test.docx --outdir C:\inetpub\myapp\pdffiles';
exec($command);
?>
我在IIS服务器上托管的symfony 1.4应用程序中运行此命令。但是它不会创建任何pdf(也不会产生任何错误)。但这在Linux中运行良好。
注意:我尝试通过以下方式检查并检查了输出。
我的测试环境是Windows Server 2012,PHP7和IIS 8。
This works显然需要指定-env:UserInstallation=file:///C:\some\path
也请参见相同的解决方案here