Symfony sfTCPDF插件writeHTML错误

时间:2011-09-07 11:56:58

标签: symfony1 tcpdf

当我使用curl执行返回html内容时,我正在使用symfony 1.3,sfTCPDF插件tcpdf正在抛出错误

这是我的代码

$url = "http://urlpath/builder/builder_dev.php/design/agreement?";
$arguments = "&pdfid=10";
$ch1 = curl_init();
$headerinfo = apache_request_headers();
curl_setopt($ch1, CURLOPT_URL, $url);
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch1, CURLOPT_POSTFIELDS, $arguments);
curl_setopt($ch1, CURLOPT_USERAGENT,$headerinfo['User-Agent']);
$result = curl_exec($ch1);

$pdf->writeHTML("\n\n\n".$result, true, 0);
$pdf->Output('Agreement.pdf');

当我运行页面时,它首先显示mnay警告消息

Warning: imagepng() [function.imagepng]: Unable to open '/var/www/html/projectPath/plugins/sfTCPDFPlugin/lib/tcpdf/cache/mska_01754b01ec8372f7001557e3be56ba40' for writing: No such file or directory in /var/www/html/projectPath/plugins/sfTCPDFPlugin/lib/tcpdf/tcpdf.php  on line 8109

根据文件显示其他警告和 这是错误

TCPDF ERROR: Can't open image file: /var/www/html/projectPath/plugins/sfTCPDFPlugin/lib/tcpdf/cache/mska_01754b01ec8372f7001557e3be56ba40
Notice: Undefined property: sfTCPDF::$userData in /var/www/html/projectPath/plugins/sfTCPDFPlugin/lib/sfTCPDF.class.php on line 112

我看到了路径

/var/www/html/projectPath/plugins/sfTCPDFPlugin/lib/tcpdf/cache/

没有缓存文件夹。我给了整个项目文件夹777的权限。尽管它最终会出现此错误。

1 个答案:

答案 0 :(得分:0)

似乎这是在处理同样的问题: http://anthologize.org/trac/ticket/125

TCPDF没有添加目录,所以我认为您只需要在旧版本中手动创建它(这可能现在已经修复)。