Skip to content

Instantly share code, notes, and snippets.

@EcotechBrad
EcotechBrad / HTMLCanvasToZPL.js
Created January 26, 2022 16:02
Convert a html canvas into ZPL, provided canvas size is a multiple of 8
zgfLut={
0:'0',1:'1',2:'2',3:'3',
4:'4',5:'5',6:'6',7:'7',
8:'8',9:'9',10:'A',11:'B',
12:'C',13:'D',14:'E',15:'F'
}
canvas=document.getElementById('label')
ctx=canvas.getContext("2d")
px=ctx.getImageData(0,0,canvas.width,canvas.height)