Reputation: 25
I have a question. I'm new to ZPL language I used zebra designer to create a label in 200dpi. If I want to make the same label but in 300dpi. What does it change in my zpl code exactly? I was thinking of the dimension, like in
^LL799
799 will change to another size, but is there anything else?
EDIT:
My goal is to create a C# application to print label on my zebra printers.
The user will choose if it's a 200dpi or a 300dpi and then the right code is sent to GenericText/Only to print on my printer (print to GenericText/Only is required I can't change that). So if you know a way to do that in C# I take it too.
Thanks in advance
Upvotes: 0
Views: 2656
Reputation: 4553
To switch resolution, the ZPL template needs to change in order for the label to be printed correctly. Basically it's just a matter of scaling by 3/2 for most fields. For example:
200dpi 300dpi
-------- --------
^FO40,40 -> ^FO60,60
^BY4 -> ^BY6
And so on. I coded a converted that does the opposite, just change the multiplier from 2/3 to 3/2 and you should be good to go:
public static void Main()
{
var evaluator = new MatchEvaluator(Converter);
const string pattern = @"(?<=\^[A-Z0-9]{2,3},?)([0-9]+,[0-9]+)";
const string input = @" ... ZPL CODE HERE";
Console.WriteLine(Regex.Replace(input, pattern, evaluator));
Console.WriteLine();
Console.WriteLine("Press any key to quit...");
Console.ReadKey();
}
public static string Converter(Match match)
{
var (w, h) = (double.Parse(match.Value.Split(',')[0]), double.Parse(match.Value.Split(',')[1]));
var (wNew, hNew) = ((int)Math.Floor(w * 2 / 3), (int)Math.Floor(h * 2 / 3));
return wNew + "," + hNew;
}
This will not convert some fields, such as barcodes. You need to change those manually. You should use http://labelary.com/viewer.html to check the results and adapt. Open 2 viewers and paste 203 and 300 dpi, then select the resolution and label size and compare.
Upvotes: 1