From fcc2fa4afe7b461e27621047c363852a7b83bb8a Mon Sep 17 00:00:00 2001 From: Artem Date: Tue, 13 Feb 2024 09:48:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA.=20code128=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=87=D0=B0=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- printlib.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/printlib.php b/printlib.php index c00e569..452da54 100644 --- a/printlib.php +++ b/printlib.php @@ -5,6 +5,7 @@ define("ESC", "\x1b"); define("GS", "\x1d"); define("LF", "\x0a"); define("PORT", "/dev/usb/lp0"); +function rawlen($data) {} function initprint() { return file_put_contents(PORT, ESC . "@"); } @@ -16,7 +17,18 @@ function println($data) { } } function printcode39($data) {} -function printcode128($data) {} +function printcode128($data) { + $lp=fopen(PORT, 'w'); + fwrite($lp, "\x1b@"); + fwrite($lp, "\x1dh\x50"); + fwrite($lp, "\x1dH\x02"); + fwrite($lp, "\x1df\x01"); + fwrite($lp, "\x1dk\x49"); + fwrite($lp, rawlen($data)) + fwrite($lp, $data); + fwrite($lp, "\x0a"); + fclose($lp); +} function printean13($data) {} function printean8($data) {} ?> \ No newline at end of file