ZPLPrinter Emulator SDK for .NET
Key Features
Preview ZPL commands without wasting real labels!
High Quality & Accuracy ZPL Rendering
ZPL Parsing from Strings, IO Streams & Files
International Text & Barcodes Support
Print ZPL on non-Zebra printers (EPL, FingerPrint, ESC/POS, PCL)
Intercept & redirect ZPL printer control commands
Zebra and ZPL are registered trademarks of ZIH Corp.
ZPLPrinter Emulator SDK for .NET
is not made by or endorsed by Zebra.
Convert, Preview & Render ZPL commands to PNG, JPG & PDF with C# & VB.NET
ZPLPrinter Emulator SDK for .NET allows you to Convert, Preview and Render raw ZPL (Zebra Programming Language) commands to well known image and document formats like PNG, JPG, PDF, TIFF, PCX, Zebra GRF ASCII hex, Zebra EPL Binary Graphic, Honeywell-Intermec FingerPrint Binary Graphic, EPSON ESC/POS NV Binary Graphic & HP PCL by writing C# or VB.NET code. It targets .NET Standard 2.0, so it runs on .NET Framework 4.6.1+, .NET Core 2.0+ and modern .NET, as well as Mono, Xamarin and UWP, on Windows, Linux and macOS. The output can also be printed to any printer, including printers that do not understand ZPL.
Quick Start: Convert ZPL to PDF in C#
- Download the SDK and reference
Neodynamic.SDK.ZPLPrinterin your project. - Create a
ZPLPrinter(the virtual printer) and set its DPI and label size. The DPI must match the one the ZPL was designed for. - Choose the
RenderOutputFormatand callProcessCommands().
Convert a ZPL label to PDF
using System.Text;
using Neodynamic.SDK.ZPLPrinter;
string zpl = "^XA^FO20,30^GB750,1100,4^FS^FO30,40^ADN,36,20^FDShip to:^FS^FO150,125^ADN,36,20^FDAcme Printing^FS^FO70,480^BY4^B3N,,200^FD12345678^FS^XZ";
using (var printer = new ZPLPrinter("LICENSE OWNER", "LICENSE KEY"))
{
printer.Dpi = 203; // must match the ZPL design
printer.AntiAlias = true;
printer.LabelWidth = 4 * printer.Dpi; // 4 x 6 in label
printer.LabelHeight = 6 * printer.Dpi;
printer.RenderOutputFormat = RenderOutputFormat.PDF;
var output = printer.ProcessCommands(zpl, Encoding.UTF8);
if (output != null && output.Count > 0)
File.WriteAllBytes("label.pdf", output[0]);
}
Change RenderOutputFormat.PDF to PNG, JPG, TIFF, PCX or GRF to get other formats. VB.NET samples are in the documentation.
Convert multiple labels to PNG images
// Two ^XA...^XZ formats = two labels
string zpl = "^XA^FO50,50^A0N,50,50^FDOlive Oil^FS^FO50,120^BCN,100^FDOO2935^FS^XZ^XA^FO50,50^A0N,50,50^FDCurry Sauce^FS^FO50,120^BCN,100^FDCS4948^FS^XZ";
using (var printer = new ZPLPrinter("LICENSE OWNER", "LICENSE KEY"))
{
printer.Dpi = 203;
printer.LabelWidth = 4 * printer.Dpi; // 4 x 2 in labels
printer.LabelHeight = 2 * printer.Dpi;
printer.RenderOutputFormat = RenderOutputFormat.PNG;
var output = printer.ProcessCommands(zpl, Encoding.UTF8);
// one byte[] per label for image formats
for (int i = 0; i < output.Count; i++)
File.WriteAllBytes($"label-{i + 1}.png", output[i]);
}
With PDF output, multiple labels become one PDF with one page per label. Try it without installing anything in the online ZPL viewer demo.
Intercept & Redirect ZPL Printer Control Commands
Not every ZPL command draws something on the label. Commands like ~HS (host status), ~HI (host identification), ~JA (cancel all), ^MD (media darkness), ~SD (set darkness) or ^CN (cut now) control or query the printer itself. ZPLPrinter Emulator SDK parses them and raises the PrinterControl event, so your .NET code decides what to do with each one:
- Printer & device manufacturers: accept ZPL from existing Zebra-based software and redirect the control commands to your own printer firmware.
- Print servers & middleware: log, filter or answer status queries while rendering the printable labels to PDF or images.
- Testing & QA: verify that an application sends the expected control commands without a physical printer.
using (var printer = new ZPLPrinter("LICENSE OWNER", "LICENSE KEY"))
{
// Raised for each control command (~HS, ~JA, ^MD, ^CN...)
printer.PrinterControl += (sender, e) =>
{
// log it, answer it, or forward it to your own firmware/device
};
// Printable formats are rendered as usual
var output = printer.ProcessCommands(zpl, Encoding.UTF8);
}
See the full list of control commands raised by the PrinterControl event.
Print ZPL Labels on Any Printer, Even Non-Zebra Ones
Have ZPL labels (shipping labels from UPS, FedEx, USPS or DHL, or ZPL generated by an ERP or WMS) but a printer that does not speak ZPL? ZPLPrinter Emulator SDK renders the ZPL to the language your printer understands and sends it directly to the printer:
| Target printer | Render ZPL to | Print method |
|---|---|---|
| Zebra/Eltron EPL printers (e.g. TLP2844) | EPL | PrintRawCommands()with EnablePrinting = true |
| Honeywell-Intermec FingerPrint printers | FP | |
| EPSON ESC/POS receipt printers | NV | |
| HP PCL laser printers | PCL | |
| Zebra printers (labels as graphics) | GRF or PCX | |
| Any printer with a driver on Windows | PNG or JPG | PrintImage() |
| Any CUPS printer on Linux & macOS | PDF | PrintPDF() |
Print a ZPL label on an EPL printer over the network
using Neodynamic.SDK.ZPLPrinter;
using Neodynamic.SDK.ZPLPrinter.Printing;
using (var printer = new ZPLPrinter("LICENSE OWNER", "LICENSE KEY"))
{
printer.Dpi = 203;
printer.LabelWidth = 4 * printer.Dpi;
printer.LabelHeight = 6 * printer.Dpi;
printer.RenderOutputFormat = RenderOutputFormat.EPL; // ZPL -> EPL
printer.EnablePrinting = true;
var output = printer.ProcessCommands(zpl, Encoding.UTF8);
using (var pj = new WindowsPrintJob()) // UnixPrintJob on Linux/macOS
{
pj.PrinterSettings = new PrinterSettings();
pj.PrinterSettings.Dpi = 203;
pj.PrinterSettings.Communication.CommunicationType = CommunicationType.Network;
pj.PrinterSettings.Communication.NetworkIPAddress = IPAddress.Parse("192.168.1.50");
pj.PrinterSettings.Communication.NetworkPort = 9100;
pj.PrintRawCommands(output);
}
}
Printer connectivity
- USB or any printer installed through a printer driver
- IP / Ethernet network by IP address or host name (e.g. port 9100)
- Serial port (RS-232): Windows only
- Parallel port (Centronics / LPT): Windows only
Printing classes ship in two assemblies: Neodynamic.SDK.ZPLPrinter.WindowsPrinting.dll (WindowsPrintJob) and Neodynamic.SDK.ZPLPrinter.UnixPrinting.dll (UnixPrintJob) for Linux & macOS.
Features at a Glance
Convert ZPL to Images & Docs
Use ZPLPrinter Emulator SDK to easily convert ZPL commands to PNG, JPG, PDF, TIFF, PCX, Zebra GRF ASCII hex, Zebra EPL Binary Graphic, Honeywell-Intermec FingerPrint Binary Graphic, EPSON ESC/POS NV Binary Graphic & HP PCL formats by writing simple C# or VB.NET code.Preview ZPL Commands
Need to test ZPL commands and don't have a real Zebra printer device? No problem! Use ZPLPrinter Emulator SDK to preview ZPL commands without wasting any single label!High Accuracy ZPL Render
ZPLPrinter Emulator SDK renders ZPL commands generating high quality output by reproducing built-in and resident ZPL fonts for texts and barcodes with high accuracy. Custom Zebra Intellifont is also supported!Virtual ZPL Printer
ZPLPrinter Emulator SDK works like a Virtual ZPL Printer device. You setup the virtual printer with basic settings like the DPI resolution and default Label Size to finally pass to it the ZPL commands to be processed.ZPL Parsing & Processing
ZPLPrinter Emulator SDK can parse ZPL commands from a .NET string, .NET Stream or physical file. It can detect UTF-8 encoding automatically. Most of the ZPL Formatting and Control Commands are supported.International Text Support
ZPLPrinter Emulator SDK can render ZPL commands for international text including Latin, EMEA, Asian and RTL languages like German, French, Italian, Spanish, Portuguese, Swedish, Danish, Polish, Cyrillic, Greek, Chinese, Japanese, Korean, Arabic, Hebrew, and more.Barcode Symbologies Support
ZPLPrinter Emulator SDK can generate most of the linear (1D), postal, composite, stacked and 2D barcodes shipped with real Zebra printer devices.Colored Label Simulation
ZPLPrinter Emulator SDK can be configured to convert ZPL to PNG, JPG & PDF formats simulating a color ribbon (for label items) and a background color label. Black & White 1bpp is also supported through PCX format.Custom ZPL Output Rotation
Besides ZPL rotation command, ZPLPrinter Emulator SDK can be configured to rotate ZPL outputs to 90, 180 & 270 clockwise degrees.Custom Background Image
ZPLPrinter Emulator SDK allows you to render ZPL commands on a specified Background Image (in PNG or JPG formats) which can be set from a system file path, URL, Base64 string or a binary buffer (Byte Array).Custom Watermark Stamp
You can specify to the ZPLPrinter Emulator SDK a custom watermark or stamp image to be rendered on top of the label output!Virtual Printer Storage
ZPLPrinter Emulator SDK allows you to manage from code the virtual printer storage where custom fonts, graphics, and ZPL formats can be easily added, edited, updated and removed.Control Commands
ZPLPrinter Emulator SDK features the PrinterControl event for handling printer control commands that do not produce any rendering output. It's useful for printer manufacturers that want to redirect ZPL printer control commands to their own printer firmwares.JSON Settings Serialization
ZPLPrinter Emulator SDK supports JSON Serialization for exporting/importing the settings including non-resident fonts, graphics and ZPL formats.Real-Time Clock Support
ZPLPrinter Emulator SDK supports Real-time Clock settings through the related ZPL commands or by exposing them through the RTC properties.Custom Paper Size
When exporting to PDF, TIFF, and PCL; you can specify a custom Paper Size & Orientation with the rendered label centered on each page!On-Premise Licensing
ZPLPrinter Emulator SDK is licensed for Private On-Premise environments giving you full control on the infrastructure where our product will run on.Web API for Docker!
We also offer the ZPLPrinter Web API for Docker as aLinux image so it can be used with Any Development Platform and Programming Languages (.NET, Java, PHP, Javascript, Python, Ruby, etc.)
Rendered ZPL Elements Tracing
ZPLPrinter Emulator SDK can return the list of rendered ZPL elements based on the processed commands providing the following info: ZPL Command Name, Content, X, Y, Width & Height allowing post-rendering processing tasks like custom content replacement.
ZPL Commands Support
ZPLPrinter Emulator SDK rendering engine supports most of the ZPL formatting and control commands. The following table lists the supported commands. Not listed or unsupported commands will be skipped in the parsing stage.
Barcode symbols, particularly 2D-type like QR Code, Data Matrix, Aztec Code, Maxicode..., might look different to the one printed by a real printer because ZPLPrinter Emulator SDK leverages on its own barcode encoder. However, this does not mean that the rendered barcodes will not be readable at all.
| Status | ZPL Command | Notes |
|---|---|---|
| ^A Scalable/Bitmapped Font | ||
| ^A@ Use Font Name to Call Font | .FNT extension is not supported | |
| ^B0 Aztec Bar Code Parameters | ECICs and Structured Appended format are not supported | |
| ^B1 Code 11 Bar Code | ||
| ^B2 Interleaved 2 of 5 Bar Code | ||
| ^B3 Code 39 Bar Code | ||
| ^B4 Code 49 | Starting mode is not supported | |
| ^B5 Planet Code bar code | ||
| ^B7 PDF417 Bar Code | ||
| ^B8 EAN-8 Bar Code | ||
| ^B9 UPC-E Bar Code | ||
| ^BA Code 93 Bar Code | ||
| ^BB Codablock | Codablock-F supported only | |
| ^BC Code 128 Bar Code (Subsets A, B, and C) | ||
| ^BD UPS MaxiCode Bar Code | ||
| ^BE EAN-13 Bar Code | ||
| ^BF MicroPDF417 Bar Code | ||
| ^BI Industrial 2 of 5 Bar Codes | ||
| ^BJ Standard 2 of 5 Bar Code | ||
| ^BK ANSI Codabar Bar Code | ||
| ^BL LOGMARS Bar Code | ||
| ^BM MSI Bar Code | ||
| ^BO Aztec Bar Code Parameters | ECICs and Structured Appended format are not supported | |
| ^BP Plessey Bar Code | ||
| ^BQ QR Code Bar Code | Model 1 and Data Encoding Switches are not supported | |
| ^BR GS1 Databar | ||
| ^BS UPC/EAN Extensions | ||
| ^BT TLC39 | ||
| ^BU UPC-A Bar Code | ||
| ^BX Data Matrix Bar Code | Quality Level < 200 is not supported | |
| ^BY Bar Code Field Default | ||
| ^BZ POSTAL Bar Code | ||
| ^CC Change Caret | ||
| ^CD Change Delimiter | ||
| ^CF Change Alphanumeric Default Font | ||
| ^CI Change International Font/Encoding | Character remapping is not supported | |
| ^CT Change Tilde | ||
| ^CW Font Identifier | ||
| ~DB Download Bitmap Font | ||
| ^DF Download Format | ||
| ~DG Download Graphics | ||
| ~DU Download Unbounded TrueType Font | ||
| ~DY Download Objects | AR-compressed format and bitmap, .pcx, .nrd, .pac, .wml, .htm, .get extensions are not supported | |
| ~EG Erase Download Graphics | ||
| ^FA Field Allocate | ||
| ^FB Field Block | ||
| ^FC Field Clock | ||
| ^FD Field Data | ||
| ^FE Field Concatenation | ||
| ^FH Field Hexadecimal Indicator | ||
| ^FL Font Linking | ||
| ^FM Multiple Field Origin Locations | ||
| ^FN Field Number | ||
| ^FO Field Origin | ||
| ^FP Field Parameter | ||
| ^FR Field Reverse Print | ||
| ^FS Field Separator | ||
| ^FT Field Typeset | ||
| ^FV Field Variable | ||
| ^FW Field Orientation | ||
| ^FX Comment | ||
| ^GB Graphic Box | ||
| ^GC Graphic Circle | ||
| ^GD Graphic Diagonal Line | ||
| ^GE Graphic Ellipse | ||
| ^GF Graphic Field | ||
| ^GS Graphic Symbol | ||
| ^ID Object Delete | ||
| ^IL Image Load | ||
| ^IM Image Move | ||
| ^IS Image Save | ||
| ^JM Set Dots per Millimeter | ||
| ~JR Power On Reset | ||
| ^LH Label Home | ||
| ^LL Label Length | ||
| ^LR Label Reverse Print | ||
| ^LS Label Shift | ||
| ^LT Label Top | ||
| ^MC Map Clear | ||
| ^MU Set Units of Measurement | ||
| ^PA Advanced Text Properties | ||
| ^PM Printing Mirror Image of Label | ||
| ^PO Print Orientation | ||
| ^PQ Print Quantity | ||
| ^PW Print Width | ||
| ^RF Read or Write RFID Format | Only Write mode is supported | |
| ^RQ Quick Write EPC Data and Passwords | ||
| ^SF Serialization Field | ||
| ^SL Set Mode and Language (for Real-Time Clock) | ||
| ^SN Serialization Data | ||
| ^SO Set Offset (for Real-Time Clock) | ||
| ^ST Set Date and Time (for Real-Time Clock) | ||
| ^TB Text Blocks | ||
| ^TO Transfer Object | ||
| ~WC Print Configuration Label | ||
| ^XA Start Format | ||
| ^XF Recall Format | ||
| ^XG Recall Graphic | ||
| ^XZ End Format | ||
| ^WF Encode AFI or DSFID Byte | ||
| ^WT Write (Encode) Tag |
Printer Control Commands raised by the PrinterControl event
These commands produce no rendering output. ZPLPrinter Emulator SDK raises them through the PrinterControl event so you can log, answer or redirect them.
| Status | ZPL Command | Notes |
|---|---|---|
| ^CN (Cut Now) | ||
| ^CO (Cache On) | ||
| ^CP (Remove Label) | ||
| ~HB Battery Status | ||
| ~HD Head Diagnostic | ||
| ~HI Host Identification | ||
| ~HM Host RAM Status | ||
| ~HQ Host Query | ||
| ~HS Host Status Return | ||
| ~JA Cancel All | ||
| ~JB (Reset Optional Memory) | ||
| ~JC Set Media Sensor Calibration | ||
| ~JG Graphing Sensor Calibration | ||
| ~JL Set Label Length | ||
| ~JP (Pause and Cancel Format) | ||
| ~JS Change Backfeed Sequence | ||
| ^JU (Configuration Update) | ||
| ^JW (Set Ribbon Tension) | ||
| ^JZ (Reprint After Error) | ||
| ^KD (Select Date and Time Format (for Real Time Clock)) | ||
| ^KL (Define Language) | ||
| ^MD (Media Darkness) | ||
| ^MM (Print Mode) | ||
| ^MN (Media Tracking) | ||
| ^MT (Media Type) | ||
| ^PF (Slew Given Number of Dot Rows) | ||
| ~PL (Present Length Addition) | ||
| ^PN (Present Now) | ||
| ^PP / ~PP Programmable Pause | ||
| ~PR Applicator Reprint | ||
| ^PR Print Rate | ||
| ~PS Print Start | ||
| ~SD Set Darkness | ||
| ^SP (Start Print) | ||
| ~TA Tear-off Adjust Position | ||
| ~WQ Write Query | ||
| ^XB (Suppress Backfeed) | ||
| ^ZZ (Printer Sleep) |
System Requirements
ZPLPrinter Emulator SDK is a .NET Standard 2.0 library, so it runs on any platform that supports .NET Standard 2.0 or later:
- .NET Framework 4.6.1+
- .NET Core 2.0+ and modern .NET (.NET 5 and later)
- Mono 5.4+, Xamarin.iOS 10.14+, Xamarin.Android 8.0+, Xamarin.Mac 3.8+
- Universal Windows Platform (UWP) 10.0.16299+
Dependencies: SkiaSharp 1.68.3+, System.Text.Encoding.CodePages 4.5.0+ and Newtonsoft.Json 13.0.1+. Development with Visual Studio 2017+ (or any IDE that supports .NET Standard 2.0).
Which ZPL Edition Do I Need?
The same ZPL rendering engine is available in four editions:
| Edition | Best for | How you use it | Platforms |
|---|---|---|---|
| ZPLPrinter Emulator SDK for .NET | .NET apps (C#, VB.NET) | In-process library: convert, preview and print from code | Windows, Linux, macOS (.NET Standard 2.0) |
| ZPLPrinter Web API for Docker | Any language, servers and cloud | REST API in a Docker container | Linux container (amd64 & arm64) |
| Virtual ZPL Printer Driver | Desktop users and apps that print to a Zebra printer | Installed printer: save ZPL as PDF/PNG or print it on any other printer | Windows, macOS |
| ZPLServer | Background integration and legacy apps | Local service: HTTP POST + raw TCP; save to disk or forward to a webhook | Windows x64, Linux x64 & ARM64, macOS (Apple Silicon & Intel) |
ZPLPrinter Emulator SDK FAQ
- Do I need a Zebra printer to preview or convert ZPL?
- No. ZPLPrinter Emulator SDK works like a virtual ZPL printer inside your .NET app. You pass it the raw ZPL commands and it returns PDF, PNG, JPG, TIFF or other formats, so you can preview labels without a physical printer and without wasting labels.
- Which output formats are supported?
- PNG, JPG, PDF, TIFF, PCX and HP PCL, plus printer graphic formats: Zebra GRF ASCII hex, Zebra EPL binary graphic, Honeywell-Intermec FingerPrint binary graphic and EPSON ESC/POS NV binary graphic.
- Can I print ZPL labels on a printer that does not support ZPL?
- Yes. See printing. Render the ZPL to EPL, Honeywell FingerPrint, EPSON ESC/POS NV or HP PCL and send it to the printer with PrintRawCommands, or render to PNG/JPG and print to any driver-installed printer on Windows, or to PDF and print to any CUPS printer on Linux and macOS.
- What happens when the ZPL generates more than one label?
- For PDF you get a single document with one page per label. For image formats (PNG, JPG, TIFF, PCX, GRF, EPL, FingerPrint and NV) you get one byte array per label.
- Why does my rendered label look scaled or cut off?
- The DPI set on the virtual printer must match the DPI the ZPL was designed for (for example 203 or 300 dpi). Also set the label width and height in dots, for example 4 x 6 inches at 203 dpi is 812 x 1218 dots.
- Which .NET versions are supported?
- ZPLPrinter Emulator SDK targets .NET Standard 2.0, so it works on .NET Framework 4.6.1+, .NET Core 2.0+, modern .NET (.NET 5 and later), Mono 5.4+, Xamarin and UWP 10.0.16299+. See system requirements.
- Does it run on Linux and macOS?
- Yes. Rendering works on Windows, Linux and macOS. For printing, use WindowsPrintJob on Windows and UnixPrintJob on Linux and macOS; serial and parallel port printers are supported on Windows only.
- Can I intercept ZPL printer control commands?
- Yes. Control commands that produce no rendering output, such as ~HS host status, ~JA cancel all, ^MD media darkness or ^CN cut now, are raised through the PrinterControl event, so your code can log them, answer them or forward them to your own printer firmware or device.
- Will barcodes look exactly like on a real Zebra printer?
- 1D barcodes and text are reproduced with high accuracy using the built-in and resident ZPL fonts. 2D symbols such as QR Code, Data Matrix, Aztec or MaxiCode are generated by the SDK's own encoder, so they can look slightly different from a real printer while still being readable.
- How is this different from an online ZPL viewer?
- ZPLPrinter Emulator SDK runs on-premise inside your own application, so labels with customer or shipping data never leave your infrastructure and there is no dependency on an external web service.
- Can I use it from Java, Python, PHP or Node.js?
- The SDK is for .NET (C# and VB.NET). For any other language, use the ZPLPrinter Web API for Docker, a Linux container that exposes the same rendering engine over HTTP.