How to convert an image into ZPL in C# or VB?

You might be developing an application in .Net and in your project need to print or store an image to a Zebra printer. As you probably know your image needs to be converted into a ZPL command.

Here is how you can do that:

using Kodit.ZPL.ImageConverter;

string filename = @”zebra.jpg”;

ZebraImageData zplImage = ZebraImage.ImageToZPL(filename, ZPLImageFormat.Z64);

string zpl = string.Format(“^GF{0},{1},{2},{3},{4}”, “A”, zplImage.TotalBytes, zplImage.TotalBytes, zplImage.BytesPerRow, zplImage.ImageData);

You can set the ZPLImageFormat to your preference.
ZPLImageFormat.Z64
ZPLImageFormat.B64
ZPLImageFormat.ASCIIHex
ZPLImageFormat.CompressedASCIIHex
ZPLImageFormat.Binary

Visit our developer page for more information.

3619

You may also like

Leave a Reply