Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Pdf Laravel Package

spatie/laravel-pdf

Create PDFs in Laravel apps from Blade views using Chromium (Browsershot, chrome-php), Gotenberg, Cloudflare Browser Run, WeasyPrint, or DOMPDF. Save to disk or return as a download, with full control over page format and modern CSS.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for every "export as PDF" feature. Invoices, receipts, statements, contracts, packing slips, tickets, certificates, and recurring reports are the same underlying capability. This package turns each from a bespoke build into a configured Blade view plus a builder call, so the roadmap decision becomes "which documents, in which order" rather than "can we afford to build document rendering at all."
  • Deferring infrastructure decisions without deferring the feature. The driver abstraction (Browsershot/Chromium, Gotenberg, Cloudflare Browser Run, WeasyPrint, DOMPDF, chrome-php) lets you ship the customer-facing feature now and change the rendering backend later as a configuration concern. That decouples a product bet ("customers want downloadable invoices") from an ops bet ("how do we host headless Chromium"), which is exactly the kind of coupling PMs should be breaking.
  • Pricing and margin modeling on document-heavy features. MIT license, no per-render fee. For a product generating tens of thousands of statements per month, this materially changes unit economics versus per-document SaaS rendering APIs — enough to move a feature from "premium tier only" to "included for all plans."
  • Fidelity vs. cost trade-offs as an explicit product choice. Chromium drivers give design-grade output (flexbox, grid, webfonts) that lets design own the template; DOMPDF gives a zero-dependency, cheap path for internal or low-stakes documents. Being able to say "brand-perfect customer invoices, utilitarian internal reports" is a legitimate scope decision, not a technical compromise.
  • Compliance and archival scope. Saving to Laravel disks (S3, etc.) supports retention policies, audit trails, and "re-download my document from 2023" without storing renders in the primary database.
  • Async generation and SLA design. Generation can be queued and delivered by email or a signed URL, which sets user expectations ("your export will be emailed") and avoids request-timeout incidents on large reports.
  • Quality investment decisions. Pdf::fake() plus content assertions mean PDF templates can be regression-tested in CI like any other feature. PMs can require this as a definition-of-done for document work rather than accepting "we'll eyeball it."
  • Team throughput and onboarding. Blade-based templating reuses existing frontend skills, and the shipped Laravel Boost skill improves AI-agent code generation accuracy — a real, if modest, lever on delivery velocity.
  • Explicit non-decisions. This is a rendering library, not a document platform. It does not give you a drag-and-drop template builder for marketing, e-signature workflows, PDF form filling, merging/redaction at scale, or OCR. Those remain separate buy decisions.

When to Consider This Package

Adopt when:

  • You are on Laravel/PHP and the documents are HTML-shaped (templates, tables, headers/footers, page numbers).
  • You need modern CSS fidelity and can run Chromium or Gotenberg somewhere (containers, a sidecar service, or Cloudflare Browser Run for serverless/multi-tenant isolation).
  • You want the document feature in-app, under your own control, with no vendor contract or per-render cost.
  • You need testability in CI as a first-class requirement, not an afterthought.
  • You are comfortable with MIT/community support and a 1.x package from a well-known maintainer (Spatie; ~1k stars, documented, changelogged, actively released).

Look elsewhere when:

  • Hosting is constrained — shared hosting with no Node, Docker, or external renderer. DOMPDF will work but caps your design ambitions; verify template requirements before committing.
  • You need pixel-perfect, print-industry typography and paginated layout beyond what CSS Paged Media delivers. Evaluate WeasyPrint's driver here, and benchmark against a commercial engine before promising a design.
  • The requirement is really document operations: form filling, digital signatures/PAdES, merging, splitting, redaction, OCR, or PDF/A and accessibility (PDF/UA) tagging conformance. Those need dedicated tools, and "the PDF library can probably do it" is a trap.
  • Non-technical users must author and edit templates themselves. You would be building a template management layer the package does not provide.
  • Volume is extreme (hundreds of thousands per month) and you would rather pay a managed rendering service than own Chromium fleet capacity and memory tuning.
  • You need contractual SLAs, indemnities, or vendor support — MIT gives you none, and Spatie's paid support is not a document-rendering SLA.
  • The stack is not Laravel/PHP; there is no reason to accept the adapter overhead.

How to Pitch It (Stakeholders)

For executives: This is a small, free (MIT), well-maintained Laravel package that makes "give customers their documents as PDFs" a weeks-not-quarters feature. It removes per-document vendor fees from our unit economics, keeps customer data inside our own infrastructure, and — critically — lets us swap the rendering engine later without redoing product work, so we are not locked in. The residual risks are operational (we must host a rendering engine) and cosmetic (some PDF features are genuinely hard and may need a specialist tool). I recommend a short timeboxed spike, not a platform program.

For engineering: It is a thin, idiomatic wrapper: Pdf::view(...)->format('a4')->save(...) or return it from a controller, with first-class fakes and content assertions for tests. Choose the driver deliberately — Chromium-family for CSS fidelity, Gotenberg for a containerized render service, Cloudflare Browser Run for serverless, DOMPDF as the no-dependency fallback. Queue generation for large documents. Budget for CI dependencies (Puppeteer, pdftotext) and memory/cold-start behavior in production.

The ask: A one-to-two-day spike producing one real document (invoice or statement) end-to-end, on a chosen driver, with a template regression test — plus a decision on where the renderer will run. Everything after that is incremental scope, not new architecture.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode