1

I need help to customize the Magento 2.x PDF invoice for Print.

  1. I want to remove the Black color from the invoice. Please check on Attached image below.

  2. I want to add product image on PDF invoice.

Could you please help me how can I make this and I am using Third party theme.

Please check Attached image below. enter image description here

2 Answers 2

0

To be honest, the PDF generation part in M2 is not as "well designed" as the other parts of the system. Because of that, you need to override a plenty of code to change different parts of an invoice. The invoice rendering process based on the coordinates pointer that goes from the beginning to the end of a page and draws the elements. So, the modifications and adjustments should be inserted into the original code in order to keep the correct pointer position. It's difficult (but possible) to calculate the exact coordinates of most of the elements because many of them have dynamic sizes (logo, etc). That's why it's hard to use plugins, observers and other flexible solutions here.

Anyway, if you are fine with that fact, here you can find the example of mine https://github.com/rogyar/M2-Invoice-PDF-Modification. The extension makes the changes mentioned in the question description. You can play with the positions, sizes. I've commented the corresponding parts of the code where you can change the positions. Hope it will help.

1
  • Everything is working fine but the module of yours not placing the image properly. Could you please take a look again. Jan 28, 2018 at 14:40
0

i am getting like that view when I create pdf of invoice

enter image description here

1
  • How we can fix the issue @Yaroslav Rogoza
    – moazzams
    Jan 28 at 10:44

Your Answer

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

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