简体   繁体   English

获取 Zebra 打印机标签的宽度(以点为单位)?

[英]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?如何获得 Zebra 打印机标签的宽度(以点为单位)?

I see that PrinterStatus contains this property : 我看到PrinterStatus包含此属性

- (NSInteger) labelLengthInDots

The description reads:描述如下:

The length of the label in dots.标签的长度(以点为单位)。 For CPCL printers this is always 0.对于 CPCL 打印机,这始终为 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?是否可以以点为单位获得标签的宽度?

This will return the print width of the label in dots:这将以点为单位返回标签的打印宽度:

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

在此处输入图片说明 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.要以点为单位计算标签的宽度,您需要将其尺寸(以英寸为单位)乘以打印机的 dpi。 My printer is 230 dpi with a 3 inch wide label so it's width in dots is 690.我的打印机是 230 dpi,带有 3 英寸宽的标签,所以它的宽度(以点为单位)是 690。

I need to set my print_width to 690 with SGD SET.我需要使用 SGD SET 将我的 print_width 设置为 690。

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

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:我在常规界面中找不到它,但是如果您获得 Link OS 界面,然后获得它的设置:

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"];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM