Disconnect From the Printer and Release Resources

The LabelPrinter and LinePrinter classes inherit the disconnect and close methods from the parent class, Printer. After the printing is done, the application may call the disconnect method to disconnect the printer connection. If the application calls any method to interact with the printer without a printer connection, an exception is thrown.

The application may call connect and disconnect methods multiple times. When it is done with all printing, Honeywell recommends that the application calls the close method to release printing resources. If there is an open printer connection when the close method is called, it also disconnects the printer connection.

public boolean disconnect() throws PrinterException
public Boolean close() throws PrinterException

If you call the disconnect or close method from a LinePrinter object and an unexpected error occurs, it throws LinePrinterException which is a subclass of PrinterException. Likewise, these methods throw LabelPrinterException if they are called from a LabelPrinter object. You may use PrinterException to catch either LinePrinterException or LabelPrinterException.