BinaryKits / BinaryKits.Zpl

BinaryKits.Zpl a set of .net libraries. The project supports you in the simple creation of zebra labels. It generates the ZPL data, it is a printer description language from Zebra Technologies. ZPL II is now emulated by many label printers from different manufacturers. So with this implementation you can create labels for most printers.
MIT License
289 stars 104 forks source link

DrawPdf not honouring width and height input #250

Open Joshmul1 opened 2 weeks ago

Joshmul1 commented 2 weeks ago

When using the Viewer package the default 4x6 label size is not honoured when the PDF is created, instead it seems to be a constant 11.11 x 13.33 inches (281.94 x 338.58 mm) when inspected using adobe.

This can be replicated using the online viewer at https://binarykits-zpl-viewer.azurewebsites.net, Using https://labelary.com/ with the same ZPL and settings does honour the size requirement.

Any help into figuring out why its behaving this way would be great, I am going to try debug and fix it myself but I am unfamiliar with this code base.

Thanks

Joshmul1 commented 2 weeks ago

Okay I have an update, I think I found the issue and will create a PR for it just now.

The BeginPage method requires the passed value to be inches * 72, where 72 is the PdfDpi. This value is currently being passed in millimetres. The PDF is also not being scaled correctly, but as far as I can tell this is now all fixed with my change.