4 Replies Latest reply on Dec 4, 2017 2:21 AM by Mary Nisha

    Install Custom font to Zebra Printer iMZ320 from iOS application

    Mary Nisha

      Hi,

       

      I'm developing an app for iOS that is having print functionality. We have used the iOS zebra sdk to fulfillment the requirement.We have few custom fonts (.fon and ttf files)which needs to be installed in the printer which we could not do manually. Is there a way to identify which all fonts are currently available in the system? If font is not available mobile app has to install the same to the printer.

      Can anyone suggest/guide me to resolve this problem?

       

      Thanks,

        • Re: Install Custom font to Zebra Printer iMZ320 from iOS application
          Robin West

          Hi Mary,

          You can use the retrieveFileNamesWithExtensions function in the SDK with the "fon" and "ttf" extensions.  This will give you back an array of the files in the printer with those extensions.

          1 of 1 people found this helpful
            • Re: Install Custom font to Zebra Printer iMZ320 from iOS application
              Steven Si

              Check out the FileUtil class in the SDK API Doc for iOS. The FileUtil provides APIs to retrieve the filenames from and send file content to the printer. They can be used for install fonts.

              • Re: Install Custom font to Zebra Printer iMZ320 from iOS application
                Mary Nisha

                HI Robin,

                 

                Thanks for your replay. The retrieveFileNamesWithExtensions gives the array of files correctly. I can see the custom font name in the list but that's not present in the configuration file Resident font section (please find the attached images for details).

                IMG_20171130_153845.jpg

                 

                I have used the "CISDFCRC16 " command to write the font file to the printer. Here is my code :

                 

                self.connection = [[MfiBtPrinterConnection alloc] initWithSerialNumber:serialNumber];

                    NSError *error = nil;

                    [self.connection open];

                    self.printer = [ZebraPrinterFactory getInstance:self.connection error:&error];

                    NSLog(@"0x%08x",10);

                  

                    if(error != nil) {

                      

                        [_delegate printFailedWithError:[error localizedDescription]];

                    }

                    else

                    {

                        NSError *error =  nil;

                      

                        NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"B12B" ofType:@"fon"]];

                        unsigned char aBuffer[20];

                        NSString *command = [NSString stringWithFormat:@"! CISDFCRC16\r\n0000\r\nE:B12B.cpf\r\n0x%08lx\r\n0000\r\n,%@",(unsigned long)data.length,data];

                        NSMutableData *data1 = [NSMutableData dataWithData:[NSData dataWithData:[command dataUsingEncoding:NSUTF8StringEncoding]]];

                        [data1 appendData:data];

                       NSInteger write =  [self.connection write:data1 error:&error];

                        NSArray *fileNames = [[self.printer getFileUtil]retrieveFileNames:&error];

                        NSLog(@"write = %ld",(long)write);

                        NSLog(@"fileNames = %@",fileNames);

                }

                But the device is  not printing any ZPL language that I send to printer.

                 

                Please help me to identify the issue with my code. I am in a critical situation.