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

use Jouda\EasyLaravelPdf\Facades\EasyLaravelPdf;
$pdf = EasyLaravelPdf::setOptions(['format' => 'A4']);
$pdf->setPuppeteerLunchArgs(['--no-sandbox', '--disable-setuid-sandbox']);
$pdf->loadHtml('<h1>Customized PDF</h1>');
$pdf->save('path/to/your/customized.pdf');
bash
   php artisan vendor:publish --tag=pdf-config