ZPL not interpreted

Sep 11, 2014 at 2:57 PM
Hi,

I am tasked with printing a "ticket" to a Zebra MZ 320 from C#.NET.
Link to the printer

Our ticket engine generates tickets that are 600 pixels wide. Should work just fine with the resolution of 203dpi and 3 inch wide paper.

However, .net only allows for 283 pixels width when drawing to the printer. Might be some weird driver mismatch, so I was looking at your library to send the command to the printer.

When testing, the commands send through SharpZebra where printed directly to the paper, as if it does not understand the ZPL language.
Can you help me figure out what is wrong?

Many thanks in advance!!
Coordinator
Sep 11, 2014 at 3:05 PM
Strange, somehow it must have interpreted the "print" command. Does it end with the characters ^PQ1^XZ ? (ZPL for Print a page)
Sep 12, 2014 at 7:13 AM
Hi,

I was just trying out your example code:
        var zebraPrinterSettings = new Com.SharpZebra.Printing.PrinterSettings();
        zebraPrinterSettings.PrinterName = "ZDesigner MZ 320";
        zebraPrinterSettings.Width = 203 * 3;
        zebraPrinterSettings.Length = 203 * 1;
        zebraPrinterSettings.Darkness = 30;

        var page = new List<byte>();

        page.AddRange(Com.SharpZebra.Commands.ZPLCommands.ClearPrinter(zebraPrinterSettings));
        page.AddRange(Com.SharpZebra.Commands.ZPLCommands.TextWrite(10, 10, ElementDrawRotation.NO_ROTATION, 12, "Hellooooooo world !!?"));
        page.AddRange(Com.SharpZebra.Commands.ZPLCommands.PrintBuffer(1));

        var spoolPrinter = new Com.SharpZebra.Printing.SpoolPrinter(zebraPrinterSettings);
        spoolPrinter.Print(page.ToArray());
This translates to:

Clear command:
"^XA^MMT^PR0,12,12~TA000^LH0,0~SD30^PW609"
"0x94 0x88 0x65 0x94 0x77 0x77 0x84 0x94 0x80 0x82 0x48 0x44 0x49 0x50 0x44 0x49 0x50 0x126 0x84 0x65 0x48 0x48 0x48 0x94 0x76 0x72 0x48 0x44 0x48 0x126 0x83 0x68 0x51 0x48 0x94 0x80 0x87 0x54 0x48 0x57"

Text command:
"^A@N,12^FO10,10^FDHellooooooo world !!?^FS"
"0x94 0x65 0x64 0x78 0x44 0x49 0x50 0x94 0x70 0x79 0x49 0x48 0x44 0x49 0x48 0x94 0x70 0x68 0x72 0x101 0x108 0x108 0x111 0x111 0x111 0x111 0x111 0x111 0x111 0x32 0x119 0x111 0x114 0x108 0x100 0x32 0x33 0x33 0x63 0x94 0x70 0x83"

Print command:
"^XZ"
"0x94 0x88 0x90"

Thanks for your quick response!
Coordinator
Sep 12, 2014 at 12:15 PM
Ok, but what showed up on the printed page? You said in your first post the commands were printed on the paper. Does the print command tell the printer to print and then also get printed by the printer? That seems strange. It sounds like the commands are being processed and printed by the driver. Is the printer connected wirelessly - can you print to the printer through the network instead of to the windows driver?
zebraPrinterSettings.PrinterType='N'
zebraPrinterSettings.PrinterName="192.168.1.151"
Sep 12, 2014 at 12:39 PM
Hi,

The printer literally wrote out "^XA^MMT^PR0,12,12~TA000^LH0,0~....."
Right now, it is connected through USB, any other print command (from windows, irfanview or even .net) works just fine.

Do you have any more suggestions?

Thanks for your effort, I really appreciate this!
Coordinator
Sep 12, 2014 at 9:59 PM
What if you set:
zebraPrinterSettings.PrinterType='U';
zebraPrinterSettings.PrinterName="ZDesigner MZ 320";