node-escpos / driver

🖨️ ESC/POS Printer driver for Node.js.
Other
318 stars 32 forks source link

Best practice question: Keep the printer connection open or not? #59

Open dschweinbenz opened 1 year ago

dschweinbenz commented 1 year ago

What is best practice? To keep the printer connection open all the time as long as the application is running / detached or to close the printer connection each time a print was finished?

I have just found an article from Zebra which indicates that the connection should be closed after each print as long as there are not multiple jobs to be printed in a short amount of time: https://techdocs.zebra.com/link-os/2-14/bestpractices/. Any suggestions?

In this library it would be possible for USB printers to close the connection, but that is not true for serialport printers as the device is thrown away after a close.

ma-zal commented 1 year ago

I am using npm package escpos with serial connection (via bluetooth), and I am closing the port after each print. It works successfully and stable for last 2 years.