dongzhi6463
2013-01-16 05:45 阅读 35
已采纳

wkhtmltopdf没有为Debian创建pdf

This is my PHP code which I am using to convert HTML file to pdf and then download pdf file from server.

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);

& after execute exec("wkhtmltopdf-amd64 $url {$file_folder}{$file_name}.pdf"); it does not create pdf file in the folder

It is working fine on Ubuntu but on Debian after download pdf, when open pdf Adob Reader says error please see the image.

I think the issue is due to exec() not working in Debian...!

enter image description here

wkhtmltopdf

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    douyi1341 douyi1341 2013-01-21 07:28

    For Debian I needed to install xvfb-run wkhtmltopdf

    点赞 评论 复制链接分享
  • dongtan5555 dongtan5555 2013-01-16 05:48

    Check for the path in base_url() is passing correct path during download of the file, to test that write down the path in browser and check whether it gets downloaded or not

    点赞 评论 复制链接分享

相关推荐