Zebra Printer Prints images that are cut off

| | August 7, 2015

I’m attempting to print images from iOS devices with a Zebra QLn220 and the link_os_sdk. The image is 719×1248 pixels, but half of the image is always cut off when printed. I’ve set the printer’s label size to 1.8in by 4in via Zebra Setup Utilities, which appears to print out 3 inches of blank label and a small section of the image. I’ve also tried scaling the image to half it’s original size with no luck. What can I do to get the entire image to display on the label?

-(void)printImageButtonTapped : (DiscoveredPrinter *)discoveredPrinter {
    NSString* filePath = [[NSBundle mainBundle] pathForResource:@"jpegsample"
                                                         ofType:@"jpeg"];
    self.connection = [[TcpPrinterConnection alloc] initWithAddress:discoveredPrinter.address andWithPort:6101];
    NSError *error = nil;
    [self.connection open];
    self.printer = [ZebraPrinterFactory getInstance:self.connection error:&error];
    if(error != nil) {
        NSLog(@"Error: %@",error);
    }
    error = nil;
    if (self.printer != nil) {
        TcpPrinterConnection *zebraPrinterConnection = [[TcpPrinterConnection alloc] initWithAddress:discoveredPrinter.address andWithPort:6101];
        BOOL success = [zebraPrinterConnection open];
        success = success && [[self.printer getGraphicsUtil] printImageFromFile:filePath atX:0 atY:0 withWidth:-1 withHeight:-1 andIsInsideFormat:NO error:&error];
        [zebraPrinterConnection close];
        if (error != nil || self.printer == nil || success == NO) {
            NSLog(@"error: %@ printer: %@ success: %hhd",error,self.printer,success);
        }
    }
}

2 Responses to “Zebra Printer Prints images that are cut off”

  1. Nitin Khairnar on November 30, -0001 @ 12:00 AM

    Just do change here, it will solve ur problem for entire image to display on the label. default scale is 2.0. we need to change as per we need.

    UIGraphicsBeginImageContextWithOptions(rect.size, NO, self.view.window.screen.scale+0.75);
    after doing this – scale is 2.75

    try this it may help you. because, I have same problem, so just added this and get resolved my problem. enjoy!

  2. The QLn220 is a 2″ printer @ 200dpi, so that means the max width you can get is about 400 dots. Try changing your print image line to something like this to scale the image before printing

    success = success && [[self.printer getGraphicsUtil] printImageFromFile:filePath atX:0 atY:0 withWidth:300 withHeight:500 andIsInsideFormat:NO error:&error];
    

    It might be a distorted image, but it shouldn’t cut off

Leave a Reply