Symfony sfTCPDF 插件 writeHTML 错误

发布于 2024-12-03 11:59:45 字数 1434 浏览 1 评论 0原文

我正在使用 symfony 1.3,sfTCPDF 插件,当我使用curl 执行返回 html 内容时,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权限。尽管最终会出现这个错误。

I'm using symfony 1.3, sfTCPDF plugin when i return a html content using curl execution tcpdf is throwing error

Here is my code

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

When i run the page it shows mnay warning messages first one is

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

based on the file it shows other warnings and
Here is the error

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

I saw the path

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

There is no cache folder. I gave 777 permission to the entire project folder. Eventhough it ends up with this error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

明媚如初 2024-12-10 11:59:45

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

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

Seems this is dealing with the same issue:
http://anthologize.org/trac/ticket/125

TCPDF wasn't adding the dir, so I think you just need to manually create it in older versions (this might be fixed by now).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文