Click or drag to resize

PrinterStatus Class

A class used to obtain the status of a Zebra printer.
Inheritance Hierarchy
SystemObject
  Zebra.Sdk.PrinterPrinterStatus

Namespace:  Zebra.Sdk.Printer
Assembly:  SdkApi_Core (in SdkApi_Core.dll) Version: 2.13.898
Syntax
public abstract class PrinterStatus

The PrinterStatus type exposes the following members.

Constructors
  NameDescription
Public methodPrinterStatus
Constructs a PrinterStatus instance that can be used to determine the status of a printer.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Fields
  NameDescription
Public fieldisHeadCold
true if the head is cold. For CPCL printers this is always false
Public fieldisHeadOpen
true if the head is open.
Public fieldisHeadTooHot
true if the head is too hot. For CPCL printers this is always false
Public fieldisPaperOut
true if the paper is out.
Public fieldisPartialFormatInProgress
true if there is a partial format in progress. For CPCL printers this is always false.
Public fieldisPaused
true if the printer is paused. For CPCL printers this is always false
Public fieldisReadyToPrint
true if the printer reports back that it is ready to print
Public fieldisReceiveBufferFull
true if the receive buffer is full. For CPCL printers this is always false
Public fieldisRibbonOut
true if the ribbon is out.
Public fieldlabelLengthInDots
The length of the label in dots. For CPCL printers this is always 0.
Public fieldlabelsRemainingInBatch
The number of labels remaining in the batch. For CPCL printers this is always 0.
Public fieldnumberOfFormatsInReceiveBuffer
The number of formats currently in the receive buffer of the printer. For CPCL printers this is always 0.
Public fieldprintMode
The print mode. For CPCL printers this is always UNKNOWN
Top
Examples
using System;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer;

public class PrinterStatusExample {

    public static void Main(string[] args) {
        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) {
                Console.WriteLine("Ready To Print");
            } else if (printerStatus.isPaused) {
                Console.WriteLine("Cannot Print because the printer is paused.");
            } else if (printerStatus.isHeadOpen) {
                Console.WriteLine("Cannot Print because the printer head is open.");
            } else if (printerStatus.isPaperOut) {
                Console.WriteLine("Cannot Print because the paper is out.");
            } else {
                Console.WriteLine("Cannot Print.");
            }
        } catch (ConnectionException e) {
            Console.WriteLine(e.ToString());
        } catch (ZebraPrinterLanguageUnknownException e) {
            Console.WriteLine(e.ToString());
        } finally {
            connection.Close();
        }
    }
}
See Also