1)我将“wkhtmltopdf-i386”上传到我的服务器上,文件夹名为"/pdf“
2)我上传了php集成脚本,放在同一个文件夹中,并将其命名为"wkhtmltopdf.php“(http://code.google.com/p/wkhtmltopdf/wiki/IntegrationWithPhp)
3)我上传了一个我命名为"usage.php“的文件,放在同一个文件夹中,包含:
<?php
require_once('wkhtmltopdf.php');
$pdf=new WKPDF();
$pdf->set_html('Hello world!');
$pdf->render();
$pdf->output(WKPDF::$PDF_EMBEDDED,'sample.pdf');
?>4)我创建了一个拥有777权限(全部)的/tmp文件夹。
当我加载usage.php时,我得到以下错误:
"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"仅供参考,每次我加载usage.php时,/tmp文件夹中都会呈现一个html页面。
你有任何关于如何解决我的问题的线索吗?
谢谢
发布于 2012-03-31 22:32:39
你试过查看你的wkhtmltopdf.php吗?
确保这一行:
/**
* path to executable
*/
protected $_bin = '/usr/bin/wkhtmltopdf';不是/usr/bin/wkhtmltopdf,而是您放置wkhtmltopdf-i386的绝对路径。
在您的例子中,可能是/pdf/wkhtmltopdf-i386。
https://stackoverflow.com/questions/9623477
复制相似问题