Table of Contents
Laravel is a powerful web application framework built in PHP that cando anything beyond your imagination. Today I have written a tutorial on how you can generate a pdf invoice in your laravel application. Well, in lots of websites like ecommerce, it's required to make a systemof downloading invoice(bill) in pdfformat.We will be using a package called 'laravel-dompdf' .This is the package url on github
Steps:
1) Install this Package
execute below command to install this package
After updating composer, add the ServiceProvider to the providers array in config/app.php
You can optionally use the facade for shorter code. Add this to your facades:
2) Put inside routes file routes/web.php
inside admin middleware
3) Put below function inside OrderController.php of App\Http|Controllers\Admin
also inject
4) Now create Invoice template 'invoice_template.blade.php' inside resources/views/includes
and put below inside this file
5) Add below inside config/app.php for other global settings
We have done everything for this. Now click this download button to test the invoice pdf.
In this way you can create a download pdf invoicelaravel , for more tutorials on laravel, visit our laravel tutorial blog section.
I am a website developer having 12+ years experience. If you have any query, you can put this in the comment section below. I will try my best to reply soon.You can also visit our website www.unitedwebsoft.in for website designing development related requirements.