How do I convert an image to hex for use with ~DG ZPL code?

I am using the Zebra SDK with Java on Android.

 

I need to print an image as part of a receipt-type printout, but the only references I can find in the SDK documentation is for printing just an image.  ie. printer.printImage(); in the GraphicsUtil example  But I would like to convert an image for use while sending raw ZPL to the printer.  How would you recommend I accomplish this?  Should I be skipping ~DG altogether and use printer.storeImage(); and then use ^XGFILE.GRF,1,1 in ZPL?

 

Thank you very much!

Anonymous (not verified)
Hi Jon-Luke,Yes, for your use

Hi Jon-Luke,

Yes, for your use case, you do want to use the printer.storeImage() function.  The storeImage() function can convert many standard image file types, but not all, to the GRF format that the printer understands.  The storeImage() then sends the file to the printer using the ~DG or !CISDF command (I'm not sure which) so you don't have to worry about it.  Then you can use the ^XG command in your print format as you have in your example. This way you only have to send the lengthy image file once per printer and it's remembered.  It shortens the data you send to print each time considerably, yet you still can print nice logos.   printImage() is more designed for if your entire label is an image file.

Robin

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jon-Luke West
Great to know Robin.On a

Great to know Robin.

On a related note, if I push an image file with printer.storeImage() using a file name that already exists on the printer will it overwrite?  I want to avoid accidentally filling up the printer memory with orphaned files while I am developing.

Thanks a bunch!

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Yes it will overwrite. 

Yes it will overwrite.  Depending on the printer, if you do this often, the printer will occasionally auto-defragment itself on the next power up.  Newer printer models (like the QLn, ZQ5, etc.) have more seamless built in memory management. 

Robin

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Log in to post comments