A class used to obtain the status of a Zebra printer.

Namespace:  ZSDK_API.Printer
Assembly:  ZSDK_API (in ZSDK_API.dll) Version: 1.1.123.0

Syntax

C#
public abstract class PrinterStatus
Visual Basic (Declaration)
Public MustInherit Class PrinterStatus

Examples

Get the current status of a printer.
CopyC#
using System;
using System.Collections.Generic;
using System.Linq;
using ZSDK_API;
using ZSDK_API.Comm;
using ZSDK_API.Comm.Internal;
using ZSDK_API.Util.Internal;
using ZSDK_API.ApiException;
using ZSDK_API.Printer;

try {
    TcpPrinterConnection zebraPrinterConnection = new TcpPrinterConnection("192.168.1.100", TcpPrinterConnection.DEFAULT_ZPL_TCP_PORT);
    zebraPrinterConnection.Open();
    ZebraPrinter printer = ZebraPrinterFactory.GetInstance(zebraPrinterConnection);

    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 (ZebraPrinterConnectionException e) {
        Console.Write(e.Message);
    } catch (ZebraPrinterLanguageUnknownException e) {
        Console.Write(e.Message);
    }
CopyVB.NET
Imports System
Imports System.Threading
Imports ZSDK_API.Comm
Imports ZSDK_API.ApiException
Imports System.Text
Imports System.IO.Ports
Imports ZSDK_API.Printer
Imports System.Collections.Generic
Try
     Dim zebraPrinterConnection As New TcpPrinterConnection("192.168.1.100", TcpPrinterConnection.DEFAULT_ZPL_TCP_PORT)
    zebraPrinterConnection.Open()
    Dim printer As ZebraPrinter = ZebraPrinterFactory.GetInstance(zebraPrinterConnection)

    Dim printerStatus As PrinterStatus = printer.GetCurrentStatus()
    If printerStatus.IsReadyToPrint Then
        Console.WriteLine("Ready To Print")
    ElseIf printerStatus.IsPaused Then
        Console.WriteLine("Cannot Print because the printer is paused.")
    ElseIf printerStatus.IsHeadOpen Then
        Console.WriteLine("Cannot Print because the printer head is open.")
    ElseIf printerStatus.IsPaperOut Then
        Console.WriteLine("Cannot Print because the paper is out.")
    Else
        Console.WriteLine("Cannot Print.")
    End If
Catch e As ZebraPrinterConnectionException
    Console.Write(e.Message)
Catch e As ZebraPrinterLanguageUnknownException
    Console.Write(e.Message)
End Try

Inheritance Hierarchy

System..::.Object
  ZSDK_API.Printer..::.PrinterStatus

See Also