Sample code print label in blank

Aug 24, 2014 at 1:08 AM
Hi,
I'm completely new to this printers. So I tried the code sample on the quick start guide as is, but nothing is printed, the label is fed, but completed blank.

I also tried the test project on rev. 96133, but nothing happens at all.

My printer is a Zebra S400, and I'm using a driver from www.nicelabel.com in Win7.

Any hint?

Thanks in advance.
Coordinator
Aug 24, 2014 at 4:50 PM
Edited Aug 24, 2014 at 4:51 PM
Hi Rob,

Sorry, I haven't gotten around to figuring out the commit process yet on the source code tab, for now just use the download tab - that is the latest version.
Usually a blank label means your printer wants you to set the size of the label. Try setting it like this:
PrinterSettings p = new PrinterSettings();
p.PrinterName = "Zebra S400";
p.Darkness = 30;
p.Width = 203*4; //for a 203dpi printer head and a 4 inch width label 
p.Length = 203*6;

List<byte> res = new List<byte>();
res.AddRange(ZPLCommands.ClearPrinter(p));
res.AddRange(ZPLCommands.TextWrite(50, 50, ElementDrawRotation.NO_ROTATION, ZebraFont.STANDARD_NORMAL, 50, 50, "Hello"));
res.AddRange(ZPLCommands.PrintBuffer(1));
new SpoolPrinter(p).Print(res.ToArray());
Coordinator
Aug 24, 2014 at 4:57 PM
Since I've seen 2 or 3 people that needed to have the width and height set, I've updated the quickstart guide to include it also.