Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/praem90/laravel-mpdf
mPDF wrapper for laravel inspired by laravel-dompdf
https://github.com/praem90/laravel-mpdf
laravel-5-package laravel5 mpdf pdf
Last synced: 3 months ago
JSON representation
mPDF wrapper for laravel inspired by laravel-dompdf
- Host: GitHub
- URL: https://github.com/praem90/laravel-mpdf
- Owner: praem90
- License: mit
- Created: 2017-06-21T17:22:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-03T08:31:10.000Z (about 5 years ago)
- Last Synced: 2024-09-28T20:04:52.238Z (3 months ago)
- Topics: laravel-5-package, laravel5, mpdf, pdf
- Language: PHP
- Size: 12.7 KB
- Stars: 1
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
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 praem90/laravel-mpdf
```## Installation
### Laravel 5.x
After updating composer, add the ServiceProvider to the providers array in config/app.phpPraem90\PDF\ServiceProvider::class,
You can optionally use the facade for shorter code. Add this to your facades:
'PDF' => Praem90\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); // or
$path = storage_path('app/invoices/invoice.pdf');
$pdf->save($path);
```
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);
```