wkhtmltopdf Issue

与世无争的帅哥 提交于 2019-12-10 17:12:39

问题


1) I uploaded"wkhtmltopdf-i386" to my server in a folder named "/pdf"

2) I uploaded the php integration script, in the same folder, and named it "wkhtmltopdf.php" (http://code.google.com/p/wkhtmltopdf/wiki/IntegrationWithPhp)

3) I uploaded a file that I named "usage.php", in the same folder, containing :

<?php
require_once('wkhtmltopdf.php');
$pdf=new WKPDF();
$pdf->set_html('Hello world!');
$pdf->render();
$pdf->output(WKPDF::$PDF_EMBEDDED,'sample.pdf');
?>

4) I created a /tmp folder with 777 permissions (all).

When I load usage.php, I get the following error:

"Fatal error: Uncaught exception 'Exception' with message 'WKPDF didn't return any data. <pre></pre>' in /home/***/public_html/dev/pdf/wkhtmltopdf.php:205 Stack trace: #0 /home/***/public_html/dev/pdf/usage2.php(5): WKPDF->render() #1 {main} thrown in /home/***/public_html/dev/pdf/wkhtmltopdf.php on line 205"

For your info, a html page is rendered in /tmp folder each time I load usage.php.

Do you have any clue on how to solve my issue?

Thanks


回答1:


Have you tried looking inside your wkhtmltopdf.php?

Make sure that this line:

/**
 * path to executable
 */
protected $_bin = '/usr/bin/wkhtmltopdf';

is not /usr/bin/wkhtmltopdf but is the absolute path where you put your wkhtmltopdf-i386.

In your case, perhaps it's /pdf/wkhtmltopdf-i386.



来源:https://stackoverflow.com/questions/9623477/wkhtmltopdf-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!