From b794822ca8ea7e9b665468a5f94766e3bdc8782c Mon Sep 17 00:00:00 2001 From: Jim Mason Date: Sun, 10 Sep 2023 18:36:29 +0100 Subject: [PATCH] made QR code scale factor configurable --- src/PDF_Label.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PDF_Label.php b/src/PDF_Label.php index 1085696..7d84a20 100644 --- a/src/PDF_Label.php +++ b/src/PDF_Label.php @@ -295,10 +295,11 @@ function verticalText($text, $x, $y, $direction = 'D') { * * @param $text content * @param $align one of 'L' (left, default), 'C' (centre), or 'R' (right) + * @param $scale scale factor (default 1.0) * @param $y offset from top (positive) or bottom (negative) (default 0) * @param $eclevel one of 'L' (low, default), 'M', 'Q', or 'H' (best) */ - function writeQRCode($text, $align = 'L', $y = 0, $eclevel = 'L') { + function writeQRCode($text, $align = 'L', $scale = 1, $y = 0, $eclevel = 'L') { $qrcode = new QRcode($text, $eclevel); $arrcode = $qrcode->getBarcodeArray(); $rows = $arrcode['num_rows'] ?? 0; @@ -308,8 +309,8 @@ function writeQRCode($text, $align = 'L', $y = 0, $eclevel = 'L') { return; } - $mw = $mh = 1; // scale factor - $hpad = $vpad = 0; // padding + $mw = $mh = $scale; // scale factor + $hpad = $vpad = 0; // padding $w = ($cols + $hpad) * ($mw / $this->k); $h = ($rows + $vpad) * ($mh / $this->k);