command-printer
v1.0.8
Published
A simple JavaScript command print tools.
Downloads
155
Readme
command-printer
js command print.support TSPL,ZPL,ESC,CPCL
Install
npm install command-printer --saveUsage
const {Tspl} = require('command-printer');
const tspl = new Tspl({
charSet: 'utf8',
printCount:1
});
tspl.setPage(70,40,0,3,0);// page width,page height,direction,gap m,gap n
tspl.addText(10,10,'Hello World!','TTS24',0,2);// x,y,text,font,direction,scale
tspl.addImage('test.png',10,20);// image url,X,Y
tspl.getPrintData(); // Hex stringAPI
class Tspl {
constructor(options)
setPage(width, height, direction, gapM, gapN)
addText(x, y, text, font, direction, scale)
addImage(url, x, y)
addImageByBytes(imageBitData, x = 0, y = 0,width, height)
addBitmap(bitmap,x, y, width, height)
addBlock(x, y, width, height,font,rotation,text,scale,lineSpace)
addBar(x, y, width,height)
addBox(startX,startY,endX,endY,lineThickness,radius)
addBarcode(x, y, type, height, content, showLabel, widetWidth,narrowWidth, rotate)
addQrcode(x, y, text, cellwidth, rotation, eccLevel)
getPrintData()
}
class Zpl {
constructor(options)
setPage(width, height, direction, gapM, gapN)
addText(x, y, text, font, direction, scale)
addImage(url, x, y)
addBitmap(bitmap,x, y, width, height)
addBlock(x, y, width, height,font,rotation,text,scale,lineSpace)
addBar(x, y, width,height)
addBox(startX,startY,endX,endY,lineThickness,radius)
addBarcode(x, y, type, height, content, showLabel, widetWidth,narrowWidth, rotate)
addQrcode(x, y, text, cellwidth, rotation, eccLevel)
getPrintData()
}
class Esc {
constructor(options)
}
class Cpcl {
constructor(options)
}License
MIT
