4 Replies Latest reply on Feb 12, 2018 5:02 AM by Yusuf Unlu

    Check printer in ZPL mode (iOS & Android)

    Shawn Rehill



      In your document "Best Practices in Creating a printing application for Zebra printers", it sates that the application should check the printer formatting language prior to printing - our application prints in ZPL, what does the code look like to do this in both iOS and Android?


      As well, do you have any code to have your application load fonts on the printer?



        • Re: Check printer in ZPL mode (iOS & Android)
          Manuel Caicedo-Rivera

          Hi Shawn,


          We have developed several samples code in Android Studio that implemented Zebra’s best practices. Also, there is a blog that explains aspects regarding the importance of the selecting the proper printer language. I have added another link to a forum request which will help you with the font software question.


          Most of the libraries in our LINK-OS SDK support similar classes in iOS and Android. Please, follow the links below where you can compare the structure of each API.


          IOS-API Documentation

          ZSDK_API: Zebra API

          Android-API Documentation

          Zebra API for Android (build v2.9.2275)


          ZPL – Printing Language set up:




          SGD.SET("device.languages", "zpl", connection);


          SGD.SET("device.languages", "hybrid_xml_zpl", connection);




          [SGD SET:"device.languages" withValue:@"zpl" andWithPrinterConnection:zebraPrinterConnection error:&error];


          [SGD SET:"device.languages" withValue:@"hybrid_xml_zpl" andWithPrinterConnection:zebraPrinterConnection error:&error];



          Check Printing language:



          String printerLanguage = SGD.GET("device.languages",connection);



          NSString *printerLanguage = [SGD GET:"device.languages" withPrinterConnection:zebraPrinterConnection error:&error];



          Links to sample Code implementing Best practices in Printing Apps




          Aligning the Zebra Printer Driver and Printer Language with Your App


          Forum Question



          Please, let us know if the information was useful and it answered your questions.




            • Re: Check printer in ZPL mode (iOS & Android)
              Shawn Rehill

              wow - that is a thorough answer, thank you.  It looks like I have a ton of work ahead of me on this. 


              One question - should I set the device language during app initialization, or during each print command?





                • Re: Check printer in ZPL mode (iOS & Android)
                  Manuel Caicedo-Rivera

                  Hi Shawn,


                  There are several uses cases where you can decide when to add this check point step in your development logic.

                  1.) App Initialization

                  2.) When the user pairs the printer for first time with the app during his work shift.

                  3.) If the printer is working with different users, and there is a login change with a new user in the app. It is recommended to verify and set up ZPL before to send print jobs.

                  4.) If the mobile device is using different apps with the printer, and these are using different printer languages like CPCL, Line_print. It is recommended to verify and set up ZPL before to send print jobs


                  Regarding your font question, I forgot to mention that the link associated in my previous reply is when the printer is configured to work in CPCL or Line_Print.


                  For ZPL, the API includes classes and methods that allow you to do downloading and conversion of different ZPL fonts.


                  You can use the following class and interface located in the com.zebra.sdk.printer package. Please, review the links for the API documentation of my previous reply.


                  Class FontConverterZpl

                  Interface FontUtil





              • Re: Check printer in ZPL mode (iOS & Android)
                Yusuf Unlu

                Hi, I was trying to make bold characters and barcode. So I decided to change the mode to ZPL. but I couldnt




                SGD.SET("device.languages", "zpl", conn);


                ZebraPrinter zPrinterIns = ZebraPrinterFactory.getInstance(conn);






                When I debugged it it say: SGD.GET("device.languages",conn) = "line_print"


                Can u help me pls ?