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
307 stars 112 forks source link

Improved: Barcode scaling for PDF417 and Code128 #219

Closed daanggc closed 5 months ago

daanggc commented 6 months ago

A DHL label that I use crashed on the PDF417 barcode and the Code128 barcodes are too long to fit on the page.

DHL uses ^BY2^B7N,6.7,5,,30,N that has the following issues PDF417:

DHL uses >5 in the Code128 barcode. They do that to select the limited Code128C charset for that part of the barcode to have a shorter result, but we don't support that. A good fallback is the TYPE.CODE128 option, which automatically optimizes the charset usage and comes very close to the expected result.

barcode-scaling (Left: after with Labelary overlay, right: before)

EDIT 05-04-2024: After the last vertical scaling changes this is the result compared to the real print:

image
daanggc commented 5 months ago

Thanks to reportingissue I found more improvements for the vertical scaling, it looks even better now.

I also added a PDF417 barcode test in the list, here it is with the real print and the overlay:

image

As long as the rows and columns are defined, it's very good. The visible differences are basically always related to the ZXing library having to guess the row/column combination.

daanggc commented 5 months ago

Hardened the Code128 drawer code a bit more and improved GS1 support, added an example and this is the generated and printed result of that:

image

image

You can preview it here: https://binarykits.dvdg.nu/