How to Add Product Images in Magento 2 Invoice PDF

How to Add Product Image in Magento 2 Invoice PDF 1

In this Digital Era, People tend to shop more online at their convenience instead of wasting time in a visit to nearest offline stores and It’s necessary for store owners to provide invoice copy for a purchase they have made. E-invoicing is very helpful for store owners in terms of providing instant invoice copies along with the digital signature, which is not only cost effective & environment-friendly but also helps to build trust among customers.

Default Magento comes with functionality of generating invoices out of the box, but majority of the time, it’s not enough for store owners and they often need the invoice to be customized. One of our Clients came up with invoice customization requirement to add product images in invoice PDF in Magento 2. Showing product name along with product image is very useful to recognize product when there is bunch of products are existed.

Quick Steps to Add Product Images in Magento 2 Invoice PDF

All you need to do is just create one Product image function in Invoice.php file available at below location.
app\code\\\Model\Magento\Sales\Order\Pdf\invoice.php


Happy Coding!
Previous Article

How to Define Custom Form Validation in Magento

Next Article

Spooktacular Halloween Discounts on Magento Extensions

Write a Comment
  1. i have tried this . everything is working fine but the image that is showing is inverted.

    1. Confirm that you implemented code properly and product images are uploaded correctly.

  2. i have tried this . everything is working fine but the image that is showing is inverted.

  3. David Alves

    Hi, in a few invoices, there is an error when I send to print:
    ImageType is not a JPG

    Could you please help me?

    1. Kindly check the product images in which you are facing the issue. And if it some another images extension then you need to make changes into the above code, so they allowed to print that things here.

  4. kunal sharma

    how to show image for bundle product. As this code is only working for simple product. Thanks in advance.

Leave a Comment

Your email address will not be published. Required fields are marked *

Get Connect With Us

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨