![](/img/trans.png)
[英]How to send a Font File to a Zebra Printer (MZ 220) via .Net SDK?
[英]How to send Font via Bluetooth to Zebra printer
我必须通过蓝牙将一个Font文件发送到我的打印机Zebra RW420。 我使用Zebra Windows Mobile SDK,但无法找到任何方式将其发送并存储在打印机上。 我可以通过Label Vista手动完成,但必须在200多台打印机中完成。
任何人有任何建议或知道我可以使用的SDK中的方法是什么?
提前致谢。
CISDF是正确的答案,它可能是您正在计算的校验和值不正确。 我把一个端口嗅探器放在连接到USB端口的RW420上,发现这个工作正常。 我实际上已经将一些PCX图像发送到打印机,然后在标签中使用它们。
! CISDF
<filename>
<size>
<cksum>
<data>
在前四行的末尾有一个CRLF。 使用0000作为校验和会导致打印机忽略任何校验和验证(我在一些ZPL手册中发现了一些非常模糊的引用,试过它并且它有效)。 <filename>是文件的8.3名称,因为它将存储在打印机的文件系统中,<size>是文件的大小,长度为8个字符,格式为十六进制数。 <cksum>是作为校验和的数据字节总和的二进制补码。 当然,<data>是要存储在打印机上的文件的内容。
这是我用来将示例图像发送到打印机的实际C#代码:
// calculate the checksum for the file
// get the sum of all the bytes in the data stream
UInt16 sum = 0;
for (int i = 0; i < Properties.Resources.cmlogo.Length; i++)
{
sum += Convert.ToUInt16(Properties.Resources.cmlogo[ i]);
}
// compute the two's complement of the checksum
sum = (Uint16)~sum;
sum += 1;
// create a new printer
MP2Bluetooth bt = new MP2Bluetooth();
// connect to the printer
bt.ConnectPrinter("<MAC ADDRESS>", "<PIN>");
// write the header and data to the printer
bt.Write("! CISDF\r\n");
bt.Write("cmlogo.pcx\r\n");
bt.Write(String.Format("{0:X8}\r\n", Properties.Resources.cmlogo.Length));
bt.Write(String.Format("{0:X4}\r\n", sum)); // checksum, 0000 => ignore checksum
bt.Write(Properties.Resources.cmlogo);
// gracefully close our connection and disconnect
bt.Close();
bt.DisconnectPrinter();
MP2Bluetooth是我们内部用来抽象BT连接和通信的类 - 你也有自己的,我敢肯定!
您可以使用SDK发送任何类型的数据。 Zebra字体只是一个带有标题的字体文件。 因此,如果从Label Vista捕获输出cpf文件,则可以从SDK发送该文件。 只需创建一个连接,并使用该文件的内容调用write(byte[])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.