【问题标题】:tcpdf doesn't priting HTML document with image properly - PHPtcpdf 无法正确使用图像打印 HTML 文档 - PHP
【发布时间】:2011-11-13 16:45:54
【问题描述】:

我使用 tcpdf 将 HMTL 转换为 PDF 的代码。

$html =  '<pre>
          <br/>
          <h3><a href="/node/02" title="View Original Document">aa</a></h3>
          <br/>
          <img width="628" height="674" class="imagecache imagecache-assetimage" title="" alt="" src="http://test/a_image/AssignPage.jpg" />&nbsp</pre>';

    $htm = '<div style="font-size:40px !important;">'.$html.'</div>';
    $pdf->writeHTML($htm, TRUE, TRUE, TRUE, FALSE, '');

上面的代码打印出以下错误信息:

TCPDF ERROR: [Image] Unable to get image: /path-of-the-image

如果 HTML 不包含图像,它可以正常工作。

如何解决这个问题?

任何帮助将不胜感激......

提前谢谢..

【问题讨论】:

  • 在你的地址栏中试试这个 "test/a_image/AssignPage.jpg"" 是否有效?
  • s。我检查了它..图像在那里!
  • 尝试打印您的 html...可能会对您有所帮助...

标签: php html tcpdf


【解决方案1】:

需要为位于 tcfdf 的缓存文件夹提供 777 权限。

而且它有效...

谢谢...

【讨论】:

    猜你喜欢
    • 2012-06-02
    • 1970-01-01
    • 2011-11-18
    • 1970-01-01
    • 2017-12-01
    • 2012-11-11
    • 2016-09-06
    • 2017-03-23
    • 1970-01-01
    相关资源
    最近更新 更多