2017-06-12 138 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。我也尝试过,但它给了一个全新的页面而没有其他数据。

回答