How to send a Font File to a Zebra Printer (MZ 220) via .Net SDK?
-
29-09-2019 - |
문제
I have to send custom Font Files to a Zebra MZ 220 Printer via C# and the Zebra .Net SDK. That SDK provides a SendFile() Method and it works with template Files percectly but whenever I send a Font File the printer starts printing out the File while receiving it. The Zebra Software Label Vista has a Menu option Send Font but I have to do ist programmatically.
Does anyone know how to send Font Files to the Printer?
Thank you very much
twickl
해결책
You will need to wrap the file in a special download command in order for the printer to store the file.
The command is detailed in the ZPL Guide under "CISDFCRC16".
Basic format for the command -
! CISDFCRC16
<crc> // 4 digit hex CRC. Enter 0000 to turn off CRC check.
<filename> // file name with extension. 8.3 filenames only.
<size> // eight digit hex file size in bytes.
<checksum> // four digit hex checksum. Enter 0000 to turn off checksum validation.
<data> // Binary data to store
This will allow you to store a file on the printer's file system.
Note: The printer will not understand a typical .ttf file. You will need to convert the font to a .CPF file using Label Vista, and then send it down using this command.
다른 팁
I've worked with LP 2824 to automatically print labels with EPL and used the RawPrinterHelper class from Microsoft, with the bug fix from here. The class has a SendFileToPrinter method which might be worth a try (I haven't used it, so I don't know if it works for fonts)
I would like to add to James's answer. He is indeed correct the '! CISDFCRC16' call does work.
I initially was having a lot of trouble getting it to work however because I implementing my own CRC and Checksum logic.
When uploading the file to the printer I was always getting a 'Checksum failed' message come out of the printer. Even after implementing the CRC/Checksum logic given to us in the CPCL programming manual.
The only way I managed to get this to work was by using Zebra's CpclCrcHeader class to calculate the CRC using the CpclCrcHeader.getCRC16ForCertificateFilesOnly(byteArray).toUpperCase() and the Checksum using the CpclCrcHeader.getWCheckSum(byteArray).toUpperCase()
Hope that helps anyone else wanting to manage all the files on their Zebra printers.