Download the PHP package utafitilabs/pdf-scribe-bundle without Composer
On this page you can find all versions of the php package utafitilabs/pdf-scribe-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download utafitilabs/pdf-scribe-bundle
More information about utafitilabs/pdf-scribe-bundle
Files in utafitilabs/pdf-scribe-bundle
Package pdf-scribe-bundle
Short Description HTML-to-PDF for Symfony with headless Chrome/Chromium: modern CSS rendering, @page control, one service to inject.
License MIT
Informations about the package pdf-scribe-bundle
Headless Chrome PDFs for Symfony!
This bundle turns HTML or a URL into a PDF with headless Chrome/Chromium — the
same rendering engine your templates were written for, so modern CSS, web fonts and
@page rules print exactly as they display. One injectable PdfGeneratorInterface,
bytes back or a file on disk, sensible defaults. Enable the bundle, point it at a
browser, and go.
Part of the utafiti tools.
Why
PHP-native PDF libraries render a subset of CSS and fall over on flexbox, grid or
@font-face; wiring a browser by hand means a process call, temp files, timeouts and
cleanup in every project. This bundle handles all of it: render a Twig template as you
already do, hand the HTML over, get a PDF.
Install
Applications using Symfony Flex:
Applications without Symfony Flex — after requiring the package, enable the bundle:
That one line registers the PdfGeneratorService and aliases it to
PdfGeneratorInterface, with a 120 s timeout and background printing on. Nothing
else to configure — unless your browser lives somewhere other than the default macOS
path, in which case name it:
A taste
Methods: fromHtml, fromUrl (return the PDF bytes), saveFromHtml, saveFromUrl
(write to a path). Per-call options override the configured defaults:
print-background (bool), no-pdf-header-footer (bool), landscape (bool),
scale (float, 0.1–2.0), virtual-time-budget (ms, lets page scripts finish
before printing). Page size and margins are CSS, in your template:
Every failure — missing or non-executable binary, non-zero exit, no output file —
raises PdfGenerationException with the reason in the message.
Documentation
Read the documentation at docs/index.md.
Requirements
- PHP 8.4+ · Symfony 7.3+ / 8
- A Chrome or Chromium binary on the host (
google-chrome,chromium,chromium-browser, or the macOS app bundle); the bundle shells out to it with--headless.
Contributing
See CONTRIBUTING.md. CI enforces the standard (php-cs-fixer, PHPStan max, PHPUnit driving a stand-in browser binary, lowest→newest dependency matrix) on every pull request.
Credits
License
MIT License (MIT): see the LICENSE file for more details.
All versions of pdf-scribe-bundle with dependencies
symfony/config Version ^7.3 || ^8.0
symfony/dependency-injection Version ^7.3 || ^8.0
symfony/http-kernel Version ^7.3 || ^8.0
symfony/process Version ^7.3 || ^8.0