Add text to invoice The Next CEO of Stack OverflowPDF invoice shows a empty invoiceHow to add payment method's info to the PDF invoice?PDF Invoice; changing shipping and other textModify text in the PDF invoiceAdd text line in Invoice PDFHow to can I add some text in invoice pdf magento?Hide “invoice #” in the invoice PDFHow to add additional text to invoiceReplace store address with custom text in invoice pdfMagento 2, add `company's name` in invoice PDF file?
How to safely derail a train during transit?
Anatomically Correct Mesopelagic Aves
Does the Brexit deal have to be agreed by both Houses?
Is it okay to store user locations?
How to write papers efficiently when English isn't my first language?
Why doesn't a table tennis ball float on the surface? How do we calculate buoyancy here?
Robert Sheckley short story about vacation spots being overwhelmed
Why do professional authors make "consistency" mistakes? And how to avoid them?
Science fiction (dystopian) short story set after WWIII
Whats the best way to handle refactoring a big file?
Fastest way to shutdown Ubuntu Mate 18.10
Opposite of a diet
Text adventure game code
How did people program for Consoles with multiple CPUs?
Why did we only see the N-1 starfighters in one film?
I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin
Horror movie/show or scene where a horse creature opens its mouth really wide and devours a man in a stables
If I blow insulation everywhere in my attic except the door trap, will heat escape through it?
Why does C# sound extremely flat when saxophone is tuned to G?
How do we know the LHC results are robust?
Go Pregnant or Go Home
How do I get the green key off the shelf in the Dobby level of Lego Harry Potter 2?
Inappropriate reference requests from Journal reviewers
Is it my responsibility to learn a new technology in my own time my employer wants to implement?
Add text to invoice
The Next CEO of Stack OverflowPDF invoice shows a empty invoiceHow to add payment method's info to the PDF invoice?PDF Invoice; changing shipping and other textModify text in the PDF invoiceAdd text line in Invoice PDFHow to can I add some text in invoice pdf magento?Hide “invoice #” in the invoice PDFHow to add additional text to invoiceReplace store address with custom text in invoice pdfMagento 2, add `company's name` in invoice PDF file?
I want to add text to the pdf invoice in the marked arena (see photo).
I'm using Magento version 1.9.2.1
How can I do this?
magento-1.9 invoice pdf
bumped to the homepage by Community♦ 13 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I want to add text to the pdf invoice in the marked arena (see photo).
I'm using Magento version 1.9.2.1
How can I do this?
magento-1.9 invoice pdf
bumped to the homepage by Community♦ 13 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I want to add text to the pdf invoice in the marked arena (see photo).
I'm using Magento version 1.9.2.1
How can I do this?
magento-1.9 invoice pdf
I want to add text to the pdf invoice in the marked arena (see photo).
I'm using Magento version 1.9.2.1
How can I do this?
magento-1.9 invoice pdf
magento-1.9 invoice pdf
edited Feb 25 at 14:40
Tajveez Rehman
629
629
asked Nov 14 '16 at 18:41
NielN98NielN98
115
115
bumped to the homepage by Community♦ 13 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 13 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You can add specific text after total price follow the code
First override that block add this code in your config file between <global/>
:
<models>
<sales>
<rewrite>
<order_pdf_invoice>Namespace_Module_Model_Order_Pdf_Invoice</order_pdf_invoice>
</rewrite>
</sales>
</models>
Create file in app/code/local/Namespace/Module/Model/Order/Pdf/Invoice.php and add the below function at the end of the file:
<?php
class Mage_Sales_Model_Order_Pdf_Invoice extends Mage_Sales_Model_Order_Pdf_Abstract
{
public function insertText($page)
$page->drawLine(25, $this->y, 570, $this->y);
$this->y -= 25;
$page->drawText(Mage::helper('sales')->__('Add here Your custom text'), 35, $this->y, 'UTF-8');
Now, you need to call this insertText() function in the getPdf() function and add this getPdf() function after insertText() function like here:
public function getPdf($invoices = array())
$this->_beforeGetPdf();
$this->_initRenderer('invoice');
$pdf = new Zend_Pdf();
$this->_setPdf($pdf);
$style = new Zend_Pdf_Style();
$this->_setFontBold($style, 10);
foreach ($invoices as $invoice)
if ($invoice->getStoreId())
Mage::app()->getLocale()->emulate($invoice->getStoreId());
Mage::app()->setCurrentStore($invoice->getStoreId());
$page = $this->newPage();
$order = $invoice->getOrder();
/* Add image */
$this->insertLogo($page, $invoice->getStore());
/* Add address */
$this->insertAddress($page, $invoice->getStore());
/* Add head */
$this->insertOrder(
$page,
$order,
Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID, $order->getStoreId())
);
/* Add document text and number */
$this->insertDocumentNumber(
$page,
Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId()
);
/* Add table */
$this->_drawHeader($page);
/* Add body */
foreach ($invoice->getAllItems() as $item)
if ($item->getOrderItem()->getParentItem())
continue;
/* Draw item */
$this->_drawItem($item, $page, $order);
$page = end($pdf->pages);
/* Add totals */
$this->insertTotals($page, $invoice);
if ($invoice->getStoreId())
Mage::app()->getLocale()->revert();
$this->insertText($page); // your custom text is added here
$this->_afterGetPdf();
return $pdf;
$this->insertText($page); that call your custom text function so you need to add before $this->_afterGetPdf(); this function.
Thank for your comment. In which config file should I add the code and what do you mean with Namespace?
– NielN98
Nov 20 '16 at 15:58
Actually you have to create your own module to override model class.So please follow this link for understand about Namespace and also how to create module : code.tutsplus.com/tutorials/…
– Sneha Panchal
Nov 21 '16 at 8:54
add a comment |
I was able to add text to the invoice pdf by creating a local copy of the core directory(files/folders) app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php as app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php and added the insertText() function as stated above.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f145708%2fadd-text-to-invoice%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can add specific text after total price follow the code
First override that block add this code in your config file between <global/>
:
<models>
<sales>
<rewrite>
<order_pdf_invoice>Namespace_Module_Model_Order_Pdf_Invoice</order_pdf_invoice>
</rewrite>
</sales>
</models>
Create file in app/code/local/Namespace/Module/Model/Order/Pdf/Invoice.php and add the below function at the end of the file:
<?php
class Mage_Sales_Model_Order_Pdf_Invoice extends Mage_Sales_Model_Order_Pdf_Abstract
{
public function insertText($page)
$page->drawLine(25, $this->y, 570, $this->y);
$this->y -= 25;
$page->drawText(Mage::helper('sales')->__('Add here Your custom text'), 35, $this->y, 'UTF-8');
Now, you need to call this insertText() function in the getPdf() function and add this getPdf() function after insertText() function like here:
public function getPdf($invoices = array())
$this->_beforeGetPdf();
$this->_initRenderer('invoice');
$pdf = new Zend_Pdf();
$this->_setPdf($pdf);
$style = new Zend_Pdf_Style();
$this->_setFontBold($style, 10);
foreach ($invoices as $invoice)
if ($invoice->getStoreId())
Mage::app()->getLocale()->emulate($invoice->getStoreId());
Mage::app()->setCurrentStore($invoice->getStoreId());
$page = $this->newPage();
$order = $invoice->getOrder();
/* Add image */
$this->insertLogo($page, $invoice->getStore());
/* Add address */
$this->insertAddress($page, $invoice->getStore());
/* Add head */
$this->insertOrder(
$page,
$order,
Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID, $order->getStoreId())
);
/* Add document text and number */
$this->insertDocumentNumber(
$page,
Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId()
);
/* Add table */
$this->_drawHeader($page);
/* Add body */
foreach ($invoice->getAllItems() as $item)
if ($item->getOrderItem()->getParentItem())
continue;
/* Draw item */
$this->_drawItem($item, $page, $order);
$page = end($pdf->pages);
/* Add totals */
$this->insertTotals($page, $invoice);
if ($invoice->getStoreId())
Mage::app()->getLocale()->revert();
$this->insertText($page); // your custom text is added here
$this->_afterGetPdf();
return $pdf;
$this->insertText($page); that call your custom text function so you need to add before $this->_afterGetPdf(); this function.
Thank for your comment. In which config file should I add the code and what do you mean with Namespace?
– NielN98
Nov 20 '16 at 15:58
Actually you have to create your own module to override model class.So please follow this link for understand about Namespace and also how to create module : code.tutsplus.com/tutorials/…
– Sneha Panchal
Nov 21 '16 at 8:54
add a comment |
You can add specific text after total price follow the code
First override that block add this code in your config file between <global/>
:
<models>
<sales>
<rewrite>
<order_pdf_invoice>Namespace_Module_Model_Order_Pdf_Invoice</order_pdf_invoice>
</rewrite>
</sales>
</models>
Create file in app/code/local/Namespace/Module/Model/Order/Pdf/Invoice.php and add the below function at the end of the file:
<?php
class Mage_Sales_Model_Order_Pdf_Invoice extends Mage_Sales_Model_Order_Pdf_Abstract
{
public function insertText($page)
$page->drawLine(25, $this->y, 570, $this->y);
$this->y -= 25;
$page->drawText(Mage::helper('sales')->__('Add here Your custom text'), 35, $this->y, 'UTF-8');
Now, you need to call this insertText() function in the getPdf() function and add this getPdf() function after insertText() function like here:
public function getPdf($invoices = array())
$this->_beforeGetPdf();
$this->_initRenderer('invoice');
$pdf = new Zend_Pdf();
$this->_setPdf($pdf);
$style = new Zend_Pdf_Style();
$this->_setFontBold($style, 10);
foreach ($invoices as $invoice)
if ($invoice->getStoreId())
Mage::app()->getLocale()->emulate($invoice->getStoreId());
Mage::app()->setCurrentStore($invoice->getStoreId());
$page = $this->newPage();
$order = $invoice->getOrder();
/* Add image */
$this->insertLogo($page, $invoice->getStore());
/* Add address */
$this->insertAddress($page, $invoice->getStore());
/* Add head */
$this->insertOrder(
$page,
$order,
Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID, $order->getStoreId())
);
/* Add document text and number */
$this->insertDocumentNumber(
$page,
Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId()
);
/* Add table */
$this->_drawHeader($page);
/* Add body */
foreach ($invoice->getAllItems() as $item)
if ($item->getOrderItem()->getParentItem())
continue;
/* Draw item */
$this->_drawItem($item, $page, $order);
$page = end($pdf->pages);
/* Add totals */
$this->insertTotals($page, $invoice);
if ($invoice->getStoreId())
Mage::app()->getLocale()->revert();
$this->insertText($page); // your custom text is added here
$this->_afterGetPdf();
return $pdf;
$this->insertText($page); that call your custom text function so you need to add before $this->_afterGetPdf(); this function.
Thank for your comment. In which config file should I add the code and what do you mean with Namespace?
– NielN98
Nov 20 '16 at 15:58
Actually you have to create your own module to override model class.So please follow this link for understand about Namespace and also how to create module : code.tutsplus.com/tutorials/…
– Sneha Panchal
Nov 21 '16 at 8:54
add a comment |
You can add specific text after total price follow the code
First override that block add this code in your config file between <global/>
:
<models>
<sales>
<rewrite>
<order_pdf_invoice>Namespace_Module_Model_Order_Pdf_Invoice</order_pdf_invoice>
</rewrite>
</sales>
</models>
Create file in app/code/local/Namespace/Module/Model/Order/Pdf/Invoice.php and add the below function at the end of the file:
<?php
class Mage_Sales_Model_Order_Pdf_Invoice extends Mage_Sales_Model_Order_Pdf_Abstract
{
public function insertText($page)
$page->drawLine(25, $this->y, 570, $this->y);
$this->y -= 25;
$page->drawText(Mage::helper('sales')->__('Add here Your custom text'), 35, $this->y, 'UTF-8');
Now, you need to call this insertText() function in the getPdf() function and add this getPdf() function after insertText() function like here:
public function getPdf($invoices = array())
$this->_beforeGetPdf();
$this->_initRenderer('invoice');
$pdf = new Zend_Pdf();
$this->_setPdf($pdf);
$style = new Zend_Pdf_Style();
$this->_setFontBold($style, 10);
foreach ($invoices as $invoice)
if ($invoice->getStoreId())
Mage::app()->getLocale()->emulate($invoice->getStoreId());
Mage::app()->setCurrentStore($invoice->getStoreId());
$page = $this->newPage();
$order = $invoice->getOrder();
/* Add image */
$this->insertLogo($page, $invoice->getStore());
/* Add address */
$this->insertAddress($page, $invoice->getStore());
/* Add head */
$this->insertOrder(
$page,
$order,
Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID, $order->getStoreId())
);
/* Add document text and number */
$this->insertDocumentNumber(
$page,
Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId()
);
/* Add table */
$this->_drawHeader($page);
/* Add body */
foreach ($invoice->getAllItems() as $item)
if ($item->getOrderItem()->getParentItem())
continue;
/* Draw item */
$this->_drawItem($item, $page, $order);
$page = end($pdf->pages);
/* Add totals */
$this->insertTotals($page, $invoice);
if ($invoice->getStoreId())
Mage::app()->getLocale()->revert();
$this->insertText($page); // your custom text is added here
$this->_afterGetPdf();
return $pdf;
$this->insertText($page); that call your custom text function so you need to add before $this->_afterGetPdf(); this function.
You can add specific text after total price follow the code
First override that block add this code in your config file between <global/>
:
<models>
<sales>
<rewrite>
<order_pdf_invoice>Namespace_Module_Model_Order_Pdf_Invoice</order_pdf_invoice>
</rewrite>
</sales>
</models>
Create file in app/code/local/Namespace/Module/Model/Order/Pdf/Invoice.php and add the below function at the end of the file:
<?php
class Mage_Sales_Model_Order_Pdf_Invoice extends Mage_Sales_Model_Order_Pdf_Abstract
{
public function insertText($page)
$page->drawLine(25, $this->y, 570, $this->y);
$this->y -= 25;
$page->drawText(Mage::helper('sales')->__('Add here Your custom text'), 35, $this->y, 'UTF-8');
Now, you need to call this insertText() function in the getPdf() function and add this getPdf() function after insertText() function like here:
public function getPdf($invoices = array())
$this->_beforeGetPdf();
$this->_initRenderer('invoice');
$pdf = new Zend_Pdf();
$this->_setPdf($pdf);
$style = new Zend_Pdf_Style();
$this->_setFontBold($style, 10);
foreach ($invoices as $invoice)
if ($invoice->getStoreId())
Mage::app()->getLocale()->emulate($invoice->getStoreId());
Mage::app()->setCurrentStore($invoice->getStoreId());
$page = $this->newPage();
$order = $invoice->getOrder();
/* Add image */
$this->insertLogo($page, $invoice->getStore());
/* Add address */
$this->insertAddress($page, $invoice->getStore());
/* Add head */
$this->insertOrder(
$page,
$order,
Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID, $order->getStoreId())
);
/* Add document text and number */
$this->insertDocumentNumber(
$page,
Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId()
);
/* Add table */
$this->_drawHeader($page);
/* Add body */
foreach ($invoice->getAllItems() as $item)
if ($item->getOrderItem()->getParentItem())
continue;
/* Draw item */
$this->_drawItem($item, $page, $order);
$page = end($pdf->pages);
/* Add totals */
$this->insertTotals($page, $invoice);
if ($invoice->getStoreId())
Mage::app()->getLocale()->revert();
$this->insertText($page); // your custom text is added here
$this->_afterGetPdf();
return $pdf;
$this->insertText($page); that call your custom text function so you need to add before $this->_afterGetPdf(); this function.
edited Nov 14 '16 at 20:35
answered Nov 14 '16 at 19:31
Rajan SoniRajan Soni
588524
588524
Thank for your comment. In which config file should I add the code and what do you mean with Namespace?
– NielN98
Nov 20 '16 at 15:58
Actually you have to create your own module to override model class.So please follow this link for understand about Namespace and also how to create module : code.tutsplus.com/tutorials/…
– Sneha Panchal
Nov 21 '16 at 8:54
add a comment |
Thank for your comment. In which config file should I add the code and what do you mean with Namespace?
– NielN98
Nov 20 '16 at 15:58
Actually you have to create your own module to override model class.So please follow this link for understand about Namespace and also how to create module : code.tutsplus.com/tutorials/…
– Sneha Panchal
Nov 21 '16 at 8:54
Thank for your comment. In which config file should I add the code and what do you mean with Namespace?
– NielN98
Nov 20 '16 at 15:58
Thank for your comment. In which config file should I add the code and what do you mean with Namespace?
– NielN98
Nov 20 '16 at 15:58
Actually you have to create your own module to override model class.So please follow this link for understand about Namespace and also how to create module : code.tutsplus.com/tutorials/…
– Sneha Panchal
Nov 21 '16 at 8:54
Actually you have to create your own module to override model class.So please follow this link for understand about Namespace and also how to create module : code.tutsplus.com/tutorials/…
– Sneha Panchal
Nov 21 '16 at 8:54
add a comment |
I was able to add text to the invoice pdf by creating a local copy of the core directory(files/folders) app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php as app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php and added the insertText() function as stated above.
add a comment |
I was able to add text to the invoice pdf by creating a local copy of the core directory(files/folders) app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php as app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php and added the insertText() function as stated above.
add a comment |
I was able to add text to the invoice pdf by creating a local copy of the core directory(files/folders) app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php as app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php and added the insertText() function as stated above.
I was able to add text to the invoice pdf by creating a local copy of the core directory(files/folders) app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php as app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php and added the insertText() function as stated above.
answered Aug 1 '17 at 13:56
FareedFareed
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f145708%2fadd-text-to-invoice%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown