A relatively simple task is turning into hours of frustration so here goes:
I have various Thermal printers and we print to the using the RawPrinterHelper that Microsoft posted. Usually use a String builder build the string and call the SendStringToPrinter and we have a printed piece of paper.
I'm trying to print a simple barcode via the ESC/POS commands that are supported. WE use these for other functions (cutting, change font sizes) that all works, the barcode refuses to print.
ESC POS Command is : GS k m n d1 d2 … dn m:barcode type e.g. n:barcode length -indicates the number of bar code data bytes d1 the barcode
The question I have is, How do I send the length of the barcode? I believe this where my problem lies.
The code snippet:
StringBuilder print = new StringBuilder();
barcode = "1234567890";
char commandGS = '\x1D';
char linefeed = '\x0A';
char esc = '\x1B';
char commandFontSize = '\x21';
char commandk = '\x6B';
char code128 = '\x69';
print.Append(commandGS);
print.Append(commandk);
print.Append(code128);
print.Append(barcode.Length);
print.Append(barcode);
string printJob = print.ToString();
RawPrinterHelper.SendStringToPrinter(printerName, printJob);