Download the PHP package pontedilana/weasyprint-bundle without Composer
On this page you can find all versions of the php package pontedilana/weasyprint-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pontedilana/weasyprint-bundle
More information about pontedilana/weasyprint-bundle
Files in pontedilana/weasyprint-bundle
Package weasyprint-bundle
Short Description Easily create PDF in Symfony by converting Twig/HTML templates.
License MIT
Informations about the package weasyprint-bundle
WeasyPrintBundle
PhpWeasyPrint is a PHP (7.4+) wrapper for WeasyPrint PDF generator. It allows you to generate PDF files from HTML string or URL.
The WeasyPrintBundle provides a simple integration for your Symfony project.
This bundle is massively inspired by KnpLabs/KnpSnappyBundle, of which it aims to be a one-to-one substitute
Installation
With composer, require:
composer require pontedilana/weasyprint-bundle
Then enable it in your kernel (a flex recipe is coming soon):
Configuration
If you need to change the binaries, change the instance options or even disable one or both services, you can do it through the configuration.
Note: prefer an absolute path for
binary(e.g./usr/local/bin/weasyprint). Since php-weasyprint 2.5.1 the binary is verified withis_executable()before being run, and a bare command name likeweasyprintis not resolved against thePATH. If you do leave a bare name, the bundle resolves it through thePATHfor you (via Symfony'sExecutableFinder), but an absolute path is faster and unambiguous.
If you want to change temporary folder which is by default, you can use
You can also configure the timeout used by the generators with process_timeout:
Set it to false to disable the timeout entirely (useful when WeasyPrint runs inside a worker or queue that already manages timeouts):
To restrict the URL schemes allowed in options that accept URLs (a defense against SSRF and local file disclosure), use allowed_schemes. When omitted, php-weasyprint applies its own default (['http', 'https']). Requires php-weasyprint 2.6+.
Usage
The bundle registers one service:
- the
weasyprint.pdfservice allows you to generate pdf files.
Generate a PDF document from a URL
Generate a PDF document from a twig view
Render a PDF document as a response from a controller
Note: Filenames with accented characters (e.g., invoice_àèìòù.pdf) are automatically supported. The bundle generates an ASCII-safe fallback for older browsers while preserving the original UTF-8 filename for modern browsers (following RFC 6266).
Render a PDF document with a relative url inside like CSS files or images
Credits
WeasyPrintBundle and PhpWeasyPrint have been developed by Pontedilana.
SnappyBundle has been developed by KnpLabs.
All versions of weasyprint-bundle with dependencies
pontedilana/php-weasyprint Version ^2.0
symfony/config Version ^6.4 || ^7.4 || ^8.0
symfony/dependency-injection Version ^6.4 || ^7.4 || ^8.0
symfony/http-foundation Version ^6.4.41 || ^7.4.13 || ^8.0.13
symfony/http-kernel Version ^6.4 || ^7.4.12 || ^8.0.12
symfony/process Version ^6.4.33 || ^7.4.5 || ^8.0.5
symfony/string Version ^6.4 || ^7.4 || ^8.0