从托管服务器运行wkhtmltopdf时出现问题

时间:2018-02-17 18:39:57

标签: wkhtmltopdf

我正在尝试从托管服务器运行wkhtmltopdf。我的php文件只是通过尝试使用php'exec'命令执行wkhtmltopdf.exe,将php创建的html文件('mytempfile.html')转换为pdf文档(称为'mynew.pdf'),然后尝试打开浏览器中的pdf文件。它在我的localhost测试中工作正常,但是当上传到服务器时显然无法执行。我已经更改了文件权限,允许服务器上的整个文件夹“执行”,但没有雪茄。 wkhtmltopdf程序的整个目录已上传到与php文件相同的目录中的服务器。 以下是相关的php文件:

<?php

exec('.\\wkhtmltopdf\\bin\\wkhtmltopdf.exe  mytempfile.html  mynew.pdf');

$filename="mynew.pdf";

header('Content-type:application/pdf');
header('Content-disposition: inline; filename="'.$filename.'"');
header('content-Transfer-Encoding:binary');
header('Accept-Ranges:bytes');

echo file_get_contents('mynew.pdf');

?>

任何建议都会受到赞赏....

0 个答案:

没有答案