Hi Robin ,
I am an iOS developer. I need to install some fonts in zebra iMZ320 from my iOS application. I used the CISDFCRC16 command,But printer is not printing anything.
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 ?
You do not need to base64 encode the TTF file. The binary TTF file should work fine here. You might want to look into the FileUtil functions as well to send the file and verify it got sent.
Thank you for your reply.
I used FileUtil function for sending TTF file to the printer but it fails to write.
So I tried the code below to write file(A7.CPF) to the printer, it works fine and I am able to see this in the font listing section of device configuration. You can see that in the screenshot below. But the device is not printing any ZPL language that I send to printer. Please check my code below and share your comments.
NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"A10B" ofType:@"fon"]];
unsigned char aBuffer;
NSString *command = [NSString stringWithFormat:@"! CISDFCRC16\r\n0000\r\nE:A10B.cpf\r\n0x%08lx\r\n0000\r\n,%@",(unsigned long)data.length,data];
// const char *utfString = [command UTF8String];
NSMutableData *data1 = [NSMutableData dataWithData:[NSData dataWithData:[command dataUsingEncoding:NSUTF8StringEncoding]]];
NSInteger write = [self.connection write:data1 error:&error];