Check printer in ZPL mode (iOS & Android)

// Expert user has replied.
S Shawn Rehill 3 years 7 months ago
230 2 0

Hi
 
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?
 
Thanks!

Please Register or Login to post a reply

2 Replies

Y Yusuf Unlu

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

conn.open();

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

ZebraPrinter zPrinterIns = ZebraPrinterFactory.getInstance(conn);
zPrinterIns.sendCommand("^FO350,50^AGR^FDwhatever,milk,butter,salt^FS");

Thread.sleep(500);
conn.close();

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

Can u help me pls ?

M 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:

Android:

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

iOS:

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

Check Printing language:

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

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

Links to sample Code implementing Best practices in Printing Apps
https://km.zebra.com/kb/index?page=answers&type=search&searchid…

Blog

Forum Question
https://developer.zebra.com/message/84193#84193

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

Thanks,
MC

CONTACT
Can’t find what you’re looking for?