问题
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