2 новые функции
This commit is contained in:
parent
8480dd070c
commit
717813f650
35
printlib.php
35
printlib.php
@ -90,4 +90,39 @@ function printean8($data) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function rawdlen($data) {
|
||||||
|
$len = strlen($data);
|
||||||
|
$l = ($len + 3) % 256;
|
||||||
|
$h = intdiv($len / 256);
|
||||||
|
if ($l<16) {
|
||||||
|
$l=hex2bin("0" . dechex($l));
|
||||||
|
} else {
|
||||||
|
$l=hex2bin(dechex($l));
|
||||||
|
}
|
||||||
|
if ($h<16) {
|
||||||
|
$h=hex2bin("0" . dechex($h));
|
||||||
|
} else {
|
||||||
|
$h=hex2bin(dechex($h));
|
||||||
|
}
|
||||||
|
return $l . $h;
|
||||||
|
}
|
||||||
|
function printqr($data, $size) {
|
||||||
|
if (strlen($data)<7088) {
|
||||||
|
if ($size<16) {
|
||||||
|
$encs=hex2bin("0" . dechex($size));
|
||||||
|
} else {
|
||||||
|
$encs=hex2bin(dechex($size));
|
||||||
|
}
|
||||||
|
$lp=fopen("/dev/usb/lp0", 'w');
|
||||||
|
fwrite($lp, GS . "(k\x04\x00\x31\x41\x32\x00");
|
||||||
|
fwrite($lp, GS . "(k\x03\x00\x31\x43" . $encs);
|
||||||
|
fwrite($lp, GS . "(k\x03\x00\x31\x45\x30");
|
||||||
|
fwrite($lp, GS . "(k" . rawdlen($data) . "\x31\x50\x30" . $data);
|
||||||
|
fwrite($lp, GS . "(k\x03\x00\x31\x51\x30");
|
||||||
|
#fwrite($lp, "\x0a");
|
||||||
|
fclose($lp);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user