Alexandru
Alexandru

Reputation: 12872

Getting the width (in dots) of a Zebra printer's label?

How do you obtain the width (in dots) of a Zebra printer's label?

I see that PrinterStatus contains this property:

- (NSInteger) labelLengthInDots

The description reads:

The length of the label in dots. For CPCL printers this is always 0.

Its great for finding the length of a label in dots, but I also need the width of a label in dots. Is it possible to obtain the width of a label in dots?

Upvotes: 2

Views: 15953

Answers (2)

ChrisKVesco
ChrisKVesco

Reputation: 1

I couldn't find it in the regular interface, but if you get the Link OS interface and then get the settings it's there:

Zebra.Sdk.Comm.TcpConnection tcpConn = new Zebra.Sdk.Comm.TcpConnection(ipAddress, 9100);
tcpConn.Open();

var instance = Zebra.Sdk.Printer.ZebraPrinterFactory.GetInstance(tcpConn);
var stat = instance.GetCurrentStatus();
var printer = Zebra.Sdk.Printer.ZebraPrinterFactory.CreateLinkOsPrinter(instance);
// If we have got this far the connection is successful.

var settings = printer.GetAllSettings();
var pw = settings["ezpl.print_width"];

Upvotes: 0

Eric Mentele
Eric Mentele

Reputation: 1050

This will return the print width of the label in dots:

NSError *getError;
NSString *width = [SGD GET:@"ezpl.print_width" withPrinterConnection:printerConnection error:&getError];

enter image description here This is the width of your printer head by default. To figure out the width of your label in dots you need to multiply it's size in inches by your printer's dpi. My printer is 230 dpi with a 3 inch wide label so it's width in dots is 690.

I need to set my print_width to 690 with SGD SET.

[SGD SET:@"ezpl.print_width" withValueAsInt:690 andWithPrinterConnection:connection error:error];

Upvotes: 4

Related Questions