【发布时间】:2017-06-12 12:12:30
【问题描述】:
我正在尝试在我的发票 PDF 中添加免责声明文本。
目前文本被硬编码为Sales/Model/Order/Pdf/Invoice.php。
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');
}
这行得通。不,我在magento设置中添加了一个配置,并在相同的函数下调用它。
这会显示正确的文本,但 HTML 不起作用。
当我搜索到 zend pdf 不允许在 pdf 中使用 html 时。我们需要使用 TCPDF。我也试过了,但它给出了一个没有其他数据的全新页面。
【问题讨论】: