RawPrinterHelper unable to print Barcode using ESC POS Commands

为君一笑 提交于 2019-12-06 09:42:38

You probably need a byte to represent the length of the barcode rather than the text representation of the length of the barcode.

So instead of

print.Append(barcode.Length);

use

print.Append((char)barcode.Length);

I assume the length does not exceed 255.

Edited to add: You can examine the bytes which you are sending with something like

var bb = Encoding.UTF8.GetBytes(printJob);
bb.ToList().ForEach(x => Console.Write(x.ToString("X2") + " "));

and check that they conform to what you intend to send. You may also want to compare what is sent to something which does work in your current code.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!