1

I would like to have a line between each item purchased on the PDF invoice.

I went to Mage>Sales>Model>Order>Pdf>Items>Invoice>Default.php, made a local copy to not change the core items and added the following line after draw Tax:

/* Separator Line */
$page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
$page->setLineWidth(0.5);
$page->drawLine(380, 30, 380, 40);

But it doesn't show up. Can someone let me know how the best way to do this. Would be great, thanks

2 Answers 2

4

The code is right, below code works for me

$page->setLineColor(new Zend_Pdf_Color_GrayScale(0)); //black
$page->setLineWidth(0.5);
$page->drawLine(10, 100, 600, 100);

I think you put it in wrong position. Try to put it in different line/file, before or after, to see if it is printed.

2
  • Could you perhaps give me a gibt where too put it
    – Stefan
    Commented Jun 22, 2015 at 10:40
  • yes, try to put it in \app\code\core\Mage\Sales\Model\Order\Pdf\Invoice.php between $this->_drawItem($item, $page, $order); and $page = end($pdf->pages); (line ~144)
    – LucScu
    Commented Jun 22, 2015 at 12:45
9

Your code is drawing a small vertical line towards the bottom of the page.

Here's one way to add the lines between each item line in Mage/Sales/Model/Order/Pdf/Invoice.php:

In getPDF() after $this->_drawItem($item, $page, $order); add:

$page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
$page->setLineWidth(0.5);
$page->drawLine(25, $this->y+12.5, 570, $this->y+12.5);
2
  • Thanks Luca S and Colm. Marked Luca S as solution as he was first. I found my problem I had the fooman extension to print orders and so I had to add this to: code/community/Fooman/EmailAttachements/Model/Order/Pdf/Order.php
    – Stefan
    Commented Jun 26, 2015 at 11:09
  • 1
    this is a great solution. Commented Aug 27, 2015 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.