API reference / Quittio \ Core \ Pdf \ Renderers
FagusRenderer
final class in quittio/core · implements PdfRenderer
Quittio\Core\Pdf\Renderers\FagusRenderer · Source
Optional renderer: HTML/CSS to PDF/A-3b with Fagus (package nforst/fagus), an engine for CSS Paged Media that runs as a binary next to PHP.
Templates stay written for mPDF: their mPDF markup (page headers and footers, page breaks,
named pages, positioned elements, watermark, carry-over rows) is translated into standard CSS
before rendering (MpdfMarkupConverter). The fonts are the same as for MpdfRenderer:
the mPDF family names (geist, geistmedium, inter, liberationsans and those of $fonts) map to
the font files. PDF/A, the embedded XML and its Factur-X metadata are written by Fagus.
Like mPDF, Fagus never loads anything over the network. It reads no files by itself either: only images that the HTML names by a local path (the logo prepared by LogoCache) are handed over, and only if they are images.
Methods#
| Method | Description |
|---|---|
->__construct() | |
->render() | Renders the HTML with Fagus and returns the PDF; with $request->pdfa as PDF/A-3b, with the embedded XML as ZUGFeRD/Factur-X (PDF/A-3b, the profile from the conformance level). Throws a PdfException when Fagus fails. |
->supportsEmbedding() |
__construct()#
public function __construct(
array<string, array<string, string>> $fonts = [],
list<string> $fontDirectories = [],
string $defaultFont = 'geist',
?string $binary = null,
float $timeout = 60.0,
)| Parameter | Type | Description |
|---|---|---|
$fonts | array<string, array<string, string>> = [] | additional fonts: family => [R => file, B => file, I => file, BI => file] |
$fontDirectories | list<string> = [] | searched first, before the bundled Geist, Inter and Liberation Sans; directories that do not exist are skipped |
$defaultFont | string = 'geist' | |
$binary | ?string = null | path of the fagus binary; null = FAGUS_BINARY, the binary installed with the package or fagus on the PATH |
$timeout | float = 60.0 | seconds to wait for each answer of the Fagus worker |
render()#
public function render(RenderRequest $request): stringRenders the HTML with Fagus and returns the PDF; with $request->pdfa as PDF/A-3b, with the embedded XML as ZUGFeRD/Factur-X (PDF/A-3b, the profile from the conformance level). Throws a PdfException when Fagus fails.
| Parameter | Type | Description |
|---|---|---|
$request | RenderRequest |
- Returns
string
supportsEmbedding()#
public function supportsEmbedding(): bool- Returns
bool