Categories: How ToMagento 2

How to Add Product Images in Magento 2 Invoice PDF

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!
Click to rate this post!
[Total: 24 Average: 3.5]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate 🎖️ Certified Magento Developer👨‍💻. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.🏏

View Comments

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

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

    Could you please help me?

    • 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.

Recent Posts

How to Integrate ChatGPT with Laravel Application?

In this guide, we'll explore how to integrate ChatGPT, an AI-powered chatbot, with a Laravel…

3 days ago

What are Net Sales? How to Calculate Your Net Sales?

In the world of business, understanding financial metrics is crucial for making informed decisions and…

5 days ago

Magento 2 Extensions Digest April 2024 (New Release & Updates)

Welcome to the MageComp Monthly Digest, where we bring you the latest updates, releases, and…

5 days ago

The ABCs of Geofencing: Definition, Features and Uses

In this era, businesses are always on the lookout for ways to engage with their…

6 days ago

How to Delete Product Variant in a Shopify Remix App using GraphQL Mutations?

Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…

7 days ago

6 Innovative Tools Revolutionizing E-Commerce Operations

E-commerce has transformed the way consumers shop for products and services and interact with businesses.…

1 week ago