- Is steamulo/pdfjs-viewer-bundle compatible with Laravel?
- No. It is a Symfony 4 bundle that registers Twig templates and Symfony asset configuration, and it does not ship a Laravel service provider, Blade views, or Laravel-style config publishing. Laravel's container and view layer will not consume its Bundle or DI extension classes. For Laravel you should use pdfjs-dist directly or port only the viewer parameter model into a Blade component.
- How do I install steamulo/pdfjs-viewer-bundle?
- Install it with Composer in a Symfony application, register the bundle in config/bundles.php, and configure viewer options through the bundle's Symfony configuration. It is not a Laravel package, so Composer auto-discovery will not wire it into a Laravel app. In Laravel you would have to fork it into a service provider and Blade views, which is usually more work than vendoring pdfjs-dist.
- What Laravel versions does this package support?
- None. The package targets Symfony 4 and relies on Twig and Symfony's bundle and asset pipeline, with PHP constraints aligned to its January 2023 release era. There is no published compatibility matrix for Laravel or modern PHP and Symfony versions. Treat it as a Symfony-only dependency, not a Laravel package.
- Can I use this Symfony bundle in a Laravel Blade app?
- Not without a port. You would need to reimplement its configuration schema in a Laravel service provider, replace Twig with Blade, and reconcile Symfony asset assumptions with Vite or Laravel Mix. The bundle's functional surface is small, so the realistic path is to copy the parameter model and write a Blade partial around pdfjs-dist. That is roughly one to two engineer-days either way.
- How do I configure PDF.js viewer options like default zoom, page, or theme?
- In the original bundle, viewer defaults are server-side parameters injected into a Twig template, covering things like zoom, page, theme, and locale. For Laravel, put those defaults in config/pdfjs.php and inject them into a Blade partial or via a view composer. Keep the values in client-side JSON if server-side control is not a product requirement.
- What is the best Laravel alternative for displaying PDFs with PDF.js?
- Use the official pdfjs-dist npm package with a Blade partial that mounts the viewer. Serve the viewer assets through Vite, set a long-lived cache header, and expose defaults through config/pdfjs.php. This gives you the same presentation-layer convenience on a supported platform with a pdf.js build you can patch.
- Is steamulo/pdfjs-viewer-bundle maintained and safe for production?
- It shows high technical risk: Symfony 4 reached end of life in November 2023, the last release was January 2023, and the project has zero stars, zero dependents, and a single maintainer. The vendored pdf.js build may be several major versions behind, and pdf.js has a history of security-relevant parser fixes. For authenticated or customer-facing PDFs, avoid an unpatched viewer and use current pdfjs-dist instead.
- Does this package work with Vite or Laravel Mix?
- No. It assumes Symfony's asset pipeline, such as Webpack Encore or Assetic, and registers assets through the bundle. Laravel's Vite or Mix setup will not consume those registrations. You would need to extract the viewer shell and serve it yourself through Vite.
- Do I need Twig to use this package?
- Yes. The bundle's ready-to-use component is a Twig template, and its integration depends on Symfony's Twig namespace and bundle configuration. Laravel uses Blade, so the template cannot be dropped in as-is. Porting means rewriting the viewer shell as a Blade partial.
- How do I test PDF.js rendering in Laravel if I port this package?
- The original bundle ships no Laravel testing helpers or Blade assertions. In a Laravel port you would test the config-to-view injection with a feature test asserting the viewer defaults appear in the rendered HTML, and test asset URLs against Vite's manifest. For client-side behavior, use a browser test such as Dusk or Playwright against a fixture PDF.