这是我用来将HTML文件转换为pdf然后从服务器下载pdf文件的PHP代码。wkhtmltopdf不为Debian创建pdf
wkhtmltopdf
$url = base_url().'invoices/'.$file_name.'.html';
exec("wkhtmltopdf-amd64 $url {$file_folder}{$file_name}.pdf");
header("Cache-Control: no-cache");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$file_name.pdf");
header("Content-Type: application/pdf");
header("Content-Transfer-Encoding: binary");
$pdfFile = base_url().'invoices/'.$file_name.'.pdf';
readfile($pdfFile);
&后执行的exec( “wkhtmltopdf-AMD64 $网址{$ file_folder} {$ FILE_NAME} .PDF”);它不
它下载PDF后工作正常上Ubuntu的但Debian的,当打开PDF Adob读者说错误,请查看图像的文件夹中创建PDF文件。
我认为这个问题是由于exec()不工作在Debian ...!
ULR指向利用了W正确的,遗憾的一件事多个IM khtmltopdf&执行exec后(“wkhtmltopdf-amd64 $ url {$ file_folder} {$ file_name} .pdf”);它不会在该文件夹中创建PDF文件。 –
这就是它发生的情况,当没有文件或正确的格式,错误给出和wkhtmltopdf这可能会帮助你[http://stackoverflow.com/questions/8881315/linux-permissions-issue-when-executing -wkhtmltopdf-AMD64](http://stackoverflow.com/questions/8881315/linux-permissions-issue-when-executing-wkhtmltopdf-amd64) – somesh