Using ZPL patch, No text is being printed

Oct 25, 2011 at 3:22 PM

Hopefully someone is out there.  I have successfully implemented the ZPL patch except that the printer only sends out blank labels.  Nothing text is being printed.

PrinterSettings ps = new PrinterSettings();           

ps.PrinterName = "ZDesigner S4M-203dpi ZPL";
            List<byte> page = new List<byte>();                       

page.AddRange(ZPLCommands.ClearPrinter(ps));        

page.AddRange(ZPLCommands.TextWrite(1, 1, ElementDrawRotation.NO_ROTATION, 1, "Hi"));                       

page.AddRange(ZPLCommands.PrintBuffer(1));           

//new SpoolPrinter(ps).Print(page.ToArray());           

new USBPrinter(ps).Print(page.ToArray());

 

Any IDeas?

Coordinator
Oct 25, 2011 at 3:28 PM

Yep, I'm still around.

 

It's always best to specify the font you want the first time you write text.  The printer remembers the last font used and continues using that font if you don't specify.  There is a default font in most Zebra printers, just use the TextWrite overload to specify that font.

 

Rob

Oct 25, 2011 at 4:24 PM

I think my problem lies in this function:

return Encoding.GetEncoding(850).GetBytes(string.Format("^XA^MMT^PR{0},12,12~TA{1:000}^LH{2},{3}~SD{4:00}^PW{5}", settings.PrintSpeed,                 settings.AlignTearOff, settings.AlignLeft, settings.AlignTop, settings.Darkness, settings.Width+settings.AlignLeft));

This is the ClearPrinter function and after it runs, the printer doesn't print any text.  I went into debug mode and saw that everything was being set to 0.  Once I send some generic text to it from Notepad it seems to fix the problem and ZPL commands from a different program will work again.  Any ideas?

Coordinator
Oct 25, 2011 at 6:40 PM

Another user had problems with this clearprinter function, they replaced it with the following:


This also helped not to set the printer properties:

 

public static byte[] ClearPrinter()
        {
            return Encoding.GetEncoding(850).GetBytes(string.Format("^XA"));
        }  

 

Also, I was able to use the NetworkPrinter @9100 only after adding "\r\n" before "^XA".


Unfortunately I don't remember the ZPL commands to say what (beyond the obvious) those in the original function set.  The options are all optional, the printer is fine continuing using the default or previous settings if you simply use the ^XA command.