Print preview ZPL II commands using .NET WinForm before sending it to Zebra printer

hasan lamaa picture hasan lamaa · Sep 14, 2011 · Viewed 32.3k times · Source

I have an .NET Windows application that prints commands to Zebra printer using ZPL II or EPL2. Is there any way to print preview the data in a form before printing it directly from Zebra printer?

Answer

Abel picture Abel · Jun 10, 2014

Have a look at the Labelary web service, which allows you to convert ZPL to an image programmatically.

Just build a URL containing the ZPL that you want to render, get the image back from the web server, and show the image to the user from within your application.

string zpl = "YOUR ZPL HERE";
string url = "http://api.labelary.com/v1/printers/8dpmm/labels/4x6/0/" + zpl;
using (WebClient client = new WebClient()) {
    client.DownloadFile(url, "zpl.png");
}

There's also a ZPL viewer lets you edit and view ZPL directly on a web page.