Reputation: 2288
Environment: I have 2 epson printers conected through the network. This printers print all the receips tickets from 5 PCs with a POS in c# using OPOS.
Problem: Most of the times the printers can not print the tickets because they are locked by some of the POS. Other times the printers take too long to print.
Printing code:
p.printerOPOS.Open();
p.printerOPOS.Claim(PRINT_WAIT_SECONDS); //5 seconds
p.printerOPOS.DeviceEnabled = true;
p.printerOPOS.PrintNormal(PrinterStation.Receipt, builder);
p.printerOPOS.DeviceEnabled = false;
p.printerOPOS.Close();
Question: How can I ensure printing? Is there any way of creating an OPOS queue (just like the one on windows for normal printing)?
Upvotes: 1
Views: 1142
Reputation: 4360
It is better not to use OPOS from individual applications, but to review and change the structure of the application.
In Addition:
The following answered the question about using one POSPrinter on one computer with JavaPOS, but it can also be applied to situations like your question.
If you deal only with OPOS usage, please consider this.
It depends on the software structure of the application.
If the application that uses the printer has only one process, execute Open()
, Claim()
, DeviceEnabled=True
once at application startup. You can execute DeviceEnabled=False
, Release()
, Close()
just before the application terminates.
If necessary, the application combines TransactionPrint()
, RotatePrint()
, PrintNormal()
, etc. to print.
This shortens the time it takes for printing.
If applications using printers are running concurrently in more than one process at the same time, only Open()
in each processes.
If the process requiring printing remains almost unchanged, Claim()
and DeviceEnabled=True
on the side of acquiring the control right of the printer simultaneously with the timing of switching of the job and the screen, the side for releasing the control right of the printer With DeviceEnabled=False
, Release()
is called.
When processes requiring printing change frequently, Claim()
, DeviceEnabled=True
is executed after every use of the printer occurs, and after printing is completed, when necessary printing is finished, DeviceEnabled=False
, Release()
to hold.
Upvotes: 1