Open jchathu opened 2 years ago
I just extracted this from here and it works for me
private byte[] BarcodeBytes(string barcode)
{
byte type = 0x49; //CODE128
byte gs = 0x1D;
byte printBarcode = 0x6B;
byte code = 0x42; //CODE_B
barcode = barcode.Replace("{", "{{");
barcode = $"{(char)0x7B}{(char)code}" + barcode;
var command = new List<byte> { gs, printBarcode, (byte)type, (byte)barcode.Length };
command.AddRange(barcode.ToCharArray().Select(x => (byte)x));
return command.ToArray();
}
Use it with
var printer = new USBPrinter.Printer("printer-name", "utf-8");
printer.Append(BarcodeBytes("123456789"));
Hi, I Revie this bug, the problem is the Font Code. Currently is 'C' change the font to 'A' or 'B' 0x42 . fix in the class BarCode.cs
I Hope this post can help you.
Hi, I have created PR #70 that addressing this issue and fix it (and add more config too 😄 ), also there is PR #38 regarding this too.
If we print the code 128 barcode as same as using this method printer.Code128("123456789"); It will print wrong barcode. It will print something like this "495051525354555657" after scanning the printed barcode
Is there anyway to decode this or how can we correct his for Code128 barcodes?