Hey,
I have question how to get no paper error and deleting pending print jobs?
Im developing a kiosk where user can answer some questions and system will print a ticket.
The problem is, sometimes we run out of paper, but program still send new job to printer. Finally someone will figure out that there is no paper, installs new paper roll and
suprise, gets ton of pending tickets...
I really need to avoid that kind of "error"
I tried to get paper sensor data using passtrough and Escape function but no luck, probably im doing something wrong.
I tried following code:
type
TPrinterData = record
DataLength: Word;
Data: array [0..255] of Byte; //
end;
procedure TForm1.Button3Click(Sender: TObject);
var
TestInt: Integer;
BufferIn: TPrinterData;
BufferOut: TPrinterData;
I: Integer;
begin
Printer.BeginDoc;
try
TestInt := PASSTHROUGH;
if Escape(TWinPrinter(Printer).Handle, QUERYESCSUPPORT, SizeOf(TestInt), @TestInt, nil) > 0 then
begin
BufferIn.Data[0]:= 29;
BufferIn.Data[1]:= 114;
BufferIn.Data[2]:= 1;
BufferIn.DataLength := 3;
// clearing the buffer
for I:= 0 to 254 do
BufferOut.Data[I]:= 0;
BufferOut.DataLength := 0;
Escape(TWinPrinter(Printer).Handle, PASSTHROUGH, 0, @BufferIn, @BufferOut); // buffer out gets always zero length
// check bits, determine sensor status ...
end;
finally
Printer.EndDoc;
end;
end;
Escape code is taken here:
https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=124 you need to accept the terms and then you will see the description
OS is Win10 64bit
Lazarus ver 2.2.6
FPC ver 3.2.2
Printer is Epson TM-T20III