14 Replies Latest reply on Nov 21, 2017 2:31 AM by Nisha Mary

    Load font to Zebra Printer iMZ320 using CISDFCRC16

    Nydia Zildjiani

      Hi,

       

      I'm developing an app for iOS that will have printing function on it. But then I need to load a Chinese Character to the printer. And I cannot do this by using Zebra Utilities, because it could be more than one printer later. I need to load the font to the printer when it first connected and detect whether the printer have this font or not. There are fews of some related articles about using CISDFCRC16 to load the font. But found out, the font need to be in .CPF format, and it can be done but only using Label Vista, but Label Vista can only run on Windows XP. Does anyone have any suggestion on how I should handle this?

       

      Thanks,

        • Re: Load font to Zebra Printer iMZ320 using CISDFCRC16
          Daniel Quagliana

          Nydia,

          There is a sample code article in the Zebra Support Portal for a tool that I believe will meet your needs.  It not only can convert and create a CPS file, but has methods for creating a downloadable header.  The tool and code can be found here: Font Conversion Demo - C++

          There is also an article with more details on using Asian fonts that I think has some helpful information: Printing Asian Fonts – EZ320 – CPCL

          Let me know if this addresses your issue.

            • Re: Load font to Zebra Printer iMZ320 using CISDFCRC16
              Nydia Zildjiani

              Hi,

               

              Thank you so much for your answer. I did check and follow instruction inside Font Conversion Demo - C++ . But after done the whole process, I couldn't find any .CPF file inside the directory. I've double checked the file directory name and everything. Have you ever tried this Font Converter before?

                • Re: Load font to Zebra Printer iMZ320 using CISDFCRC16
                  Manuel Caicedo-Rivera

                  Hi Nydia,

                   

                  You do not need to have Label Vista. After you have converted your font by using the "Font Conversion Demo - C++". Now, you are ready to use the first command you mentioned. CISDFCRC16.

                   

                  ! 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

                   

                  The command will allow you download this "cpf" file to the printer. It is important to turn off the CRC check by entering 0000 as the format above says.

                   

                  For more information about the command, please go to the link below. (Pag 672 of the new ZPL manual)

                   

                  https://www.zebra.com/content/dam/zebra/manuals/en-us/software/zpl-zbi2-pm-en.pdf

                   

                  Please, let me know if this solved your question, or if you need more assistance.

                   

                  Thanks,

                   

                  Manuel Caicedo

                    • Re: Re: Load font to Zebra Printer iMZ320 using CISDFCRC16
                      Manuel Caicedo-Rivera

                      Hi Nydia,

                       

                      Regarding the Font Conversion Demo C++. I downloaded and tested it today.

                       

                      Please, go to debug folder like it is shown below, and run the FontConverter.exe from there.

                       

                      C:\Program Files (x86)\CPlus_FontConversionDemo\Debug\FontConverter.exe

                       

                      The files created will be saved in the same folder

                       

                      C:\Program Files (x86)\CPlus_FontConversionDemo\Debug\

                      2015-05-12 18_27_13-Debug.png

                      Follow the next steps, once you have the window below, choose Add Downloadable Header, and the program would add the command "CISDFCRC16" for you.

                      2015-05-12 18_21_01-FontConverter.png

                       

                      2015-05-12 18_29_29-C__Program Files (x86)_CPlus_Plus_FontConversionDemo_Debug_Cam10pt.cpf - Notepad.png

                      Please, let me know if you need more assistance,

                       

                      Thanks,

                       

                      Manuel Caicedo

                        • Re: Re: Load font to Zebra Printer iMZ320 using CISDFCRC16
                          Nydia Zildjiani

                          Hi All,

                           

                          Sorry that I just able to reply all the comments. Thanks Manuel, I already found the .CPF file. But now, I still trouble to send the file to the printer. My printer iMZ320 is using ZPL language.

                           

                          I've followed the format as below,

                           

                          ! 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


                          But every time I check the printer, i couldn't find the font inside E: directory or other directory. Wonder is there any part or step that I missed. I did check the manual from pdf as well, but still with no luck

                           

                          Thanks,

                          Nydia Zildjiani

                            • Re: Re: Load font to Zebra Printer iMZ320 using CISDFCRC16
                              Robin West

                              Hi Nydia,

                              I have to check the basic question.  Did you specify a drive in the !CISDF command?  Like this:

                              ! CISDFCRC16

                              0000

                              E:MYFILE.CPF

                              <size> // eight digit hex file size in bytes.

                              0000

                              <data> // Binary data to store


                              Otherwise I believe it assumes R: drive.  Also, can I ask why you are loading a CPF file?  It's usually a CPCL font file format. You won't be able to use it in your ZPL formats.  You need a FNT or TTF file for ZPL.

                                • Re: Re: Load font to Zebra Printer iMZ320 using CISDFCRC16
                                  Nydia Zildjiani

                                  Hi Robin,

                                   

                                  Thanks for your answer. Yes, I didn't specify the drive inside CISDF command. Okay, so seems like I misunderstood on what font that can be load to printer if using CISDF command.

                                   

                                  Now, I already specified the driver. Also I'm using TTF file format. But when I check inside the printer, I still couldn't find the font.

                                   

                                  For the last command:

                                   

                                  <data> // Binary data to store

                                   

                                  How to send this binary data to the printer? Currently the way I'm sending is by using below command:


                                  var fileBytes = File.ReadAllByte ("AppResource/SIMSUN.TTF");

                                  string size = String.Format ("{0:x8}", fileBytes.Length);

                                  NSData data = NSData.FromString (@"! CISDFCRC16" + "\r\n 0000\r\n E:SIMSUN.TTF\r\n "+ size + "\r\n 0000\r\n" + fileBytes);

                                  thePrinterConnection.Write (data, out error);

                                   

                                  I'm quite newbie with zebra printer and zpl language. Really appreciate the comments from all of you.

                                   

                                  Thanks,

                                  Nydia Zildjiani

                                  • Re: Load font to Zebra Printer iMZ320 using CISDFCRC16
                                    Nydia Zildjiani

                                    I did convert the bytes to string with following code:

                                     

                                    string file = Convert.ToBase64String (fileBytes);

                                     

                                    NSData data = NSData.FromString (@"! CISDFCRC16" + "\r\n 0000\r\n E:SIMSUN.TTF\r\n "+ size + "\r\n 0000\r\n" + file);

                                    thePrinterConnection.Write (data, out error);


                                    But then it will produce this error:


                                    ERROR - /SourceCache/ExternalAccessory/ExternalAccessory-287/EAOutputStream.m:-[EAOutputStream write:maxLength:] - 282 failed to write because stream does not have space available


                                    Thanks,

                                    Nydia Zildjiani

                                      • Re: Load font to Zebra Printer iMZ320 using CISDFCRC16

                                        Hi Nydia,

                                         

                                        This error is seen due to an application using the Link-OS SDK from the GUI thread. This document, explains what to do to resolve this issue.

                                         

                                        Please let me know if it helps,

                                        Beverly

                                          • Re: Load font to Zebra Printer iMZ320 using CISDFCRC16
                                            Nydia Zildjiani

                                            Hi Beverly,

                                             

                                            Thanks for your answer and the link. But first I'd like to know, the way I send the binary to the printer is it correct? Is it possible to send the binary using WRITE?

                                             

                                            Thanks,

                                            Nydia Zildjiani

                                              • Re: Load font to Zebra Printer iMZ320 using CISDFCRC16

                                                Hi Nydia,

                                                 

                                                My apologies that I have not gotten back to you sooner. I am still checking on your question. I hope to have more information for you regarding this on Friday.

                                                Thank you,

                                                Beverly

                                                • Re: Load font to Zebra Printer iMZ320 using CISDFCRC16

                                                  Hi Nydia,


                                                  I have been looking at your code, what programming language are you using? The below code looks different than the Objective-C code I have seen before. Are you developing using a cross-platform tool (like Xamarin)? Are you using Swift? If you can let me know this will help me to get an answer to your question.

                                                  var fileBytes = File.ReadAllByte ("AppResource/SIMSUN.TTF");

                                                  string size = String.Format ("{0:x8}", fileBytes.Length);

                                                  NSData data = NSData.FromString (@"! CISDFCRC16" + "\r\n 0000\r\n E:SIMSUN.TTF\r\n "+ size + "\r\n 0000\r\n" + fileBytes);

                                                  thePrinterConnection.Write (data, out error);


                                                  Thank you,

                                                  Beverly

                                                  1 of 1 people found this helpful
                                                    • Re: Load font to Zebra Printer iMZ320 using CISDFCRC16
                                                      Nisha Mary

                                                      Hi Beverly ,

                                                       

                                                      I am an iOS developer. I need to install some fonts in zebra iMZ320 from my iOS application. I have use the CISDFCRC16 command, that you mentioned in the above replay to load font in printer,But nothing loaded.

                                                       

                                                      My Code is Pasted below :

                                                       

                                                      NSString *fontFilePath = [[NSBundle mainBundle] pathForResource:@"UPCA" ofType:@"TTF"];

                                                          NSData *data = [NSData dataWithContentsOfFile:fontFilePath];;

                                                       

                                                          NSString *file = [data base64EncodedStringWithOptions:0];

                                                          NSUInteger length = file.length;

                                                          NSString *dataString = [NSString stringWithFormat:@"! CISDFCRC16\r\n 0000\r\n E:UPCA.TTF\r\n %lu\r\n 0000\r\n %@",(unsigned long)length,file];

                                                          NSData* dataWrite=[dataString dataUsingEncoding:NSUnicodeStringEncoding];

                                                      //    NSData data = NSData.FromString (@"! CISDFCRC16" + "\r\n 0000\r\n E:SIMSUN.TTF\r\n "+ size + "\r\n 0000\r\n" + file);

                                                        

                                                          [self.connection write:dataWrite error:&error];

                                                       

                                                      // NOTE : self.connection is the ZebraPrinterConnection object.

                                                       

                                                      Could you please help me to find the issue in my code ?

                                              • Re: Load font to Zebra Printer iMZ320 using CISDFCRC16
                                                Nisha Mary

                                                Hi Robin ,

                                                 

                                                I am an iOS developer. I need to install some fonts in zebra iMZ320 from my iOS application. I have used the CISDFCRC16 command, that you mentioned in the above replay to load font in printer,But nothing loaded.

                                                 

                                                My Code is Pasted below :

                                                 

                                                NSString *fontFilePath = [[NSBundle mainBundle] pathForResource:@"UPCA" ofType:@"TTF"];

                                                    NSData *data = [NSData dataWithContentsOfFile:fontFilePath];;

                                                 

                                                    NSString *file = [data base64EncodedStringWithOptions:0];

                                                    NSUInteger length = file.length;

                                                    NSString *dataString = [NSString stringWithFormat:@"! CISDFCRC16\r\n 0000\r\n E:UPCA.TTF\r\n %lu\r\n 0000\r\n %@",(unsigned long)length,file];

                                                    NSData* dataWrite=[dataString dataUsingEncoding:NSUnicodeStringEncoding];

                                                //    NSData data = NSData.FromString (@"! CISDFCRC16" + "\r\n 0000\r\n E:SIMSUN.TTF\r\n "+ size + "\r\n 0000\r\n" + file);

                                                  

                                                    [self.connection write:dataWrite error:&error];

                                                 

                                                // NOTE : self.connection is the ZebraPrinterConnection object.

                                                 

                                                Could you please help me to find the issue in my code ?