3 Replies Latest reply on May 19, 2015 8:57 AM by Robin West

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

    Jon-Luke West

      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!

        • Re: How do I convert an image to hex for use with ~DG ZPL code?
          Robin West

          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.