Laravel Snappy is a Laravel wrapper around the Snappy PDF/Image library, which itself is powered by wkhtmltopdf and wkhtmltoimage, allowing you to generate PDFs and images directly from HTML. It lets you take a Blade view, raw HTML string, or file and turn it into a downloadable, savable, or in-browser PDF/image response with just a few lines of code. The package integrates cleanly with the Laravel service container and offers a simple facade/API so you can quickly configure page size, orientation, margins, and other options. Because it relies on wkhtmltopdf, it supports complex HTML and CSS (including many types of fonts, layouts, and images) much better than many pure-PHP solutions. It’s commonly used for invoices, reports, tickets, labels, and any other server-side generated documents where consistent layout matters. The package is widely used in the Laravel ecosystem and has community documentation, tutorials, and integrations with other tools and CMSs based on Laravel.
Features
- Generate PDFs and images from Blade views, HTML strings, or files using wkhtmltopdf/wkhtmltoimage
- Simple facade and container integration for easy use within controllers, jobs, and services
- Flexible output options: stream inline to the browser, force download, or save to disk
- Support for detailed PDF options such as orientation, page size, margins, headers, and footers
- Works well with complex HTML and CSS layouts compared to many pure-PHP PDF libraries
- Can be integrated into existing Laravel apps for invoices, reports, tickets, or any HTML-to-PDF workflow