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
Mpdf Bundle

Mpdf Bundle Laravel Package

sasedev/mpdf-bundle

Symfony bundle that integrates the mPDF library into your application, providing service configuration and convenient HTML-to-PDF generation for downloads, reports, and documents in Symfony projects.

View on GitHub
Deep Wiki
Context7

Mpdf Bundle for Symfony

Frequently asked questions about Mpdf Bundle
What is sasedev/mpdf-bundle used for?
sasedev/mpdf-bundle is a Symfony bundle that integrates the mPDF PHP library into Symfony applications. It provides service configuration so you can generate PDFs from HTML for downloads, reports, invoices, and other documents. It is not a Laravel package, even though the underlying mPDF library can be used in Laravel projects directly. Check the repository README for exact service names and usage examples.
How do I install sasedev/mpdf-bundle?
Install it with Composer using composer require sasedev/mpdf-bundle. Then register the bundle in your Symfony application, typically in config/bundles.php for modern Symfony apps. Clear the cache and verify that the bundle's services are available in the container. Review the README for any required configuration or environment-specific setup.
Is sasedev/mpdf-bundle compatible with Laravel?
No, sasedev/mpdf-bundle is built for Symfony, not Laravel. It relies on Symfony's bundle and service container conventions, so it will not work as a drop-in Laravel package. Laravel developers who need HTML-to-PDF should use the mPDF library directly or choose a Laravel-specific wrapper. You can still reuse mPDF configuration concepts, but not the bundle integration.
Which Symfony versions does sasedev/mpdf-bundle support?
The supported Symfony versions depend on the constraints in the package's composer.json. The repository README and Composer metadata are the authoritative sources, so check them before installing. If you are on an older or newer Symfony release, confirm compatibility with Composer's solver. Avoid assuming support for versions not listed in the constraints.
How do I configure mPDF options in this Symfony bundle?
Configuration is handled through Symfony bundle configuration and service definitions, following the options exposed by the bundle. Exact keys depend on the package version, so consult the README for the configuration reference. You can typically set mPDF options such as temp directories, fonts, and document defaults through the bundle config. After changes, clear the Symfony cache and test a small PDF generation.
How do I generate a PDF from HTML using sasedev/mpdf-bundle?
You generate a PDF by getting the bundle's mPDF service from the Symfony container and passing HTML to it. The bundle handles service configuration so you do not need to instantiate mPDF manually in every controller. Use the service to write output or return a response, depending on the API exposed by the bundle. Check the README for the exact service ID and method names for your version.
Can I download or stream generated PDFs in Symfony with this bundle?
Yes, the typical use case is generating a PDF and returning it as a Symfony response for download or inline display. You can write the mPDF output to a string or file and build a Response with the appropriate Content-Type and Content-Disposition headers. The bundle's service configuration makes this convenient in controllers. Confirm the exact response patterns in the README.
How do I test PDF generation with sasedev/mpdf-bundle?
For testing, generate PDFs from small deterministic HTML fixtures and assert that the output is a valid PDF rather than comparing binary bytes. Mock or isolate the mPDF service where appropriate, and run integration tests that boot the Symfony kernel with the bundle enabled. Check headers and file output in controller tests. Keep font and temp directory configuration stable in the test environment.
Is sasedev/mpdf-bundle suitable for production reports and invoices?
mPDF is widely used for server-side PDF generation, and this bundle can be suitable for reports and invoices if your HTML and font requirements are manageable. Watch for memory usage and rendering time on large documents, and configure temp directories and fonts correctly. Test representative documents in your production-like environment. For high-volume or complex layouts, benchmark against alternatives.
What are alternatives to sasedev/mpdf-bundle for HTML-to-PDF in PHP?
Alternatives include using mPDF directly, Dompdf, wkhtmltopdf-based tools, and headless Chrome solutions such as Puppeteer or Browsershot. In Symfony, you might also consider other PDF bundles or a dedicated PDF microservice. The best choice depends on CSS support, font needs, performance, and whether you need JavaScript rendering. For Laravel, evaluate Laravel-specific wrappers rather than this Symfony bundle.
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.
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource