ZSDK API to get media size of Printer?


Audience

Hello,

I was looking for an API in ZSDK documentation that can return the media size of any Zebra printer but I couldn't find any.

So if my Android app wants to support multiple Zebra printers with different media sizes, is there a way I can programmatically query the media size at runtime? Accordingly I can insert line-breaks to fit my content on a given media.

P.S.: My question arises from how to manage different font sizes and their text wrap on different printers. Also is there a way to query the width in dots for a given text in a given font?

Submitted by SSi1 on March 14, 2022 Permalink

Assuming the media.type is set to label (not to journal), then calling the SGD API on the zpl.label_length and ezpl.print_width will return the label's width and length. Please note that the zpl.label_length is automatically set during the medial calibration process. The ezpl.print_width is set by the user, for example, the 2" wide label medial roll can be used in a 4" wide printer.

Regarding the question about the font size, with scalable font, you can choose any height and width in dots with ^A command