Back to Top

How to generate simple pdf invoice using FPDF library

Updated 21 November 2016

Today we will learn about generating the invoice in PDF using FPDF library. FPDF provides the PHP classes to generate PDF. It may be useful for generate the invoice in pdf, download product description in PDF etc for e-commerce websites.

First we download the FPDF zip file from the http://www.fpdf.org/ and upload it on server at root directory.

Then set the PDF generator button at your page as per your requirement. In this case we set the invoice button at order history information for particular order to generate invoice for particular order.

image1

 

Searching for an experienced
Opencart Company ?
Find out More

Then after getting the order details we added the PDF generator code in invoice controller by including the FPDF class file and using it’s function.

 

image2

Then for iterating the products and total of the order we can iterate the cell of document.

image3

Output will be :

iamge4

. . .

Leave a Comment

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


3 comments

  • Tapan Bhanot
    • Webkul Support
  • Christoph Marker
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home