【问题标题】:TCPDF shows empty pageTCPDF 显示空白页
【发布时间】:2013-06-03 15:35:14
【问题描述】:

我正在使用 tcpdf.php 创建一个 pdf。这是我的简单 html,当我打印 html 时,没问题,但是当我写 pdf 时它什么也没显示。

require_once('../config/lang/eng.php');
require_once('../tcpdf.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$html='
<div  style="background:#2185E7;color:#fff;padding:5px;overflow:hidden;width:786px;">
  <h3 style="margin-bottom: 0;  margin-top: 0;padding-left: 17px;text-align: left;  white-space: nowrap;float:left;">My Company name: 2533</h3>
  <p  style="margin: 0;  padding-right: 14px;text-align: right; white-space: nowrap;float:right;">321 32111 4</p>
</div>

<div  style="background:#2185E7;color:#fff;padding:5px;overflow:hidden;width:786px; margin:10px 0 0 0;">
  <p style="margin: 0;">Elegant 3 B/R + Maids in , Dubai </p>
</div>
';
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->Output('example_006.pdf', 'I');

【问题讨论】:

  • 请帮帮我,我被困了很长时间

标签: pdf tcpdf


【解决方案1】:

您需要删除第一个 div 中的 css attr color:#fff。我不知道为什么,但删除后就可以了。

P/S:TCPD 不理解属性边距和填充。我的解决方案是始终使用 html 标签表来布局所有通用 PDF。你应该试试看。

【讨论】:

    猜你喜欢
    • 2014-01-13
    • 2020-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-19
    • 2015-06-06
    • 2020-07-03
    • 1970-01-01
    相关资源
    最近更新 更多