public abstract class PrinterStatus extends Object
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();
}
}
}
Modifier and Type | Field and Description |
---|---|
boolean |
isHeadCold
true if the head is cold. |
boolean |
isHeadOpen
true if the head is open. |
boolean |
isHeadTooHot
true if the head is too hot. |
boolean |
isPaperOut
true if the paper is out. |
boolean |
isPartialFormatInProgress
true if there is a partial format in progress. |
boolean |
isPaused
true if the printer is paused. |
boolean |
isReadyToPrint
true if the printer reports back that it is ready to print |
boolean |
isReceiveBufferFull
true if the receive buffer is full. |
boolean |
isRibbonOut
true if the ribbon is out. |
int |
labelLengthInDots
The length of the label in dots.
|
int |
labelsRemainingInBatch
The number of labels remaining in the batch.
|
int |
numberOfFormatsInReceiveBuffer
The number of formats currently in the receive buffer of the printer.
|
ZplPrintMode |
printMode
The print mode.
|
Constructor and Description |
---|
PrinterStatus(Connection printerConnection)
Constructs a PrinterStatus instance that can be used to determine the status of a printer.
|
public ZplPrintMode printMode
ZplPrintMode.UNKNOWN
public int labelLengthInDots
public int numberOfFormatsInReceiveBuffer
public int labelsRemainingInBatch
public boolean isPartialFormatInProgress
true
if there is a partial format in progress. For CPCL printers this is always false
public boolean isHeadCold
true
if the head is cold. For CPCL printers this is always false
public boolean isHeadTooHot
true
if the head is too hot. For CPCL printers this is always false
public boolean isReceiveBufferFull
true
if the receive buffer is full. For CPCL printers this is always false
public boolean isPaused
true
if the printer is paused. For CPCL printers this is always false
public PrinterStatus(Connection printerConnection) throws ConnectionException
ZebraPrinter.getCurrentStatus()
printerConnection
- connection to the target printerConnectionException
- if an I/O error occurs
© 2015 ZIH Corp. All Rights Reserved.