【发布时间】:2013-01-16 05:45:57
【问题描述】:
这是我的 PHP 代码,用于将 HTML 文件转换为 pdf,然后从服务器下载 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 $url {$file_folder}{$file_name}.pdf");它不会在文件夹中创建 pdf 文件
在 Ubuntu 上运行良好,但在 Debian 上下载 pdf 后,打开 pdf 时 Adob Reader 显示错误,请查看图片。
我认为问题是由于 exec() 无法在 Debian 中工作...!
【问题讨论】:
标签: php debian wkhtmltopdf