[英]Why would CPCL code sent to a Zebra QLn220 printer work, whereas the same code does NOT work when sent to a Zebra QL220?
Based on user preferences (type of label selected, and whether to send a "Keep Alive" message), different CPCL commands are sent from a handheld device to a Zebra QL[n]220 belt printer. 根据用户首选项(所选标签的类型以及是否发送“保持活动”消息),将不同的CPCL命令从手持设备发送到Zebra QL [n] 220皮带打印机。 This code:
这段代码:
const string quote = "\"";
string keepPrinterOn = string.Format("! U1 setvar {0}power.dtr_power_off{0} {0}off{0}", quote);
string shutPrinterOff = string.Format("! U1 setvar {0}power.dtr_power_off{0} {0}on{0}", quote);
string advanceToBlackBar = string.Format("! U1 setvar {0}media.sense_mode{0} {0}bar{0}", quote);
string advanceToGap = string.Format("! U1 setvar {0}media.sense_mode{0} {0}gap{0}", quote);
...works for the (newer) QLn220 printer, but on the (older) QL220, rather than the printer receiving the commands and acting on them, it simply prints the raw commands onto the labels. ...适用于(较新的)QLn220打印机,但在(较旧的)QL220上,而不是打印机接收命令并对其执行操作,它只是将原始命令打印到标签上。 IOW, the QL220 belt printer, instead of converting the commands to actions, or barcodes, it prints stuff like this directly on the label:
IOW,QL220带式打印机,而不是将命令转换为动作或条形码,而是直接在标签上打印以下内容:
0 200 200 241 1
RIGHT
TEXT 4 3 0, 0 0.75
LEFT
TEXT 5 0 0 90 DRPEPPER (7X2) = 14
CENTER
BARCODE UPCA 1 1 50 0 137 054900000295
FORM
PRINT
Is it that something changed between the QL220 and the QLn220 as to the CPCL protocol, or...??? QL220和QLn220之间关于CPCL协议是否有所更改,还是... ???
Well, this is bizarre; 好吧,这很奇怪。 oddly enough, I added this code:
奇怪的是,我添加了以下代码:
string getDeviceLang = string.Format("! U1 getvar {0}device.languages{0}", quote);
string setDeviceLangZPL = string.Format("! U1 setvar {0}device.languages{0} {0}ZPL{0}", quote);
. . .
String deviceLanguage = PrintUtils.GetSettingFromPrinter(getDeviceLang);
MessageBox.Show(deviceLanguage);
if (deviceLanguage.Equals("line_print"))
{
PrintUtils.SendCommandToPrinter(setDeviceLangZPL);
}
...and although the call to GetSettingFromPrinter() returns an empty string (as seen in MessageBox.Show), the printing therefater works as desired anyway (it prints the labels as desired, instead of just printing the raw commands onto them)!? ...虽然对GetSettingFromPrinter()的调用返回了一个空字符串(如MessageBox.Show中所示),但是无论如何,打印该打印机还是可以按需进行的(按需要打印标签,而不仅仅是在其上打印原始命令)! ?
Note: My QLn220 Zebra printer does have a usb port (the older QL220, which is the one that was causing the problems, does not). 注意:我的QLn220 Zebra打印机确实有一个USB端口(不是引起问题的较早QL220的端口)。 When I sent it the "what language are you using" (getDeviceLang) command using Zebra Setup Utils, it responded with, "hybrid_xml_zpl"
当我使用Zebra Setup Utils向其发送“您正在使用哪种语言”(getDeviceLang)命令时,它回复为“ hybrid_xml_zpl”
Hybrid zpl combines both CPCL and ZPL print commands. 混合zpl结合了CPCL和ZPL打印命令。
Receipt printers (imz, em220...etc) are set originally from factory in Line print mode. 收据打印机(imz,em220等)最初是在工厂以行打印模式设置的。 Some of the older QL220 are as well.
一些较旧的QL220也是如此。 Its best to set them to Hybrid and you should have no problems.
最好将它们设置为“混合”,并且应该没有问题。
Brent Arrowhead Corp - Zebra ISV 布伦特箭头公司-斑马ISV
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.