0

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;

2
  • 1
    Which Delphi version? How are you using those characters (show the complete code)? Why is the third character chr(72), which defines CODE93, if you want to send CODE128? Please edit your question to include a complete minimal reproducible example. Commented Mar 30, 2022 at 2:25
  • I am using 10.3. Yes, you are right, it should be chr(73) in this case. I solved it by adding the number of characters (chr(13)), like this: DirectToPrinter( chr(29)+chr(107)+chr(73)+chr(13)+chr(123)+Chr(65)+'8600123456789', true ); Commented Mar 30, 2022 at 15:17

1 Answer 1

0

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 ); 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.