Keep the facade
Continue using Pdf::view(), html(), name(), save(), disk(), cache(), and saveQueued() in existing application code.
Use the familiar Spatie\LaravelPdf\Facades\Pdf workflow while BladePDF runs the Chromium layer, transfers local assets, and records production renders.
composer require bladepdf/spatie-laravel-pdf-driver
Spatie Laravel PDF gives Laravel applications a clean PDF builder and a driver architecture. The rendering driver still determines what your production environment has to operate: a local browser, a remote browser, a container service, or a PHP renderer.
The BladePDF driver registers the name bladepdf through Laravel package discovery. Spatie renders the body, header, and footer views as usual; the driver then passes that HTML through BladePDF’s asset pipeline and managed Chromium service.
Continue using Pdf::view(), html(), name(), save(), disk(), cache(), and saveQueued() in existing application code.
BladePDF uses Chromium, including JavaScript readiness expressions, printed backgrounds, custom paper sizes, margins, and page ranges.
Chrome installation, browser processes, render capacity, request isolation, and browser recovery live outside your Laravel deployment.
Install one package, add the BladePDF API key, then select the driver per PDF or make it the Spatie default.
composer require bladepdf/spatie-laravel-pdf-driver
LARAVEL_PDF_DRIVER=bladepdf
BLADEPDF_API_KEY=blpdf_...
Pdf::view('pdf.invoice', ['invoice' => $invoice])
->driver('browsershot')
->format('a4')
->save(storage_path('app/invoice.pdf'));
Pdf::view('pdf.invoice', ['invoice' => $invoice])
->driver('bladepdf')
->format('a4')
->save(storage_path('app/invoice.pdf'));
LARAVEL_PDF_DRIVER=bladepdf in a production environment, run php artisan config:cache before testing the new setting.
The PDF builder stays familiar. What changes is the rendering engine, feature envelope, and operational responsibility behind it.
Browsershot is excellent when you want direct Chrome control. Gotenberg is a strong self-hosted service boundary. DOMPDF is useful when its PHP-only rendering model covers the document design. Cloudflare can provide a remote browser platform while your application owns the surrounding workflow.
BladePDF is designed for teams that want Spatie’s application API without making the Laravel runtime responsible for browser infrastructure or the workflows around each render.
The driver maps portable Spatie options to BladePDF and leaves post-processing features in Spatie where they belong.
Body, header, and footer Blade views are compiled inside your Laravel application with the same data and directives you already use.
Local images, stylesheets, CSS imports, and fonts are discovered and attached to the render request before managed Chromium runs.
Metadata, encryption, caching, filesystem disks, and saveQueued() continue through Spatie’s existing application-side flows.
This table focuses on typical operating responsibility. Exact capabilities still depend on the selected package version, plan, and configuration.
| Capability | BladePDF driver | Browsershot | Cloudflare | Gotenberg | DOMPDF |
|---|---|---|---|---|---|
| Rendering engine | Managed Chromium | Chrome or Chromium through Node.js | Remote browser platform | Self-hosted Chromium service | PHP HTML/CSS renderer |
| Local assets | Discovered, uploaded, and rewritten automatically | Expose, embed, or configure browser access | Prepare reachable URLs or embed assets | Upload or expose assets to the service | Configure filesystem and remote access |
| JavaScript | Supported on eligible plans | Full browser control | Browser execution | Browser execution | Not a browser JavaScript runtime |
| Queue and capacity | Managed per plan | Your workers and browser processes | Your orchestration around platform limits | Your containers and application queue | Your application workers |
| Render logs | Render history, timings, asset metrics, failures | Build application and process observability | Use platform and application observability | Container logs plus application tracing | Application logs |
| PDF storage | Optional managed storage with signed URL | Your filesystem or object storage | Your filesystem or object storage | Your filesystem or object storage | Your filesystem or object storage |
| Webhooks | Signed, retried, and logged | Build in your application | Build in your application | Build in your application | Build in your application |
| Primary responsibility | BladePDF operates rendering infrastructure | You operate Chrome, Node.js, and workers | You integrate and operate the document workflow | You operate the service and its capacity | You own compatibility and app capacity |
The Spatie driver is intentionally portable. Use the native BladePDF:: facade when you need cloud templates, per-request asset overrides, stored PDFs, native async submissions, or per-request webhooks.
cache(), disk(), and queue flows.LARAVEL_PDF_DRIVER=bladepdf and rebuild Laravel’s production configuration cache. You can also select driver('bladepdf') for only one PDF.Pdf::fake()?
Pdf::fake() intercepts the builder before the rendering driver is called.Install the driver, add an API key, and switch one existing PDF first.