Recent

Author Topic: Receipt printer dilemma  (Read 191 times)

Petrus Vorster

  • Full Member
  • ***
  • Posts: 103
Receipt printer dilemma
« on: May 20, 2025, 11:29:46 am »
Hi all.

I am printing a list of tracking numbers to a receipt printer.
It should alternate by first printing the Tracking number in text and then below it the tracking number in barcode.
It uses a simple Code39 barcode since the Barcode type is not important.
I am again missing something simple.

I am printing all over everything. Perhaps the smart people here can see where i went wrong?

Code: Pascal  [Select][+][-]
  1. var
  2.   i: Integer;
  3.   datum,myprinter,presult,modstring:string;
  4.   sett:Tinifile;
  5.  
  6.   begin
  7.  Sett := TINIFile.Create('Settings.ini');
  8.  presult:=Sett.ReadString('Main', 'RCPTPrinter', myprinter);
  9.   Printer.SetPrinter(Presult);
  10.  
  11.   datum:= datetostr(Date);
  12.   Printer.BeginDoc;
  13.   Printer.canvas.font.name:='Calibri';
  14.   printer.canvas.Font.Size:=21;
  15.   printer.canvas.textout(10,1,'1st/2nd NOTICES');
  16.   printer.canvas.Font.Size:=17;
  17.   printer.canvas.textout(10,60,Datum);
  18.  
  19.   try
  20.     for i := 0 to ListBox.Items.Count - 1 do
  21.     begin
  22.       Printer.canvas.font.name:='Calibri';
  23.       printer.canvas.Font.Size:=17;
  24.       Printer.Canvas.TextOut(10, 150 + (i * 50), ListBox.Items[i]);
  25.       Printer.canvas.font.name:='Bar-Code 39';
  26.       printer.canvas.Font.Size:=17;
  27.       modstring :='*'+listbox.Items[1]+'*';
  28.       Printer.Canvas.TextOut(10, 200 + (i * 50), modstring);
  29.  
  30.  
  31.     end;
  32.   finally
  33.     Printer.EndDoc;
  34.   end;                              

Your help is always greatly appreciated.
-Peter

Petrus Vorster

  • Full Member
  • ***
  • Posts: 103
Re: Receipt printer dilemma
« Reply #1 on: May 20, 2025, 12:03:06 pm »
Ok, I found the issue.
Had to add a counter for the starting point for the next number.

Sorry to waste your time all.

-Peter

 

TinyPortal © 2005-2018