ZPL: Z64 Compression, Encoding, and CRC-check for .NET Framework/C#

Hello,

 

I am developing software in C# for the .NET Framework that takes a QR code represented in a .PNG image and converts it to the ZPL format.  With that said, although printing a single label with the QR code on it does not present an issue, sending the printer a data stream consisting of 10 labels, the printer indicates an out of memory error.

 

Is there an API for the .NET framework for the Z64 encoding as is stated in the ZPL II programming guide? This API will be required to support .NET Framework 2.0, as some of our customers are still on that version.

 

I know this is what your ZebraDesigner 2 software uses to print QR codes.

 

Otherwise, do you know of any algorithms for C# that can be used to perform the Z64 encoding that I can stitch together? That includes compression, encoding, and CRC-checking.

 

Thanks!

-Tim

Anonymous (not verified)
Hi Tim, Sorry I don't have

Hi Tim,

Sorry I don't have sample code at this point, but I would look into the following .Net framework 2.0 methods for B64 encoding:

Convert.ToBase64String(byte[])

and How to generate a CRC-16 from C# - Stack Overflow  or https://www.codeproject.com/Articles/35134/How-to-calculate-a-CRC-in-Csharp

We are using the IBM standard CRC16 checksum.  The png file in bytes should be your input into the base64 converter.

Some of our older printers do not have much memory in them, so you may want to consider updating to one with larger memory and image processing speed.

Hope this at least points you in the right direction.  I'll see about getting some sample code together.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Tim Borowsky
Hi Robin,Thanks for your

Hi Robin,

Thanks for your reply. I'll go ahead and look into these resources.

However, there is still the LZ77 algorithm for compressing the .PNG file. Do you know if there's a good C#/.NET solution for that?

Thanks!

-Tim

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Tim, I "think" that the

Hi Tim,

I "think" that the DeflateString class is what you want in .NET 2.0 (it changes in the latest framework version).  I haven't tested it, so I can't be sure.  I'm concerned that the combination of the Huffman coding might change the result to something the printer won't recognize.  I'll keep looking and see if I can put together a simple test/sample.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Tim, The newly released

Hi Tim, The newly released .NET SDK should be of great help here.  You can integrate the SDK fully to enable printing(GraphicsUtil.PrintImage), or just use the image conversion API (PrinterUtil.ConvertGraphic), if you have your own methods to communicate to the printers.

Robin

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments