I am trying to print code128 barcode directly to POS printer using this code:
DirectToPrinter(chr(29)+chr(107)+chr(72)+Chr(123)+Chr(65)+'8600123456789', true);
According to the documentation here: https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=128, I have included { (123) and character for code A (65), but I wonder why I am getting only digits printed out but no lines.
Any idea?
By the way, I am using EPSON TM88V POS Thermal Printer.
nction tform1.DirectToPrinter(S: AnsiString; NextLine: Boolean): Boolean;
var
Buff: TPrnBuffRec;
TestInt: Integer;
i: integer;
Device: PChar;
Driver: PChar;
Port: PChar;
begin
TestInt := PassThrough;
if Escape(Printer.Handle, QUERYESCSUPPORT, SizeOf(TESTINT), @testint, nil) > 0 then
begin
if NextLine then S := S + #13 + #10;
StrPCopy(Buff.Buff_1, S);
Buff.bufflength := StrLen(Buff.Buff_1);
Escape(Printer.Canvas.Handle, Passthrough, 0, @buff, nil);
Result := True;
end
else
Result := False;
end;
This issue is solved (kudos to Tom) by adding the number of characters chr(13) and replacing chr(72) to chr(73), like this:
DirectToPrinter( chr(29)+chr(107)+chr(73)+chr(13)+chr(123)+Chr(65)+'8600123456789', true );