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

How can I set Label size in mm Unit ? #25

Closed PttTaiwan closed 9 months ago

PttTaiwan commented 10 months ago

Hi, thank for your perfect library !!! I am new to zebra label , I have seen your project Wiki, but I can not sure how to setup the label size in my code correctly. In my project, I need to print the label on thermal label (90mm * 45mm) by using GODEX-G500 printer (203 dpi). zLabelQ1 Since, PrinterSettings.Width & PrinterSettings.Height is Integer, I set the variables like below zLabelQ2 but I have noticed in your wiki (Width and height are set in dots,), Now I am confused, can you help me or give me the example ? Many thanks! :)

rkone commented 10 months ago

By definition,.dpi is dots per inch. So you have set 203 dpi 9 inches to get the width in your sample.. For mm use 203 dpi / 25.4 mm per inch = 8 dots per mm instead. So your label size is 90 8 by 45 * 8 dots

PttTaiwan commented 9 months ago

Dear rkone, thanks for your reply, now I have modify my code to p.Width = 90 8 & p.Length = 45 8. many thanks.