Дописана функция
This commit is contained in:
parent
fcc2fa4afe
commit
10f252e182
32
printlib.php
32
printlib.php
@ -5,7 +5,13 @@ define("ESC", "\x1b");
|
|||||||
define("GS", "\x1d");
|
define("GS", "\x1d");
|
||||||
define("LF", "\x0a");
|
define("LF", "\x0a");
|
||||||
define("PORT", "/dev/usb/lp0");
|
define("PORT", "/dev/usb/lp0");
|
||||||
function rawlen($data) {}
|
function rawlen($data) {
|
||||||
|
if (strlen($data)<255 and strlen($data)<MAX_CHAR) {
|
||||||
|
return hex2bin(dechex(strlen($data)));
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
function initprint() {
|
function initprint() {
|
||||||
return file_put_contents(PORT, ESC . "@");
|
return file_put_contents(PORT, ESC . "@");
|
||||||
}
|
}
|
||||||
@ -18,16 +24,20 @@ function println($data) {
|
|||||||
}
|
}
|
||||||
function printcode39($data) {}
|
function printcode39($data) {}
|
||||||
function printcode128($data) {
|
function printcode128($data) {
|
||||||
$lp=fopen(PORT, 'w');
|
if (rawlen($data)) {
|
||||||
fwrite($lp, "\x1b@");
|
$lp=fopen(PORT, 'w');
|
||||||
fwrite($lp, "\x1dh\x50");
|
fwrite($lp, "\x1dh\x50");
|
||||||
fwrite($lp, "\x1dH\x02");
|
fwrite($lp, "\x1dH\x02");
|
||||||
fwrite($lp, "\x1df\x01");
|
fwrite($lp, "\x1df\x01");
|
||||||
fwrite($lp, "\x1dk\x49");
|
fwrite($lp, "\x1dk\x49");
|
||||||
fwrite($lp, rawlen($data))
|
fwrite($lp, rawlen($data));
|
||||||
fwrite($lp, $data);
|
fwrite($lp, $data);
|
||||||
fwrite($lp, "\x0a");
|
fwrite($lp, "\x0a");
|
||||||
fclose($lp);
|
fclose($lp);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function printean13($data) {}
|
function printean13($data) {}
|
||||||
function printean8($data) {}
|
function printean8($data) {}
|
||||||
|
Loading…
Reference in New Issue
Block a user