Hola! you amazing people, I am back with a new article. In this article I will explain you how to create a PDF from a blade template with niklasravnsborg/laravel-pdf package. This package is a wrapper around **mPDF**.


You have a composer installed in your computer. If not then you should definitely do it.

Have a fresh copy of Laravel project or a working project. If you want to create a new Laravel project with composer then use the following command.

composer create-project --prefer-dist laravel/laravel blog

Step 1 - Install [Laravel PDF](https://github.com/niklasravnsborg/laravel-pdf) Package With Composer

Install the LaravelPdf package with the following command

composer require niklasravnsborg/laravel-pdf

This package is having auto discovery feature after Laravel 5.5+. If your still using the Laravel version below 5.5 then carry on with the following

Paste the following code in config/app.php

'providers' => [
	// ...

‘aliases’ => [
// …
‘PDF’ => niklasravnsborg\LaravelPdf\Facades\Pdf::class

After adding the above code run the following command. The following command create `pdf.php` in `config` folder, in this pdf.php file you can make changes to PDF package.


php artisan vendor:publish

* * *

## Step 2 - Create PDF Invoice Sample Blade Template

Following is the sample image of how it looks. Feel free to use the code and implement it in your project.

> NOTE: Use the link to copy the code from [GITHUB GIST](https://gist.github.com/channaveer/b7fe86cf2a5f144f3bf4c7af87f30328).

![PDF Invoice HTML Template Sample](https://stackcoder.in/storage/canvas/images/tHCvIl3pH9ezgH4YLOeJ2Ao9rITRcUWNcVcj1GhS.jpeg)

#laravel #php

How To Create / Save / Download PDF From Blade Template In PHP Laravel
36.20 GEEK