1
votes

I'm writing an app that needs to print receipts. I purchased a thermal printer that claims to accept ESC/POS commands, but I can't get it print barcodes for some reason. I'm testing it in Linux simply writing into the usb file for the printer using echo. I can get it to print text and accept other commands such as underline, bold, etc. Is anyone familiar enough with ESC/POS to tell me if the following command should work?

echo -e "\x1d\x6b\x041234\x00" > /dev/usb/lp0
1
this worked for me :D (y)Nidhin David

1 Answers

2
votes

Yes, this command is correct. It should print a code39 barcode with the letters 1234. You could try to set the barcode height using the command GS h n, e.g. \x1d\x68\x80 to set the height to 128 dots (1 <= n <= 255).