Image printing

To print images on the ZQ510, I use the following:

 

Store images

 

// Store the BSS image on the printer image = [UIImage imageNamed:@"bss-train-logo-v2.png"]; [graphicsUtil storeImage:@"BSS_V2" withImage:[image CGImage] withWidth:image.size.width andWithHeight:image.size.height error:&error];  // Store the Cemetery image on the printer image = [UIImage imageNamed:@"cemetery-tour-logo-v3.png"]; [graphicsUtil storeImage:@"CEMETERY_V3" withImage:[image CGImage] withWidth:image.size.width andWithHeight:image.size.height error:&error]; NSLog(@"Cemetery Image Error: %@", error);

 

Recall Images

 

printString = [NSString stringWithFormat:@"%@^FO50,%ld^XGE:%@.GRF,1,1^FS", printString, length, @"BSS_V2"]; length += 75;  printString = [NSString stringWithFormat:@"%@^FO50,%ld^XGE:%@.GRF,1,1^FS", printString, length, @"CEMETERY_V3"]; length += 160; 

 

Sometimes, the images print perfectly. Other times (about 25-50%), one or both of the images does not print. The rest of the receipt is printed as expected. Any ideas?

Anonymous (not verified)
Hi Jeffrey,Thank you for

Hi Jeffrey,

Thank you for sharing your code. Let me take a look at your code and some documentation here and I will get back to you with next steps.

Thank you,

Beverly

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jeffrey 2amdbpw...
Thanks, Beverly. Please let

Thanks, Beverly. Please let me know if I can provide anything to help troubleshoot this. We are anxious to test these printers in the field.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jeffrey 2amdbpw...
Has any progress been made on

Has any progress been made on this issue? Is there a way to escalate it?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Jeff,I have been looking at

Jeff,


I have been looking at your code and was trying to replicate it here on my laptop.

For this line: printString = [NSString stringWithFormat:@"%@^FO50,%ld^XGE:%@.GRF,1,1^FS", printString, length, @"BSS_V2"];  


My understanding of what is happening is that "BSS_V2" is substituted in for the %@ for the image name in XGE, and length for the %1d, which would be the y-axis on the field origin command, I am assuming length is a long variable declared elsewhere. The printString variable is substituted at the beginning of the format %@ before the ^FO command correct? What does printString contain?

Could you share with me what data printString contains and also the line of code where you send printString down to the printer to be printed?

Are these images being printed above the rest of the receipt data, at the bottom or somewhere in the middle?

Thank you,

Beverly

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jeffrey 2amdbpw...
This gist (Zebra ZQ510 Print

This gist (Zebra ZQ510 Print Job · GitHub) shows the full code for that. You can also find the string being sent to the printer below in my debug output.

It's important to note that I can send the same exact string and get different results -- sometimes the image(s) print and sometimes not.

This line

printString = [NSString stringWithFormat:@"%@^FO50,%ld^XGE:%@.GRF,1,1^FS", printString, length, @"BSS_V2"];

is appending something like "^FO50,160^XGE:HOHO_V4.GRF,1,1^FS" to the printString and setting the Y position (which is a long) and image name accordingly. The printString is built up with other data but at that point in the process it's pretty basic:

// Spacing and length

int leftSpacing;

long length = 0;

NSString *padding;

// Start of print

NSString *printString = @"^XA^POI^PW576^MNN^LL%d^LH0,0";

// Start off with 10 dots of padding

length += 10;

NSString *imageName = @"LOGO_V5";

printString = [NSString stringWithFormat:@"%@^FO50,%ld^XGE:%@.GRF,1,1^FS", printString, length, imageName];

length += 150;

When calling the - (BOOL)printTickets:(Order *)order method, the following occurs.

This attempt DID NOT print the HOHO_V4.GRF graphic:

2015-11-04 15:16:18.835 ApplicationPOS[5489:464702] Unable to get scanner info!

2015-11-04 15:16:18.842 ApplicationPOS[5489:464702] Zebra mobile printer connected!

2015-11-04 15:16:18.939 ApplicationPOS[5489:466731] [PRINT STRING]: ^XA^POI^PW576^MNN^LL1135^LH0,0^FO50,10^XGE:LOGO_V5.GRF,1,1^FS^FO50,160^XGE:HOHO_V4.GRF,1,1^FS^A2,N,22^FO20,310^FD       Wed Nov  4^FS^A2,N,22^FO20,350^FD       Thu Nov  5^FS^A2,N,22^FO20,390^FD       Fri Nov  6^FS^A2,N,22^FO20,455^FD        1 Adult^FS^FO100,520^B7N,8,5,7,14,N^FDCSS-061-151104210702731^FS^A2,N,12,12^FO20,660^FDTERMINAL 061           11/04/2015 15:07:02 PM^FS^A2,N,12,12^FO20,685^FDOrder Number:         CSS-061-151104210702731^FS^A2,N,12,12^FO20,735^FD       Present Ticket to Bus Operator.^FS^A2,N,12,12^FO19,735^FD       Present Ticket to Bus Operator.^FS^A2,N,12,12^FO20,736^FD       Present Ticket to Bus Operator.^FS^A2,N,12,12^FO20,760^FD   All Passengers must remain seated when^FS^A2,N,12,12^FO20,785^FD   vehicle is in motion. No standing room.^FS^A2,N,12,12^FO20,810^FDSmoking, Eating, Drinking Alcoholic Beverages^FS^A2,N,12,12^FO20,835^FD         is prohibited on vehicles.^FS^A2,N,12,12^FO20,860^FDRoute, Stops and Timing are subject to change^FS^A2,N,12,12^FO20,885^FD   All sales are final. Non-transferable.^FS^A2,N,12,12^FO20,910^FD          No refunds. No exchanges.^FS^A2,N,12,12^FO20,935^FD                 THANK YOU!^FS^A2,N,12,12^FO20,1035^FD ----------------------------------------------^FS^XZ

2015-11-04 15:16:19.257 ApplicationPOS[5489:466731] ERROR: (null)

2015-11-04 15:16:19.264 ApplicationPOS[5489:466731] Printing receipt...

2015-11-04 15:16:19.529 ApplicationPOS[5489:466731] ZEBRA: Language error: (null)

2015-11-04 15:16:20.508 ApplicationPOS[5489:466731] ZEBRA: Connection error: (null)

2015-11-04 15:16:22.308 ApplicationPOS[5489:466731] ZEBRA: Graphics error: (null)

2015-11-04 15:16:22.315 ApplicationPOS[5489:466731] [PRINT STRING]: ^XA^POI^PW576^MNN^LL695^LH0,0^FO50,10^XGE:LOGO_V5.GRF,1,1^FS^A2,N,24,24^FO30,160^FD   RECEIPT ONLY^FS^A2,N,12,12^FO20,220^FDTERMINAL 061           11/04/2015 15:07:02 PM^FS^A2,N,12,12^FO20,245^FDOrder Number:         CSS-061-151104210702731^FS^A2,N,12,12^FO20,295^FDAdult (1 @ $39.00)                     $39.00^FS^A2,N,12,12^FO20,370^FDTOTAL                                  $39.00^FS^A2,N,12,12^FO19,370^FDTOTAL                                  $39.00^FS^A2,N,12,12^FO20,371^FDTOTAL                                  $39.00^FS^A2,N,12,12^FO20,420^FDCASH                                   $40.00^FS^A2,N,12,12^FO19,420^FDCASH                                   $40.00^FS^A2,N,12,12^FO20,421^FDCASH                                   $40.00^FS^A2,N,12,12^FO20,445^FD  Transaction ID:        56705d0d35835d0f120d^FS^A2,N,12,12^FO20,495^FDCHANGE:                                 $1.00^FS^A2,N,12,12^FO19,495^FDCHANGE:                                 $1.00^FS^A2,N,12,12^FO20,496^FDCHANGE:                                 $1.00^FS^A2,N,12,12^FO20,545^FD   All sales are final. Non-transferable.^FS^A2,N,12,12^FO20,570^FD          No refunds. No exchanges.^FS^A2,N,12,12^FO20,595^FD                 THANK YOU!^FS^XZ

2015-11-04 15:16:22.626 ApplicationPOS[5489:466731] ERROR: (null)

This attempt DID print the HOHO_V4.GRF graphic.

2015-11-04 15:18:48.835 ApplicationPOS[5489:464702] Unable to get scanner info!

2015-11-04 15:18:48.842 ApplicationPOS[5489:464702] Zebra mobile printer connected!

2015-11-04 15:18:48.880 ApplicationPOS[5489:467262] [PRINT STRING]: ^XA^POI^PW576^MNN^LL1135^LH0,0^FO50,10^XGE:LOGO_V5.GRF,1,1^FS^FO50,160^XGE:HOHO_V4.GRF,1,1^FS^A2,N,22^FO20,310^FD       Wed Nov  4^FS^A2,N,22^FO20,350^FD       Thu Nov  5^FS^A2,N,22^FO20,390^FD       Fri Nov  6^FS^A2,N,22^FO20,455^FD        1 Adult^FS^FO100,520^B7N,8,5,7,14,N^FDCSS-061-151104210702731^FS^A2,N,12,12^FO20,660^FDTERMINAL 061           11/04/2015 15:07:02 PM^FS^A2,N,12,12^FO20,685^FDOrder Number:         CSS-061-151104210702731^FS^A2,N,12,12^FO20,735^FD       Present Ticket to Bus Operator.^FS^A2,N,12,12^FO19,735^FD       Present Ticket to Bus Operator.^FS^A2,N,12,12^FO20,736^FD       Present Ticket to Bus Operator.^FS^A2,N,12,12^FO20,760^FD   All Passengers must remain seated when^FS^A2,N,12,12^FO20,785^FD   vehicle is in motion. No standing room.^FS^A2,N,12,12^FO20,810^FDSmoking, Eating, Drinking Alcoholic Beverages^FS^A2,N,12,12^FO20,835^FD         is prohibited on vehicles.^FS^A2,N,12,12^FO20,860^FDRoute, Stops and Timing are subject to change^FS^A2,N,12,12^FO20,885^FD   All sales are final. Non-transferable.^FS^A2,N,12,12^FO20,910^FD          No refunds. No exchanges.^FS^A2,N,12,12^FO20,935^FD                 THANK YOU!^FS^A2,N,12,12^FO20,1035^FD ----------------------------------------------^FS^XZ

2015-11-04 15:18:49.205 ApplicationPOS[5489:467262] ERROR: (null)

2015-11-04 15:18:49.211 ApplicationPOS[5489:467262] Printing receipt...

2015-11-04 15:18:49.485 ApplicationPOS[5489:467244] ZEBRA: Language error: (null)

2015-11-04 15:18:50.470 ApplicationPOS[5489:467244] ZEBRA: Connection error: (null)

2015-11-04 15:18:52.274 ApplicationPOS[5489:467244] ZEBRA: Graphics error: (null)

2015-11-04 15:18:52.281 ApplicationPOS[5489:467244] [PRINT STRING]: ^XA^POI^PW576^MNN^LL695^LH0,0^FO50,10^XGE:LOGO_V5.GRF,1,1^FS^A2,N,24,24^FO30,160^FD   RECEIPT ONLY^FS^A2,N,12,12^FO20,220^FDTERMINAL 061           11/04/2015 15:07:02 PM^FS^A2,N,12,12^FO20,245^FDOrder Number:         CSS-061-151104210702731^FS^A2,N,12,12^FO20,295^FDAdult (1 @ $39.00)                     $39.00^FS^A2,N,12,12^FO20,370^FDTOTAL                                  $39.00^FS^A2,N,12,12^FO19,370^FDTOTAL                                  $39.00^FS^A2,N,12,12^FO20,371^FDTOTAL                                  $39.00^FS^A2,N,12,12^FO20,420^FDCASH                                   $40.00^FS^A2,N,12,12^FO19,420^FDCASH                                   $40.00^FS^A2,N,12,12^FO20,421^FDCASH                                   $40.00^FS^A2,N,12,12^FO20,445^FD  Transaction ID:        56705d0d35835d0f120d^FS^A2,N,12,12^FO20,495^FDCHANGE:                                 $1.00^FS^A2,N,12,12^FO19,495^FDCHANGE:                                 $1.00^FS^A2,N,12,12^FO20,496^FDCHANGE:                                 $1.00^FS^A2,N,12,12^FO20,545^FD   All sales are final. Non-transferable.^FS^A2,N,12,12^FO20,570^FD          No refunds. No exchanges.^FS^A2,N,12,12^FO20,595^FD                 THANK YOU!^FS^XZ

2015-11-04 15:18:52.593 ApplicationPOS[5489:467244] ERROR: (null)

If you compare the print strings in each, they are exactly the same. Aside from the graphic not printing, the two prints are identical coming out of the printer. It's as if the printer just skips over images randomly. It's not always the same image that gets skipped either.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jeffrey 2amdbpw...
Hi Beverly,I was wondering if

Hi Beverly,

I was wondering if there was any progress made on this issue. Please let me know if I can provide any other information or if phone support is an option.

Thanks,

Jeff

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jeffrey 2amdbpw...
Also, I updated to the newest

Also, I updated to the newest release (iOS 1.4.948), but the problem persists.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Jeffrey,It appear many

Hi Jeffrey,

It appear many people are seeing the same or a similar issue, I am still working on replicating the issue with your code here. Thank you for the git hub link.

What firmware is on the printer you are using? What version of Xcode are you running? What iOS test device and iOS version are you running? I want to gather this data to compare the issues between users and with what I am testing with.

Thank you,

Beverly

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
What resolutions are the

What resolutions are the images that you are sending to the printer? Could you check something else for me please, try printing and depending on which image is not printed, check and see if the image was stored onto the printer successfully.

Per this article, with the older SDK it sometimes helped to change a BT Timeout value, I know that you said that you updated to the latest SDK but would you try setting setTimeToWaitAfterReadInMilliseconds and  setTimeToWaitAfterWriteInMilliseconds to 100ms and see if the issue persists?

Thanks,

Beverly

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jeffrey 2amdbpw...
Prior to upgrading to the

Prior to upgrading to the newest SDK, I was using the methods you mentioned to set the timeouts. After updating I checked with those timeout values present and by removing them but it did not seem to resolve the problem.

As far as the image loading, I've commented out the command to load the images on each print and the images still print sporadically. If they weren't loaded, I would expect them to never print.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jeffrey 2amdbpw...
The images being sent are 72

The images being sent are 72 dpi. A sample image can be found here: Dropbox - garden-tour-logo-v2.png

The ZQ510 printer is running the V76.19.10Z firmware. Xcode is version 7.1 (7B91b).

I use two different iPads for testing: iPad 2 with iOS 8.3 and an iPad Mini 4 with iOS 9.1. The problem is present when sending jobs from both devices.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Jeff,Sorry for the delay. 

Hi Jeff,

Sorry for the delay.  You may have been affected by a bug in this firmware version that we have fixed in the newest firmware.  Can you please attempt to update the firmware on your printer and try your testing again?  The version is V76.19.13Z.

Let us know if this helps,

Robin

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


cem tuna
ZQ320 storeImage function is not running in Objective-C

Hi dear zebra experts,
I can print text in my invoice format and graphics like logo. But graphics are already in memory, i have copied it before via our android app.
Our android app can download graphics into printer memory and can print successfully. But i am facing issue with ios application and objective c.

We use printer in zpl mode and storeImage function to download images(.png format) into printer. My code is below:
[[printer getGraphicsUtil] storeImage:@"E:SIGNATURE.PNG" withImage:[image CGImage] withWidth:image.size.width andWithHeight:image.size.height error:error];

And i will print it like below if i can download it:
[strFooter appendFormat:@"^FO150,%d,^IME:SIGNATURE.PNG^FS", lastLine];

Please supply me why i can't download image into printer memory.

Thank you so much.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Alexander Palchikov
Hi cvccve

Hi cvccve

Looks like your file name is too long. It should be no more than 8 alphanumeric characters.

https://www.zebra.com/content/dam/zebra/manuals/printers/common/programming/zpl-zbi2-pm-en.pdf#page=226

 

Alexander Palchikov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies
 

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


cem tuna
ZQ320 storeImage function is not running in Objective-C

Hi Alexander, thank you for your reply.
I have just tried like below, but it didn't solve my issue.

[graphicsUtil storeImage:@"E:SIGN.PNG" withImage:[image CGImage] withWidth:image.size.width andWithHeight:image.size.height error:error];

By the way, as i said before we have two app (android and ios)
In android app, we have succeeded to download png file into printer memory like below code.

Bitmap bitmapsign = BitmapFactory.decodeFile(filePath);
printer.storeImage("E:SIGNATURE.PNG", new ZebraImageAndroid(bitmapsign), 250, 250);

I don't understand why i can't download file in ios app.
Have you any full source code in objective-c to downlaod and print image file in zebra printer?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


cem tuna
ZQ320 storeImage function is not running in Objective-C

And I forgot to tell you that zebra's sample ios app also can't succeed storeImage function.

https://github.com/ZebraDevs/LinkOS-iOS-Samples/tree/ZSDK_DevDemos

Could you please check this function for ZQ320 if you have?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments