rkone / sharpzebra

A .net library that simplifies printing to Zebra printers in their native EPL2/ZPL languages without needing to know EPL2 or ZPL.
MIT License
91 stars 34 forks source link

TLP 2844 EPLCommands code issues #2

Closed DrahcireD closed 7 years ago

DrahcireD commented 7 years ago

First of all a big thanks for this awesome code. We've been using it on GK420t's for a few months now!

But now, there's the TLP2844 :S

I can't get it to work. I know it does not support ZPL commands so:

ps.PrinterName = "ZDesigner TLP 2844"; ps.Width = 203 4; ps.Length = 203 4; ps.Darkness = 30;

Barcode bar = new Barcode(); bar.Type = BarcodeType.CODE128_AUTO; bar.BarWidthNarrow = 3;

List page = new List(); page.AddRange(EPLCommands.ClearPrinter(ps));

page.AddRange(EPLCommands.TextWrite(20, 20, ElementDrawRotation.NO_ROTATION, ZebraFont.STANDARD_NORMAL, 1, 1, false, "SOME TEXT", ps)); page.AddRange(EPLCommands.BarCodeWrite(20, 50, 100, ElementDrawRotation.NO_ROTATION, bar, false, "SOME TEXT", ps));

page.AddRange(EPLCommands.PrintBuffer(1)); new SpoolPrinter(ps).Print(page.ToArray());

Am i missing something? The printer prints 1 empty label and then it goes into Error.

rkone commented 7 years ago

It's been a very long time since I've used EPLCommands myself. I found this library when looking to print to a TLP2844 myself, it did work back then. I'd suggest trying to print a blank page first to see if the printer still errors out. That would narrow it down to the ClearPrinter or PrintBuffer functions. If you're not using the dll, try pausing in the Spoolprinter.Print function and post the generated EPL from the data variable here.

The EPL shouldn't have any commands that aren't in the EPL2 guide ( https://www.zebra.com/content/dam/zebra/manuals/en-us/printer/epl2-pm-en.pdf )

DrahcireD commented 7 years ago

I narrowed it down to ElementDrawRotation(EDR). The TLP 2844 only accepted 0 as orientation(not the 78, 66 etc what EDR referred to). So, changed the code a bit and it works :D

ps.Width = 203 * 4; ps.Length = 309; ps.Darkness = 12; ps.PrintSpeed = 2;

Thanks mate!

rkone commented 7 years ago

Fixed in 0.9.3