nti/pdfjs-bundle
nti/pdfjs-bundle integrates Mozilla's PDF.js into Symfony apps, adding a controller, route and Twig helper to display PDF documents in the browser with no plugins or external viewers required. Configurable viewer options let you control toolbar, zoom and rendering behavior per file.
<iframe>/<embed> — zero dependencies, zero cost; (b) raw PDF.js via npm/CDN — full control, no wrapper; (c) a commercial viewer (PSPDFKit, Apryse) if you need annotations, forms, e-signatures, or DRM; (d) this bundle — only if you are on Symfony and want the asset-serving plumbing done for you.Consider it only when all of the following hold:
Content-Disposition, cache headers, MIME sniffing).Look elsewhere when:
pdfjs-dist via npm and a Vite entry; fewer moving parts than a Symfony bundle port.For executives: "There's a free, open-source way to display PDFs inside the app instead of paying per-seat licensing to a document vendor. It's a very small, essentially unmaintained Symfony wrapper around Mozilla's PDF.js — the same engine Firefox uses. Code risk is low; maintenance risk is real, so we would fork it rather than depend on it. My recommendation is to prototype with the browser's built-in PDF viewer first, and only fall back to PDF.js if we need consistent rendering or text search across browsers."
For engineering: "It's Symfony, not Laravel — in our stack we'd use pdfjs-dist directly through npm and a Vite entry rather than port a bundle. If we do adopt the bundle, pin the PDF.js version, serve the worker and viewer assets ourselves, set a strict CSP with worker-src and object-src allowances, and review the asset route for path traversal before it touches production."
Recommendation: do not add as a dependency today. Prototype with browser-native PDF viewing; escalate to raw PDF.js only if a concrete requirement (cross-browser consistency, text-layer search, controlled UI) justifies it. Revisit the bundle only if we standardize on Symfony and need an offline-capable asset path.
How can I help you explore Laravel packages today?