2017-10-13 127 views
0

我正在使用TCPDF生成PDF。 我將包含HTML標籤的sting傳遞給頁腳。當我以PDF格式渲染頁腳時,它不會輸出格式化的HTML輸出,而是顯示所有HTML標籤。TCPDF不會將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標籤

回答

0

我下面的代碼工作

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

阿倫,使用此代碼:

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