在底部添加自定义文本pdf发票magento
我需要关于如何在magento pdf发票底部添加自定义文本的帮助 pdf发票底部的示例“感谢您与我们合作”在底部添加自定义文本pdf发票magento,magento,Magento,我需要关于如何在magento pdf发票底部添加自定义文本的帮助 pdf发票底部的示例“感谢您与我们合作” 提前感谢您您可以通过创建一个模块并覆盖Mage\u Sales\u Model\u Order\u Pdf\u Invoice类来完成此操作。然后,您可以将getPdf()方法复制到新类中,并将更改添加到每个发票的末尾(确保在发票循环中执行此操作,因为您可以一次打印多个发票) /** * Return PDF document * * @param array $invoices
提前感谢您您可以通过创建一个模块并覆盖
Mage\u Sales\u Model\u Order\u Pdf\u Invoice
类来完成此操作。然后,您可以将getPdf()方法复制到新类中,并将更改添加到每个发票的末尾(确保在发票循环中执行此操作,因为您可以一次打印多个发票)
/**
* Return PDF document
*
* @param array $invoices
* @return Zend_Pdf
*/
public function getPdf($invoices = array())
{
$this->_beforeGetPdf();
[...]
foreach ($invoices as $invoice) {
[...]
/* Add totals */
$this->insertTotals($page, $invoice);
if ($invoice->getStoreId()) {
Mage::app()->getLocale()->revert();
}
// Add your custom stuff here
$this->insertMyCustomStuff();
}
$this->_afterGetPdf();
return $pdf;
}
/**
* Insert custom stuff to pdf page
*
* @param Zend_Pdf_Page $page
* @param Mage_Sales_Model_Abstract $invoice
* @return Zend_Pdf_Page
*/
public function insertMyCustomStuff($page, $invoice)
{
$page->drawLine(25, $this->y, 570, $this->y); //right
$this->y -= 25;
$page->drawText(Mage::helper('sales')->__('Thank you for working with us!'), 35, $this->y, 'UTF-8');
}