API reference / Quittio \ Core \ Pdf \ Qr
QrImage
final class in quittio/core
Quittio\Core\Pdf\Qr\QrImage · Source
Renders QR codes as SVG data URIs for templates (no further dependency besides mpdf/qrcode).
Methods#
| Method | Description |
|---|---|
::dataUri() | Data URI for templates. PNG is preferred: mPDF turns SVG into form XObjects without resource dictionary, which violates PDF/A (clause 6.2.2). |
::png() | |
::svg() |
dataUri()#
public static function dataUri(
string $payload,
int $size = 400,
'L'|'M'|'Q'|'H' $errorCorrection = 'M',
bool $border = true,
): stringData URI for templates. PNG is preferred: mPDF turns SVG into form XObjects without resource dictionary, which violates PDF/A (clause 6.2.2).
| Parameter | Type | Description |
|---|---|---|
$payload | string | |
$size | int = 400 | |
$errorCorrection | 'Quittio\Core\Pdf\Qr\L'|'Quittio\Core\Pdf\Qr\M'|'Quittio\Core\Pdf\Qr\Q'|'Quittio\Core\Pdf\Qr\H' = 'M' | |
$border | bool = true | with the quiet zone of four modules |
- Returns
string
png()#
public static function png(
string $payload,
int $size = 400,
'L'|'M'|'Q'|'H' $errorCorrection = 'M',
bool $border = true,
): string| Parameter | Type | Description |
|---|---|---|
$payload | string | |
$size | int = 400 | |
$errorCorrection | 'Quittio\Core\Pdf\Qr\L'|'Quittio\Core\Pdf\Qr\M'|'Quittio\Core\Pdf\Qr\Q'|'Quittio\Core\Pdf\Qr\H' = 'M' | |
$border | bool = true | with the quiet zone of four modules |
- Returns
string
svg()#
public static function svg(
string $payload,
int $size = 200,
'L'|'M'|'Q'|'H' $errorCorrection = 'M',
bool $border = true,
): string| Parameter | Type | Description |
|---|---|---|
$payload | string | |
$size | int = 200 | |
$errorCorrection | 'Quittio\Core\Pdf\Qr\L'|'Quittio\Core\Pdf\Qr\M'|'Quittio\Core\Pdf\Qr\Q'|'Quittio\Core\Pdf\Qr\H' = 'M' | |
$border | bool = true | with the quiet zone of four modules; without it the image is the code alone, e.g. for a code printed at a fixed size such as the 46 mm of the Swiss QR bill |
- Returns
string