Class PrinterStatus

Object
com.zebra.sdk.printer.PrinterStatus

public abstract class PrinterStatus extends Object
A class used to obtain the status of a Zebra printer.

package test.zebra.sdk.printer.examples;
 
 import com.zebra.sdk.comm.Connection;
 import com.zebra.sdk.comm.ConnectionException;
 import com.zebra.sdk.comm.TcpConnection;
 import com.zebra.sdk.printer.PrinterStatus;
 import com.zebra.sdk.printer.ZebraPrinter;
 import com.zebra.sdk.printer.ZebraPrinterFactory;
 import com.zebra.sdk.printer.ZebraPrinterLanguageUnknownException;
 
 public class PrinterStatusExample {
 
     public static void main(String[] args) throws Exception {
         Connection connection = new TcpConnection("192.168.1.100", TcpConnection.DEFAULT_ZPL_TCP_PORT);
         try {
             connection.open();
             ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
 
             PrinterStatus printerStatus = printer.getCurrentStatus();
             if (printerStatus.isReadyToPrint) {
                 System.out.println("Ready To Print");
             } else if (printerStatus.isPaused) {
                 System.out.println("Cannot Print because the printer is paused.");
             } else if (printerStatus.isHeadOpen) {
                 System.out.println("Cannot Print because the printer head is open.");
             } else if (printerStatus.isPaperOut) {
                 System.out.println("Cannot Print because the paper is out.");
             } else {
                 System.out.println("Cannot Print.");
             }
         } catch (ConnectionException e) {
             e.printStackTrace();
         } catch (ZebraPrinterLanguageUnknownException e) {
             e.printStackTrace();
         } finally {
             connection.close();
         }
     }
 }
 
  • Field Details

    • printMode

      public ZplPrintMode printMode
      The print mode. For CPCL printers this is always ZplPrintMode.UNKNOWN
    • labelLengthInDots

      public int labelLengthInDots
      The length of the label in dots. For CPCL printers this is always 0
    • numberOfFormatsInReceiveBuffer

      public int numberOfFormatsInReceiveBuffer
      The number of formats currently in the receive buffer of the printer. For CPCL printers this is always 0
    • labelsRemainingInBatch

      public int labelsRemainingInBatch
      The number of labels remaining in the batch. For CPCL printers this is always 0
    • isPartialFormatInProgress

      public boolean isPartialFormatInProgress
      true if there is a partial format in progress. For CPCL printers this is always false
    • isHeadCold

      public boolean isHeadCold
      true if the head is cold. For CPCL printers this is always false
    • isHeadOpen

      public boolean isHeadOpen
      true if the head is open.
    • isHeadTooHot

      public boolean isHeadTooHot
      true if the head is too hot. For CPCL printers this is always false
    • isPaperOut

      public boolean isPaperOut
      true if the paper is out.
    • isRibbonOut

      public boolean isRibbonOut
      true if the ribbon is out.
    • isReceiveBufferFull

      public boolean isReceiveBufferFull
      true if the receive buffer is full. For CPCL printers this is always false
    • isPaused

      public boolean isPaused
      true if the printer is paused. For CPCL printers this is always false
    • isReadyToPrint

      public boolean isReadyToPrint
      true if the printer reports back that it is ready to print
  • Constructor Details

    • PrinterStatus

      public PrinterStatus(Connection printerConnection) throws ConnectionException
      Constructs a PrinterStatus instance that can be used to determine the status of a printer.
      Note: this will only query the printer's status upon creation. If the status needs to be updated see ZebraPrinter.getCurrentStatus()
      Parameters:
      printerConnection - connection to the target printer
      Throws:
      ConnectionException - if an I/O error occurs