Skip to content

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#

MethodDescription
::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,
): string

static

Data URI for templates. PNG is preferred: mPDF turns SVG into form XObjects without resource dictionary, which violates PDF/A (clause 6.2.2).

ParameterTypeDescription
$payloadstring
$sizeint = 400
$errorCorrection'Quittio\Core\Pdf\Qr\L'|'Quittio\Core\Pdf\Qr\M'|'Quittio\Core\Pdf\Qr\Q'|'Quittio\Core\Pdf\Qr\H' = 'M'
$borderbool = truewith 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

static

ParameterTypeDescription
$payloadstring
$sizeint = 400
$errorCorrection'Quittio\Core\Pdf\Qr\L'|'Quittio\Core\Pdf\Qr\M'|'Quittio\Core\Pdf\Qr\Q'|'Quittio\Core\Pdf\Qr\H' = 'M'
$borderbool = truewith 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

static

ParameterTypeDescription
$payloadstring
$sizeint = 200
$errorCorrection'Quittio\Core\Pdf\Qr\L'|'Quittio\Core\Pdf\Qr\M'|'Quittio\Core\Pdf\Qr\Q'|'Quittio\Core\Pdf\Qr\H' = 'M'
$borderbool = truewith 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

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.