Managed PDF infrastructure for Laravel
BladePDF renders production-ready PDFs from your existing Blade views without making your Laravel deployment responsible for Chromium, Node.js, Docker, browser workers, or publicly reachable assets.
These docs lead with bladepdf/laravel:^2.0. Other backend applications use the same rendering, asset, background, delivery, error, and webhook behavior through bladepdf/php:^1.0 or server-side @bladepdf/node:^1.0.
Why BladePDF exists
Most Laravel developers do not actually want to operate Chromium. They need reliable invoices, reports, labels, and exports. A browser that is easy to launch locally becomes a production system that needs installation, security updates, memory limits, crash recovery, queues, scaling, monitoring, and an asset path the renderer can reach.
BladePDF moves that rendering layer out of your application infrastructure. Your app keeps preparing data and rendering Blade; BladePDF manages the isolated browser work, transfers referenced local assets, records the result, and can store or deliver the finished PDF asynchronously.
Owns business data, Blade views, document options, and the final response or workflow.
Owns Chromium, request-scoped assets, render isolation, queue capacity, logs, optional storage, and signed webhooks.
Choose self-hosting when offline rendering, strict data locality, or low-level browser control matters more than operational simplicity. BladePDF is a hosted service and requires network access and an API key.
fromView() renders a local Laravel view firstfromHtml() sends raw HTML directlyfromTemplate() renders a cloud Blade template with JSON contextWhat the managed service includes
BladePDF gives your application a fluent rendering API and a dashboard for managing templates, reusable assets, render history, stored PDFs, and signed webhook delivery.
Choose where the document content comes from, pass the data needed to render it, configure the PDF options, and decide how the result should be returned or stored.
Use the BladePDF:: facade in routes, controllers, queued jobs, or services.
Publish templates and assets from the dashboard, then render them by id.
Control paper size, margins, orientation, backgrounds, page ranges, and waiting behavior.
Review status, timings, logs, asset metrics, and webhook deliveries from the dashboard.
Choose a source
| Method | Best for | Where Blade runs |
|---|---|---|
BladePDF::fromView() |
Existing Laravel views, invoices, labels, internal reports | Your Laravel app |
BladePDF::fromHtml() |
Already-rendered HTML strings, generated snippets, tests | Nowhere; HTML is already final |
BladePDF::fromTemplate() |
Cloud-managed templates that developers can publish in the dashboard | BladePDF |
One render contract
Once you choose a source, the rest of the API stays the same. You can set metadata, PDF options, request-scoped asset overrides, persistence, and then call render() or async().
1BladePDF::fromView('pdf.invoice', ['invoice' => $invoice]);
2
3BladePDF::fromHtml($html);
4
5BladePDF::fromTemplate('invoice.standard', [
6 'invoice' => $invoice->toArray(),
7]);
All three can continue with the same document options:
1return BladePDF::fromTemplate('invoice.standard', $context)
2 ->reference($invoice->uuid)
3 ->format('A4')
4 ->margins(top: '16mm', right: '12mm', bottom: '18mm', left: '12mm')
5 ->showBackground()
6 ->storePdf()
7 ->render()
8 ->download("invoice-{$invoice->number}.pdf");
Basic example
The public Laravel API is intentionally small: pick the source, set metadata/options, then call render() and use the returned result.
1use BladePDF\Laravel\Facades\BladePDF;
2
3Route::get('/invoices/{invoice}/pdf', function (Invoice $invoice) {
4 return BladePDF::fromView('pdf.invoice', [
5 'invoice' => $invoice,
6 ])
7 ->reference($invoice->uuid)
8 ->format('A4')
9 ->showBackground()
10 ->render()
11 ->download("invoice-{$invoice->number}.pdf");
12});
Cloud templates
Cloud templates let you update document markup from the dashboard without deploying your Laravel app. Your application sends the template id and a JSON object used as context.
1return BladePDF::fromTemplate('invoice.standard', [
2 'invoice' => $invoice->toArray(),
3 'customer' => $invoice->customer->toArray(),
4])
5 ->reference($invoice->uuid)
6 ->storePdf()
7 ->render()
8 ->response('invoice.pdf');
What happens after a request
storePdf().Core concepts
| Concept | Use it for |
|---|---|
context |
Structured data passed to fromTemplate() and used by the cloud Blade template. |
metadata |
User-facing render labels such as reference and, for HTML/view renders, template_name. |
asset:///... |
Assets stored in the dashboard, with optional request-level overrides. |
storePdf() |
Persist the generated PDF in BladePDF while still returning it to your app. |