【问题标题】:TCPDF is not converting HTML tags to it's outputTCPDF 没有将 HTML 标记转换为其输出
【发布时间】:2017-10-13 12:44:15
【问题描述】:

我正在使用 TCPDF 生成 PDF。 我将包含 HTML 标记的字符串传递给页脚。当我在 pdf 中呈现页脚时,它不会输出格式化的 HTML 输出,而是按原样显示所有 HTML 标签。

我的代码如下,

//Page footer
public function Footer() {
    $subscriber_id = General::getSubscriberIdByUserId(\Yii::$app->user->id);
    $subscriber_footer = Subscriber::find()->where(['id'=>$subscriber_id])->asArray()->one();

     $footer = '<span style="text-align:center;line-height:11pt;">
                  <p style="font-size:7pt;"><?= $subscriber_footer["invoice_footer"] ?></p>
                </span>'; 

    $this->SetY(-40);        
    $this->Cell(0, 10, $footer, 0, false, 'C', 0, '', 0, false, 'T', 'M');
}

如何获得没有 HTML 标签的格式化 HTML 输出

【问题讨论】:

    标签: php html yii2 tcpdf


    【解决方案1】:

    以下代码对我有用

    $this->MultiCell(0, 10, $footer, $border=0, $align='C', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=true, $autopadding=true, $maxh=0);
    

    【讨论】:

      【解决方案2】:

      阿伦,使用这个代码:

      $this-&gt;MultiCell(0, 10, $footer, $border=0, $align='C', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=true, $autopadding=true, $maxh=0);

      【讨论】:

        猜你喜欢
        • 2014-06-04
        • 2017-12-19
        • 2017-02-26
        • 2012-04-23
        • 1970-01-01
        • 2015-10-30
        • 2011-02-21
        • 1970-01-01
        • 2011-04-22
        相关资源
        最近更新 更多