8 Replies Latest reply on Jul 3, 2018 9:03 AM by andrea schiabel

    B64 or Z64 with Zebra SDK ??

    daniel Ppe


      How to get B64 or Z64 and CRC with the SDK Zebra(android) to print with zpl with this command:


      ~DYE:IMAGE,P,P,46080,46080,:B64:  .......






      Thank you very much!!

        • Re: B64 or Z64 with Zebra SDK ??
          Robin West

          Hi Daniel,

          You wouldn't need to do any of the conversion yourself.  Just use the printer.printImage() or printer.storeImage() API's.  They take PNG, JPG, and BMP file formats.

          Link-OS SDK - Zebra Technologies Techdocs  - look at the GraphicsUtil class for some sample code.

          1 of 1 people found this helpful
            • Re: B64 or Z64 with Zebra SDK ??
              daniel Ppe

              Thank you very much I have worked!

              Just one last question, how do I get it into zpl?

              What is the ZPL command to display it there ....



              Thank you!!!

                • Re: B64 or Z64 with Zebra SDK ??
                  Robin West

                  Hi Daniel, You can use the storeImage() command before sending the zpl and then use the ^FO in combination with the ^IM command to modify the location in your ZPL:





                  X and Y coordinates are generally for the top left corner of the image.


                  Or you can use the printImage() inside format to place it.

                  String zplStart = "^XA...";

                  String zplEnd = "...^XZ";


                  printer.printImage("myImage.png", 10, 608, 0, 0, true);



                  I can't give you specifics for the X and Y locations because I don't know how big your receipt is, or exactly how far down the page it is.

                  1 of 1 people found this helpful
                • Re: B64 or Z64 with Zebra SDK ??
                  Tim Borowsky

                  Hello Robin,


                  Is there a B64 algorithm in an SDK for the .NET Framework? I require it for some software I am developing.




                    • Re: B64 or Z64 with Zebra SDK ??
                      Robin West

                      Hi Tim, Sorry this is coming to you so late, but it might help others who need it.  The Zebra .Net SDK has a ConvertGraphic() function to convert an image into a B64 encoded PNG image. You can use this without ever opening the connection to a printer.  It does add a ZPL download header, but you can remove it by searching for the string ":B64:" and removing everything before that.  The filePathOnPrinter must have the PNG extension to convert to a B64 image.


                      MemoryStream ms = new MemoryStream();
                      ZebraImageI image = ZebraImageFactory.GetImage(pathOnComputer);
                      PrinterUtil.ConvertGraphic("E:IMAGE.PNG", image, ms);
                      ms.Write(buffer, 0, ms.Length);

                      There are also likely 3rd party libraries to do this.

                        • Re: B64 or Z64 with Zebra SDK ??
                          andrea schiabel

                          Hi Robin.


                          I'm trying to have a ZPL code from a JPG image ....but the result of the ConvertGraphic funciton is not correctly printed by our Zebra ZT230.


                          These are the few code lines (Vb.Net - I wrote the ZPL in a file):

                                  Dim Fs As System.IO.FileStream

                                  Dim Ms As New System.IO.MemoryStream

                                  Dim Im As Sdk.Graphics.ZebraImageI

                                  Im = ZebraImageFactory.GetImage("C:\Zebra\150_00_00_02.jpg")

                                  Sdk.Printer.PrinterUtil.ConvertGraphic("c:\Zebra\IMAGE.PNG", Im, 20, 20, Ms)

                                  Fs = New IO.FileStream("C:\Zebra\ZPL.txt", IO.FileMode.Create)



                          I tried to put the result of the ZPL.txt file after the ZPL command ^GFA ....but I don't know how to set the three parameters of the ^GF command ....and ....in any case the image printed is not the same as the source jpg.


                          Where I go wrong ?


                          Thank you in advance !