Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/willmav5000/laravel-mpdf
mPDF wrapper for laravel inspired by laravel-dompdf
https://github.com/willmav5000/laravel-mpdf
laravel laravel-5-package laravel-framework laravel-package mpdf pdf pdf-generation
Last synced: 1 day ago
JSON representation
mPDF wrapper for laravel inspired by laravel-dompdf
- Host: GitHub
- URL: https://github.com/willmav5000/laravel-mpdf
- Owner: willmav5000
- License: mit
- Fork: true (praem90/laravel-mpdf)
- Created: 2018-10-09T15:01:54.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-09T15:34:46.000Z (almost 6 years ago)
- Last Synced: 2024-09-21T14:06:58.262Z (6 days ago)
- Topics: laravel, laravel-5-package, laravel-framework, laravel-package, mpdf, pdf, pdf-generation
- Language: PHP
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# mPDF wrapper for laravel inspired by [laravel-dompdf](https://github.com/barryvdh/laravel-dompdf)
Require this package in your composer.json and update composer.
```
composer require willmav5000/laravel-mpdf
```## Installation
### Laravel 5.x
After updating composer, add the ServiceProvider to the providers array in config/app.phpWillmav5000\PDF\ServiceProvider::class,
You can optionally use the facade for shorter code. Add this to your facades:
'PDF' => Willmav5000\PDF\Facade::class,
## Using
Use 'PDF' Facade to interact with mPdf object
```
$pdf = PDF::loadView('pdf.invoice', $data); // or PDF::loadHtml($html);
return $pdf->download($filename); // or
return $pdf->stream($filename);
```
You can access all the available mPDF methods directly by the same facade.
eg.,
```
$pdf->setColumns(2);
$pdf->loadView($blade_path1, $data1); // or $pdf->loadHtml($html) or $pdf->WriteHTML('html)
$pdf->addColumn();
$pdf->loadView($blade_path2, $data2);
```