Install Custom font to Zebra Printer iMZ320 from iOS application


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,

Anonymous (not verified)
Hi Mary,You can use the

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.

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Anonymous (not verified)
Check out the FileUtil class

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.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Mary Nisha
Hi Steven ,Thanks for the

Hi Steven ,

Thanks for the replay. I have used the sendFileContents method from the SDK to send font file from iOS application to the printer. But unfortunately it doesn't make any changes. The fonts are not installed. Could you please suggest any other method to install font file from iOS application ?.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Mary Nisha
HI Robin,Thanks for your

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.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments