2017-06-12 139 views
0

我正在嘗試向我的發票PDF添加免責聲明文本。 當前正文內容爲硬編碼Sales/Model/Order/Pdf/Invoice.php將html添加到發票pdf Magento

public function getDesclaimer($page) 
{ 
    $page->drawLine(25, $this->y, 570, $this->y); 
    $this->y -= 25; 
    $this->_setFontRegular($page, 12); 
    $page->drawText(Mage::helper('sales')->__('Declaration'), 35, $this->y-20, 'UTF-8'); 
    $this->_setFontRegular($page, 8); 
    $page->drawText(Mage::helper('sales')->__('The goods sold are intended for end user consumption and not for resale.'), 35, $this->y-50, 'UTF-8'); 
    $page->drawText(Mage::helper('sales')->__('The goods sold are intended for end user consumption and not for resale.'), 35, $this->y-60, 'UTF-8'); 
    $page->drawText(Mage::helper('sales')->__('of goods specified in this tax invoice is made by me/us and that the transaction of sale covered by this tax invoice has been effected by me/us'), 35, $this->y-70, 'UTF-8'); 
    $page->drawText(Mage::helper('sales')->__('and it shall be accounted for in the turnover of sales while filling of return and the due tax,if any payable on the sale has been paid or shall be paid.'), 35, $this->y-80, 'UTF-8'); 
    $page->drawText(Mage::helper('sales')->__('This is a computer generated invoice.'), 35, $this->y-100, 'UTF-8'); 
} 

This works。沒有,我將配置添加到magento設置並在相同的功能下調用它。

這顯示正確的文本,但HTML不起作用。

當我搜索了得到,zend pdf不允許在PDF格式的HTML。我們需要使用TCPDF。我也嘗試過,但它給了一個全新的頁面而沒有其他數據。

回答