barryvdh/laravel-dompdf
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
dompdf/dompdf | v2.0.8 | - | LGPL-2.1 | prod | 3 1 |
illuminate/support | v10.48.10 | - | MIT | prod |
The barryvdh/laravel-dompdf is a Laravel wrapper for the Dompdf HTML to PDF Converter. It allows you to seamlessly convert your HTML content to PDF format within your Laravel applications. Whether you're looking to convert HTML strings, files, or even views, this package has you covered.
To begin using the barryvdh/laravel-dompdf package, you first need to include it in your project by running the command composer require barryvdh/laravel-dompdf
.
For Laravel, after completing the installation, use the package in your code by invoking a new DOMPDF instance and loading your HTML content. Here's an example:
use Barryvdh\DomPDF\Facade\Pdf;
$pdf = Pdf::loadView('pdf.invoice', $data);
return $pdf->download('invoice.pdf');
For Lumen, after updating composer add the following lines to register provider in bootstrap/app.php
$app->register(\Barryvdh\DomPDF\ServiceProvider::class);
// To change the configuration, copy the config file to your config folder
$app->configure('dompdf');
You could also use the App container to generate a PDF from an HTML string, like so:
$pdf = App::make('dompdf.wrapper');
$pdf->loadHTML('<h1>Test</h1>');
return $pdf->stream();
In addition to these, You can also save, stream, or download the converted PDF, change the paper size, orientation and more.
The detailed documentation of barryvdh/laravel-dompdf is provided directly inside the README of the GitHub repository at https://github.com/barryvdh/laravel-dompdf.git. It includes information on installation, usage, and configuration, also providing useful examples and tips. For additional configurations and options, check the config/dompdf.php
file in your application, which will be created after running php artisan vendor:publish --provider="Barryvdh\DomPDF\ServiceProvider"
.