Search code examples
javajavapos

JPOS when to disable, release and close printer


My application is a POS system with a single terminal using a single printer. Question is when is it appropriate to call open(), claim() and setDeviceEnabled(true) and setDeviceEnabled(false), release() and close(). Now I do it before and after each print. Should I have it open through multiple prints and release() and close() at the end of the day?


Solution

  • 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.