5

Has used the ZebraDesigner2 software to create labels for printing ZPL, with the GC420t printer I am not having problems.

Now I have to generate ZPL code for printing labels using the S4M printers (200 dpi) and ZT230 (300 dpi) the problem is the difference in dpi of the same that makes the impression made by S4M skirt very large cutting important information. e.g.

^XA
^PW1240
^LL1724
^FT321,845^A0N,42,40^FH\^FDTeste 1234567890^FS
^PQ1,0,1,Y^XZ

I've tried using the commands below, however I have not found good examples.

^MU – Set Units of Measurement
^JM – Set Dots per Millimeter

I need print on both printers the same zpl code, can be at 200 or 300 dpi.

2 Answers 2

1

The unit of measurement on Zebra printers is dots by default. Set the unit of measurement to mm. And all the parameters in the code must be in mm.

For example

Instead of using the code below on a 203 dpi(8 dot/mm) printer

^XA
^A0N,32,32
^FT16,64
^FDTest^FS
^XZ

You can use the code below (This code will work fine on both 203 dpi(8 dot/mm) and 300 dpi(12 dot/mm) printers)

^XA
^MUm
^A0N,4,4
^FT2,8
^FDTest^FS
^MUd
^XZ

1
  • Do note that the ^FB command ignores the ^MU and always works in dots. The other commands correctly use the current unit of measurement. All Zebra manuals fail to point this out.
    – GSerg
    Commented Jul 6, 2022 at 16:31
0

I had to do a similar process with preparing labels for Zebra printers. I had to dynamically detect the resolution for the different possible printers being supported. The following code uses .net PrintServer class to get printers installed and gets the settings from that.

... 
using System.Printing;
...

var ps = new PrintServer();
var queues = ps.GetPrintQueues(
new[] { EnumeratedPrintQueueTypes.Local, EnumeratedPrintQueueTypes.Connections });

var bool Is200dpi = false;
var bool Is300dpi = false;
var int  ActualDPI = 203; // just some default    
foreach (var queue in queues)
{
   if (queue.Name.Trim().Equals( "ThePrinterOnYourMachine" ))
   {
      var pt = queue.DefaultPrintTicket;
      if (pt.PageResolution.X >= 200 && pt.PageResolution.X <= 203)
         Is200dpi = true;
      else if (pt.PageResolution.X >= 300 && pt.PageResolution.X <= 303)
         Is300dpi = true;

      ActualDPI = pt.PageResolution.X;

      // done, don't need to look at any other printers
      break;
   }
}

So, if you have some configuration setting to detect which "Label" printer per the machine, you can get this as a basis of the computation. Flag for a 200 vs 300 dpi printer so you can use a multiplier for your dimensions or size output options to build the label.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.