Created
October 9, 2023 07:35
-
-
Save shahali007/162b03ff5fb54065a4587f0b4d092344 to your computer and use it in GitHub Desktop.
Generate PDF using Laravel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install dependency 'https://github.com/barryvdh/laravel-dompdf' | |
| composer require barryvdh/laravel-dompdf | |
| # Add the file in providers 'config/app.php' | |
| Barryvdh\DomPDF\ServiceProvider::class, | |
| # In laravel controller use the code | |
| use PDF; | |
| public function generatePDF(){ | |
| $pdf = PDF::loadView('pdf'); | |
| return $pdf->download('sample.pdf'); | |
| } | |
| # Use the following package to see exact HTML markup | |
| # No need to import in providers | |
| composer require carlos-meneses/laravel-mpdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment