From 0b9e97255fbafc1c4aabea15c15c2ec09182e892 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 13 Feb 2024 22:05:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=BF=D0=B8=D1=81=D0=B0=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE=D1=82=D0=B5=D0=BA?= =?UTF-8?q?=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: root --- printlib.php | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/printlib.php b/printlib.php index e8ca441..3d87163 100644 --- a/printlib.php +++ b/printlib.php @@ -22,7 +22,22 @@ function println($data) { return false; } } -function printcode39($data) {} +function printcode39($data) { + if (rawlen($data) and rawlen($data)<8) { + $lp=fopen(PORT, 'w'); + fwrite($lp, "\x1dh\x50"); + fwrite($lp, "\x1dH\x02"); + fwrite($lp, "\x1df\x01"); + fwrite($lp, "\x1dk\x45"); + fwrite($lp, rawlen($data)); + fwrite($lp, $data); + fwrite($lp, "\x0a"); + fclose($lp); + return true; + } else { + return false; + } +} function printcode128($data) { if (rawlen($data)) { $lp=fopen(PORT, 'w'); @@ -39,6 +54,36 @@ function printcode128($data) { return false; } } -function printean13($data) {} -function printean8($data) {} +function printean13($data) { + if (rawlen($data) and (rawlen($data) == 12 or rawlen($data) == 13)) { + $lp=fopen(PORT, 'w'); + fwrite($lp, "\x1dh\x50"); + fwrite($lp, "\x1dH\x02"); + fwrite($lp, "\x1df\x01"); + fwrite($lp, "\x1dk\x43"); + fwrite($lp, rawlen($data)); + fwrite($lp, $data); + fwrite($lp, "\x0a"); + fclose($lp); + return true; + } else { + return false; + } +} +function printean8($data) { + if (rawlen($data) and (rawlen($data) == 7 or rawlen($data) == 8)) { + $lp=fopen(PORT, 'w'); + fwrite($lp, "\x1dh\x50"); + fwrite($lp, "\x1dH\x02"); + fwrite($lp, "\x1df\x01"); + fwrite($lp, "\x1dk\x44"); + fwrite($lp, rawlen($data)); + fwrite($lp, $data); + fwrite($lp, "\x0a"); + fclose($lp); + return true; + } else { + return false; + } +} ?> \ No newline at end of file