Search code examples
c#printingzebra-printers

printing in Zebra Z4M Plus 203dpi C#


I create a program where its objective is to monitor the Fixed asset. One part of the system is print barcode in the zebra z4m plus 203dpi. how can I print on that device? I already try but the printed barcode is blurred. I use the bitmap and print it using the PrintDocument function of c#. enter image description here


Solution

  • You have to create a string with your ZPL code then send it to Z4M.

    Can see how to do here : .NET code to send ZPL to Zebra printers

    or with SharpZebra :

    1) Install a Zebra Printer so it's accessible on your Print Queue (we're going to assume the name of your printer is ZDesigner S4M-203dpi ZPL).

    2) Add a reference to the SharpZebra libraries to your project

    3) Write the code below to print a label into a class

    4) Run the code

    PrinterSettings ps = new PrinterSettings();
    ps.PrinterName = "ZDesigner S4M-203dpi ZPL";
    ps.Width = 203 * 4;
    ps.Length = 203 * 6;
    ps.Darkness = 30;
    
    List<byte> page = new List<byte>();
    page.AddRange(ZPLCommands.ClearPrinter(ps));
    
    page.AddRange(ZPLCommands.TextWrite(10, 150, ElementDrawRotation.NO_ROTATION, ZebraFont.STANDARD_NORMAL, 15, "Hello World!"));
    
    page.AddRange(ZPLCommands.PrintBuffer(1));
    new SpoolPrinter(ps).Print(page.ToArray());