PHP code example of baklysystems / laravel-dompdf

1. Go to this page and download the library: Download baklysystems/laravel-dompdf 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/ */

    

baklysystems / laravel-dompdf example snippets


    $pdf = App::make('dompdf.wrapper');
    $pdf->loadHTML('<h1>Test</h1>');
    return $pdf->stream();

    $pdf = PDF::loadView('pdf.invoice', $data);
    return $pdf->download('invoice.pdf');

    return PDF::loadFile(public_path().'/myfile.html')->save('/path-to/my_stored_file.pdf')->stream('download.pdf');

    PDF::loadHTML($html)->setPaper('a4', 'landscape')->setWarnings(false)->save('myfile.pdf')

    PDF::setOptions(['dpi' => 150, 'defaultFont' => 'sans-serif']);
shell
    php artisan vendor:publish --provider="Barryvdh\DomPDF\ServiceProvider"