【问题标题】:add html to invoice pdf Magento将html添加到发票pdf Magento
【发布时间】: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。我也试过了,但它给出了一个没有其他数据的全新页面。

【问题讨论】:

    标签: php magento pdf invoice


    【解决方案1】:

    您不应编辑核心文件。您必须创建一个模块覆盖发票 pdf 功能。

    使用此网址,您可以覆盖发票 pdf 功能。

    http://inchoo.net/magento/how-to-add-custom-attribute-to-magentos-pdf-invoice/

    试试上面的 URL 并根据您的要求进行自定义。

    【讨论】:

      猜你喜欢
      • 2012-08-06
      • 2012-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多