compact-frameworkwindows-cezebra-printersmotorolahandheld

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. 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. IOW, the QL220 belt printer, instead of converting the commands to actions, or barcodes, it prints stuff like this directly on the label:

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...???

UPDATE

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)!?

UPDATE 2

Note: My QLn220 Zebra printer does have a usb port (the older QL220, which is the one that was causing the problems, does not). When I sent it the "what language are you using" (getDeviceLang) command using Zebra Setup Utils, it responded with, "hybrid_xml_zpl"


Solution

  • Hybrid zpl combines both CPCL and ZPL print commands.

    Receipt printers (imz, em220...etc) are set originally from factory in Line print mode. Some of the older QL220 are as well. Its best to set them to Hybrid and you should have no problems.

    Brent Arrowhead Corp - Zebra ISV