Skip to content

Instantly share code, notes, and snippets.

View lite1979's full-sized avatar

Lite lite1979

  • QZ Industries, LLC
  • Buffalo, NY 14216
View GitHub Profile
public class ThermalTest {
public static void main(String[] args) throws Exception {
//print directly
new VectorPrintable();
//print via pdfbox
new PdfboxPrintable();
}
function printESCP() {
var config = qz.configs.create("Epson-TM-BA-Thermal");
var data = [{
type: 'html',
format: 'plain', // or 'plain' if the data is raw HTML
data: ' <html><header><title>This is the title</title></header><body>Hello world</body></html>'
}];
qz.print(config, data)
.then(function() {
My function:
var data = 'http://192.168.1.8/demo/assets/serialURLtest.txt';
function sendSerialData(){
var properties = {
baudRate: 9600,
dataBits: 7, // <--- Changed from 8
stopBits: 1,
parity: 'EVEN', // <--- Changed from NONE
flowControl: 'NONE'
My function:
var data = 'W\n';
function sendSerialData(){
var properties = {
baudRate: 9600,
dataBits: 7, // <--- Changed from 8
stopBits: 1,
parity: 'EVEN', // <--- Changed from NONE
flowControl: 'NONE'
/// Authentication setup ///
qz.security.setCertificatePromise(function(resolve, reject) {
//Preferred method - from server
$.ajax("../Scripts/qz/assets/signing/digital-certificate.txt?2018").then(resolve, reject);
});
qz.security.setSignaturePromise(function(toSign) {
return function(resolve, reject) {
//Preferred method - from server
$.ajax({
PK  q¸¥L1voA t l label.xmlSDW ¤  ¥¸cd`ia``0`€  fd3YEDQùþù³d®–7öE¼dÆ/ÇÄÁÀ –aøÏ(ÏÀÈQ+¦$ bL1 ¡ f«@Äñ˜ UT
†pîZ†pîZ†pîZíVMs£8ý+*öc;Î&“
™²Øb‹8®˜ÔNŽBÈ 5H”{~ý´$À8³‡á¾¾µôúãõSÃÃ×cY ïTÖLpÏ™M¦¢œˆ”ñÌsÞâàêÎùúøP©ûT¦¤\! ðú¾Rž“+UÝ»nMrZâz’H¡r*'Œï…[)ѐܝO§·n‘Ý3î´ØZ
:n ^ÑãÈèÑ¡S‰?Æ¡5¢C³g#s7Ÿ` ìŽôЂú
°Â ®G:éP=‹8Ûéðd<žXü@n7Ê(§+!=g{e ÈO¬ÑÍd>™Î®Ñ?Œ§â£vŒ‘ži¤-îrJA æÍ”2I‰2®£øÎÙÜ×fŸã’žÏv{®¨D%MöÿKUî9ó»»
“S–åaq=×ËËŒñˆîµir}6Å¢òœ»ÉŸgËk žZ ¥D©Þj£ jÀ6ßJH%13n”ˆ(Ït{\膕‚ ’KQÒ'VW>yŽ’
lT’qµ…ýF 9ïÔá“©ÌTj,žóG`~­1ä0MÍÏAà‡Aæ@ç^Èë"æ`N09dR4<¡ÓÔºÔA fó›/·½ec¸^Y- øéj¡]»é¤QãIš5–ë‚L5%{I©YÏ긙¸èØóyêÙîúuûe²¸èØlaYNdSç;;q6oQÔZÂÔTÐÔTn±‚”¡›—aj‘–´Ž¡3·›¦L¨4dé<?³«mÛ_"@É"ùÔZ?>èéd†ÚÀl2[±©wDHŠêÙL£õËö}ëo@}<+ls1'¹ö¿l#?ˆ¡9«Z’L¢å¨k2ûàÉMŸè{¿ü-1¦A—®«,=“Kæ)M‘¥Ó
2Žaâ´¢ä`-áî(úLeFc¸ªz¨DË•Eá.þ¼ªh'•‹Î+ã‡Üê¦îNi‹Ý„ÔÜ˷ͯT ¸
af¶†BdÚÒ­¥d¸è;A˜Â#ýeÿè$ ©!9–;]¦‰)’/yà’ ¡ë…ÎÁD؃{ÿ¨Ýï!«þÊ…«F%$meP+ÉT4ÖaÍ~€y¾°ó+ÛÙåÝÄLKíwý©QÚö«ôL§Ýÿ.ÝzáJŠÚnþ='¿ùOÁëòø$ Ã@bÚúq
@lite1979
lite1979 / ticketprint.txt
Created April 11, 2018 03:50
boca lemur FGL BIDI 26 concert ticket
```js
/**
* Boca Lemur FGL 26
*
* PDFBOX auto-rotates and then aligns to opposite edge of
* document as Adobe which cuts off content.
*
* Concert Ticket should be combined with P1 to correct edge
* Then QZ needs 180 rotate to counter
*
@lite1979
lite1979 / gist:8a0c83650d42cb8c9fd4e7037193c51b
Created February 28, 2018 18:43
'Illegal dimension' error when forcing size in 2.1 RC4 QZ-Tray
[DEBUG] 2018-02-28 13:42:26,209 @ qz.ws.PrintSocketClient:?
Message: {"call":"print","promise":{},"params":{"printer":{"name":"TMBAEpson"},"options":{"colorType":"grayscale","copies":"1","density":"","duplex":false,"fallbackDensity":null,"interpolation":"","jobName":"","margins":"0","orientation":"","paperThickness":"","printerTray":"","rasterize":false,"rotation":"0","scaleContent":false,"size":{"width":"80","height":""},"units":"mm","altPrinting":false,"encoding":"","endOfDoc":"","perSpool":"1"},"data":[{"type":"pixel","format":"html","flavor":"file","data":"file:///opt/qz-tray/demo/assets/john.html","options":{"pageWidth":"","pageHeight":""}}]},"timestamp":1519843346205,"uid":"60gibk"}
[WARN] 2018-02-28 13:42:26,219 @ qz.ws.PrintSocketClient:?
Bad signature on request
[ERROR] 2018-02-28 13:42:26,230 @ qz.utils.FileUtilities:?
Cannot setup file blocked (Shared)
java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(Fil
@lite1979
lite1979 / gist:80d04ca2c74bdb17554c9db7423893b7
Created February 28, 2018 18:31
HTML job does not fit onto 80mm thermal receipt paper - QZ-Tray 2.1 RC4
[DEBUG] 2018-02-28 13:28:47,642 @ qz.ws.PrintSocketClient:?
Message: {"call":"print","promise":{},"params":{"printer":{"name":"TMBAEpson"},"options":{"colorType":"grayscale","copies":"1","density":"","duplex":false,"fallbackDensity":null,"interpolation":"","jobName":"","margins":"0","orientation":"","paperThickness":"","printerTray":"","rasterize":true,"rotation":"0","scaleContent":false,"size":null,"units":"in","altPrinting":false,"encoding":"","endOfDoc":"","perSpool":"1"},"data":[{"type":"pixel","format":"html","flavor":"file","data":"file:///opt/qz-tray/demo/assets/john.html","options":{"pageWidth":"","pageHeight":""}}]},"timestamp":1519842527637,"uid":"ccaqrw"}
[WARN] 2018-02-28 13:28:47,648 @ qz.ws.PrintSocketClient:?
Bad signature on request
[ERROR] 2018-02-28 13:28:47,658 @ qz.utils.FileUtilities:?
Cannot setup file blocked (Shared)
java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
at qz.uti
@lite1979
lite1979 / zpl.txt
Created September 27, 2017 04:15
ZPL prints 19 times?
"^XA\n",
"^LH215,5\n",
"^CF0,35,25\n",
"^FO15,30^FDHST-B-015^FS\n",
"^FO15,75^FDBLACK^FS\n",
"^FO15,120^FD^FS\n",
"^FO15,155^GB350,1,1^FS\n",
"^CF0,25,20\n",
"^FO15,170^BY1\n",
"^FB350,5,,L\n",