当然是先用demo\sample.html连接上打印机.
TSPL语法参考

var config = qz.configs.create("\\PDS\Deli DL-888T"); 
var data = ['SIZE 60 mm,50 mm\r\n',
'GAP 3 mm,0\r\n',
'DIRECTION 1\r\n',
'CLS\r\n',
'TEXT 10,10, "3",0,1,1,"0001"\r\n',
'PRINT 1,1\r\n',
]
r = qz.print(config, data).then(function() {
   console.log("Sent data to printer";
}).catch(e=>{console.log(e)})

data也可以用一整段发出,重要的是每一行后面要有转义字符\r\n:

data = [`SIZE 60 mm,50 mm\r\n
GAP 3 mm,0\r\n
DIRECTION 1\r\n
CLS\r\n
TEXT 10,10, "3",0,1,1,"0001"\r\n
PRINT 1,1\r\n
`]

标签: none 阅读量: 1651

添加新评论