PHP code example of hamdallah90 / easy-laravel-pdf
1. Go to this page and download the library: Download hamdallah90/easy-laravel-pdf library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hamdallah90 / easy-laravel-pdf example snippets
use Jouda\EasyLaravelPdf\Facades\EasyLaravelPdf;
$pdf = EasyLaravelPdf::loadView('view.name', ['dataKey' => 'dataValue']);
return $pdf->stream('example.pdf');
use Jouda\EasyLaravelPdf\Facades\EasyLaravelPdf;
EasyLaravelPdf::loadView('view.name', ['dataKey' => 'dataValue'])->save('/path/to/file.pdf');
use Jouda\EasyLaravelPdf\Facades\EasyLaravelPdf;
$file = EasyLaravelPdf::loadHtml('<h1>Test PDF</h1>')->getFile();
$file->store('save-to-s3-or-local-path')
use Jouda\EasyLaravelPdf\Facades\EasyLaravelPdf;
return EasyLaravelPdf::loadHtml('<h1>Test PDF</h1>')->stream('optional-filename.pdf'); // Streams the PDF; if a filename is provided, it will be used