Package
Spatie Laravel Pdf
Create PDFs in Laravel apps
Overview
What Spatie Laravel Pdf does
Spatie's Laravel PDF package offers a straightforward way to generate PDFs within Laravel applications, integrating with several rendering drivers tailored to different requirements.
Developers often need to generate and manage PDF documents in their applications, a task that Spatie's Laravel PDF package simplifies by supporting multiple rendering options. This package can handle everything from simple HTML and CSS to more complex document layouts using drivers like Browsershot, Gotenberg, Cloudflare Browser Run, WeasyPrint, DOMPDF, and chrome-php. Each driver offers unique advantages, such as modern CSS support with Chromium-based options or a no-dependency setup with DOMPDF.
A developer uses the package by invoking its fluent API to render Blade views directly into PDF files. For instance, one can take an HTML invoice template and output it as a PDF saved locally or returned as a download response in a controller. This makes it easy to automate PDF document generation based on dynamically changing data within a Laravel application.
The package also supports testing to ensure PDF rendering behaves as expected. Developers can simulate PDF creation and assert content presence, which integrates naturally into a Laravel testing suite. Moreover, the Laravel Boost feature aids AI agents in generating accurate PDF code after installation, enhancing development workflows within the Laravel environment.
This overview was generated by AI from the package README and may not reflect the latest release.
Read the full README →