I'm trying to use the Link-OS SDK to send images to a Zebra iMZ320 printer using the GraphicsUtil class in XCode for iOS.
-(void)printImage:(UIImage *)image{
NSString *serialNumber = @"";
EAAccessoryManager *sam = [EAAccessoryManager sharedAccessoryManager];
NSArray * connectedAccessories = [sam connectedAccessories];
for (EAAccessory *accessory in connectedAccessories) {
if([accessory.protocolStrings indexOfObject:@"com.zebra.rawport"] != NSNotFound){
serialNumber = accessory.serialNumber;
break;
}
}
self.connection = [[MfiBtPrinterConnection alloc] initWithSerialNumber:serialNumber];
NSError *error = nil;
BOOL success = [self.connection open];
self.printer = [ZebraPrinterFactory getInstance:self.connection error:&error];
//Set the device language to zpl or the image prints its HEX value
[SGD SET:@"device.languages" withValue:@"zpl" andWithPrinterConnection:self.connection error:&error];
id<GraphicsUtil, NSObject> graphicsUtil = [self.printer getGraphicsUtil];
success = [graphicsUtil printImage:[image CGImage] atX:0 atY:0 withWidth:200 withHeight:200 andIsInsideFormat:NO error:&error];
}
The image prints correctly but the printer feeds about 9 inches of blank paper before printing the image. I tried to set the "media.tof" var to 0 and tried to send the SETFF 50 2 command, with no luck. Any hints ? Thanks!
iOS
tag for you now - for future questions you might want to be clearer about the platform, since Xcode, as noted, is just an IDE. – Lunate