简体   繁体   English

ESC / POS不打印条形码

[英]ESC/POS not Printing Barcodes

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. 我购买了声称接受ESC / POS命令的热敏打印机,但由于某种原因我无法使它打印条形码。 I'm testing it in Linux simply writing into the usb file for the printer using echo . 我正在Linux中对其进行测试,只需使用echo将其写入打印机的usb文件。 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? 我可以打印文本并接受其他命令,例如下划线,粗体等。是否熟悉ESC / POS的人可以告诉我以下命令是否应该工作?

echo -e "\x1d\x6b\x041234\x00" > /dev/usb/lp0

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 hn, eg \\x1d\\x68\\x80 to set the height to 128 dots (1 <= n <= 255). 它应打印带有字母1234的code39条形码。您可以尝试使用GS hn命令设置条形码高度,例如\\ x1d \\ x68 \\ x80,以将高度设置为128个点(1 <= n <= 255)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM