zplCore.comzplCore.com

ZplPrinterClient

public sealed class ZplPrinterClient

Sends ZPL to a network printer (raw TCP, port 9100) or any stream (USB/serial adapters).

Constructors

SignatureDescription
# ZplPrinterClient(string host, int port = 9100)Sends ZPL to a network printer (raw TCP, port 9100) or any stream (USB/serial adapters).

Properties

PropertyTypeDescription
Encoding { get; set; }EncodingEncoding for the ZPL bytes. Use UTF-8 together with ^CI28 (the label model does).
Host { get; }string
Port { get; }int
Timeout { get; set; }TimeSpan

Methods

Method SignatureReturnsDescription
# AsConnection()IPrinterConnectionThis client as an IPrinterConnection.
# GetStatusAsync(CancellationToken ct = default)Task<ZplPrinterStatus>Queries ~HS and parses the response.
# SendAsync(string zpl, CancellationToken ct = default)Task
# SendAsync(Label label, int dpi = 203, int copies = 1, CancellationToken ct = default)Task
static # SendAsync(Stream stream, string zpl, Encoding? encoding = default, CancellationToken ct = default)TaskWrites ZPL to an arbitrary stream (file, serial port, USB device handle).
# SendBytesAsync(byte[] data, CancellationToken ct = default)TaskSends raw bytes over one TCP connection.