LogoCache
in package
Prepares logos for the PDF and caches the result.
mPDF never fetches a logo itself: remote images (http and https only) are downloaded by RemoteImageFetcher from public hosts and cached as local files; other stream wrappers are refused. Logos may be local files (configuration), data URIs or such URLs.
Without PDF/A, large raster files are scaled once to the size used in the PDF; SVG must be self-contained. For PDF/A (ZUGFeRD/Factur-X), which allows neither the alpha channel mPDF would write nor mPDF's SVG output (ISO 19005-3, 6.2.2), every logo is re-encoded as RGB PNG on white: raster images are flattened, SVG is rasterised with Imagick.
Table of Contents
Methods
- __construct() : mixed
- resolve() : string|null
- A value for the renderer that can never trigger a server-side request: a local file ({@see realpath()}) for existing files, or a canonical data URI built from bytes this class has decoded and checked itself (for http(s) URLs and data URIs). Null if a remote logo cannot be downloaded. Everything else is refused.
Methods
__construct()
public
__construct(string $directory[, int $maxWidth = 600 ][, int $maxHeight = 200 ][, bool $pdfa = false ][, RemoteImageFetcher|null $fetcher = null ]) : mixed
Parameters
- $directory : string
- $maxWidth : int = 600
- $maxHeight : int = 200
- $pdfa : bool = false
- $fetcher : RemoteImageFetcher|null = null
resolve()
A value for the renderer that can never trigger a server-side request: a local file ({@see realpath()}) for existing files, or a canonical data URI built from bytes this class has decoded and checked itself (for http(s) URLs and data URIs). Null if a remote logo cannot be downloaded. Everything else is refused.
public
resolve(string|null $logo) : string|null
Parameters
- $logo : string|null