Package Data | |
---|---|
Maintainer Username: | donnykurnia |
Maintainer Contact: | limweb@hotmail.com (thongchai) |
Package Create Date: | 2016-04-04 |
Package Last Update: | 2019-06-25 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-02 03:03:04 |
Package Statistics | |
---|---|
Total Downloads: | 68 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
In development.
Add:
"donnykurnia/l5mpdf": "dev-master@dev",
To your composer.json
or Run:
composer require donnykurnia/l5mpdf
Then add:
'Servit\Mpdf\ServiceProvider',
To the providers
array on your config/app.php
And
'PDF' => 'Servit\Mpdf\Facades\Pdf',
To the aliases
array on yout config/app.php
in order to enable the PDF facade
$router->get('/pdf/view', function() {
$pdf = \App::make('mpdf.wrapper', [
'mode' => 'id+aCJK',
'format' => 'A4-L',
]);
$pdf->WriteHTML('<h1>Page 1</h1>');
$pdf->AddPage('P');
$pdf->WriteHTML('<h1>Page 2</h1>');
$pdf->stream();
});
$router->get('/pdf/download', function() {
$html = view('pdfs.example')->render();
return PDF::load($html)->download();
});
$router->get('/pdf/output', function() {
$html = view('pdfs.example')->render();
PDF::load($html)
->filename('/tmp/example1.pdf')
->output();
return 'PDF saved';
});
This mPDF Wrapper for Laravel5 is open-sourced software licensed under the MIT license
These default config can be overridden when creating the mpdf.wrapper
.
[
'mode' => '',
'format' => 'A4',
'defaultFontSize' => '',
'defaultFont' => '',
'marginLeft' => 10,
'marginRight' => 10,
'marginTop' => 10,
'marginBottom' => 10,
'marginHeader' => 10,
'marginFooter' => 5,
'orientation' => 'P',
]