How to generate PDF in Laravel using anouar/fpdf

This tutorial is guide step by step procedure to generate PDF using anouar/fpdf  You can find the this package on packagist https://packagist.org/packages/anouar/fpdf

Steps:

  • Install package using composer in your project directory
  • Add service provider in app/config/app.php
  • Finally, add aliases in app/config/app.php
  • Now, Add your route
  • Serve the application

Now follow these steps:

For installation of package you can use this command:

 

Add the service provider in place:

 

Add the aliases in you app configuration:

 

Run the command if you have any error regarding class not found etc…

Now place the example code your route named pdf in  web.php:

 

Now, serve your project:

 

Check the output on localhost:80/pdf.

Hope its help you 🙂

News Reporter
Web Application Developer, Love to code clean, transparent, documented, reusable, secure and maintainable.