ZPL:二进制B64和压缩的Z64编码 [英] ZPL: Binary B64 and compressed Z64 encoding

查看:1253
本文介绍了ZPL:二进制B64和压缩的Z64编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许有人可以帮助我解决Zebra ZPL问题. ZPL手册并没有真正帮助我. 我想将二进制(使用ZPL B64)和压缩二进制(使用ZPL Z64)图像数据传输到打印机.

Maybe someone can help me with my Zebra ZPL problem. The ZPL manual doesn't really help me. I want to transfer binary (with ZPL B64) and compressed binary (with ZPL Z64) image data to the printer.

我能够找到以下信息:

  • 使用B64,数据以Base64格式编码.
  • 使用Z64,首先使用LZ77压缩数据,然后使用Base64进行编码.
  • 两个编码都附加了一个CRC数字. (可能是CRC-16),但是我没有计算出有效的CRC校验位!

你们有没有做过?

  • LZ77算法使用哪些参数?
  • 使用哪个CRC以及哪个起始多项式?
  • 也许有人甚至为此问题提供了C#代码?

非常感谢您.

推荐答案

ZPL手册并没有真正帮助我.

The ZPL manual doesn't really help me.

告诉我!

为了正确地计算它:

  • 使用ZLIB压缩图片位(图片必须为PixelFormat.Format1bppIndexed,最好使用
  • Compress the picture bits using ZLIB (the picture must be PixelFormat.Format1bppIndexed, and the picture bits are best accessed with Bitmap.LockBits).
  • Encode the compressed data into Base64. No whitespace or line breaks allowed.
  • Convert the Base64 string to a byte array according to ASCII encoding (System.Text.Encoding.ASCII.GetBytes(base64string)).
  • Calculate the CRC over that byte array. The Initial CRC Value must be zero.

这篇关于ZPL:二进制B64和压缩的Z64编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆