4

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!

4

2 回答 2

14

This is generally a Zebra printer configuration issue. Zebra printers can be set to either continuous mode (for printing receipts) or label mode (for printing labels). Furthermore, when set to label mode, the printer could be looking for a black bar to separate labels OR a gap in between the labels. So, the most important question is: what type of media are you using?

Continuous 'receipt' paper -

If you are using continuous paper, you will want to set the label length of your print job ahead of time. You will also want to indicate that you are using continuous media. You can send these commands to do so:

! U1 setvar "ezpl.media_type" "continuous"
! U1 setvar "zpl.label_length" "500"

Labels with black bars in between -

If you are using black bar labels, you need to send this SGD commands to the printer:

! U1 setvar "ezpl.media_type" "mark"

Labels with gaps in between -

If you are using labels with gaps in between, the following SGD command needs to be sent:

! U1 setvar "ezpl.media_type" "gap/notch"

(Notice the commands above are in ! U1 SGD notation. You can simply use the SDK 'SGD' calls as you see in your code to accomplish the same effect)

于 2013-10-15T23:12:30.363 回答
0

我无法发表评论,但我必须在这里添加。据我所知,接受的答案不是保存在打印机中的参数。每次重启打印机时它都会重置。

要使上述方法正常工作,您需要在每次开机并连接到打印机时发送 setvar 命令,否则它将被重置。

至少在运行固件 V73.19.13Z(当前最新版本)的 Zebra iMZ220 中发现这是正确的。

我还注意到您可以使用 Zebra Config Utility (v1.1.9.1122) 配置媒体类型。在“配置打印机设置”下,您可以设置日志/黑标/间隙感。您也可以在打印后设置进纸长度。但是,如果您保存文件并将其发送到打印机并查看配置文件,则其中没有介质类型或进纸长度的配置。

Zebra 支持人员尚未能够识别他们存在问题或指出解决方案。:/

于 2016-01-13T22:38:04.263 回答