获取 Zebra 打印机标签的宽度(以点为单位)?
Getting the width (in dots) of a Zebra printer's label?
如何获得 Zebra 打印机标签的宽度(以点为单位)?
I see that PrinterStatus
contains this property:
- (NSInteger) labelLengthInDots
描述如下:
The length of the label in dots. For CPCL printers this is always 0.
它非常适合查找以点为单位的标签长度,但我还需要以点为单位的标签宽度。是否可以获得以点为单位的标签宽度?
这将 return 标签的打印宽度(以点为单位):
NSError *getError;
NSString *width = [SGD GET:@"ezpl.print_width" withPrinterConnection:printerConnection error:&getError];
默认情况下,这是打印机头的宽度。要计算出以点为单位的标签宽度,您需要将其以英寸为单位的尺寸乘以打印机的 dpi。我的打印机是 230 dpi,带有 3 英寸宽的标签,所以它的宽度(以点为单位)是 690。
我需要使用 SGD SET 将我的 print_width 设置为 690。
[SGD SET:@"ezpl.print_width" withValueAsInt:690 andWithPrinterConnection:connection error:error];
我在常规界面找不到它,但是如果你得到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"];
如何获得 Zebra 打印机标签的宽度(以点为单位)?
I see that PrinterStatus
contains this property:
- (NSInteger) labelLengthInDots
描述如下:
The length of the label in dots. For CPCL printers this is always 0.
它非常适合查找以点为单位的标签长度,但我还需要以点为单位的标签宽度。是否可以获得以点为单位的标签宽度?
这将 return 标签的打印宽度(以点为单位):
NSError *getError;
NSString *width = [SGD GET:@"ezpl.print_width" withPrinterConnection:printerConnection error:&getError];
我需要使用 SGD SET 将我的 print_width 设置为 690。
[SGD SET:@"ezpl.print_width" withValueAsInt:690 andWithPrinterConnection:connection error:error];
我在常规界面找不到它,但是如果你得到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"];