From 78874e04fc740841c5ed47718e97ee0876125c58 Mon Sep 17 00:00:00 2001 From: Francimar Alves Date: Mon, 21 Aug 2023 18:23:09 -0300 Subject: [PATCH] fix(qrcode): fix bematech qrcode --- src/Thermal/Profile/Bematech.php | 4 +--- tests/resources/qrcode_MP-4200_TH.bin | Bin 51 -> 48 bytes tests/resources/qrcode_bematech.bin | Bin 45 -> 42 bytes 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Thermal/Profile/Bematech.php b/src/Thermal/Profile/Bematech.php index 687bd67..598325b 100644 --- a/src/Thermal/Profile/Bematech.php +++ b/src/Thermal/Profile/Bematech.php @@ -68,7 +68,7 @@ public function qrcode($data, $size) $len = strlen($data) + 3; $pL = $len & 0xFF; $pH = ($len >> 8) & 0xFF; - + $error = 2; // N1 Error correction level 0 - L, 1 - M, 2 - Q, 3 - H $size = min(11, max(1, $size ?: 4)) * 2; // N2 - MSB; 0 = default = 4 $version = 0; // N3 - Version QRCode @@ -77,8 +77,6 @@ public function qrcode($data, $size) $this->getConnection()->write(chr($error) . chr($size) . chr($version) . chr($encoding)); $this->getConnection()->write(chr($pL) . chr($pH)); // N5 e N6 - Length $this->getConnection()->write($data); // Data - $this->getConnection()->write("\x00"); - $this->feed(1); } protected function fontChanged($new_font, $old_font) diff --git a/tests/resources/qrcode_MP-4200_TH.bin b/tests/resources/qrcode_MP-4200_TH.bin index 21ee08404bf0274210d8cc6845789655ac77a2ef..7c19f688062745be0d37463cc949fedf38bcafd3 100644 GIT binary patch delta 8 PcmXpun4rrnooE062!H|5 delta 11 ScmXpoo}kOdz{@3_XaE2VX94N} diff --git a/tests/resources/qrcode_bematech.bin b/tests/resources/qrcode_bematech.bin index 817d784ddc94256d7c2a62439a7001fa6eb339f1..ff0e0fd6b16b7e40699bca3b87bc72d08aa106c9 100644 GIT binary patch delta 4 LcmdPZnxF*$0)PP$ delta 8 PcmdPWouI|cz{>>y2K50f