簡體   English   中英

如何通過藍牙將字體發送到Zebra打印機

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM