barnhill / barcodelib

C# Barcode Image Generation Library
Apache License 2.0
733 stars 238 forks source link

Difference in the output #134

Closed tinohager closed 1 year ago

tinohager commented 3 years ago

We have been using NetBarcode until now, and are currently looking into switching to their project. We have noticed a difference in the output.

For the topmost Code 39 barcode, the last bar is shorter and the image is shifted one pixel to the right. The same happens with code 128, i have only checked the 2 so far.

var barcodeElement = new BarcodeLib.Barcode();
barcodeElement.BarWidth = 3;
barcodeElement.BackColor = Color.Transparent;
barcodeElement.Height = 100;
using var image = barcodeElement.Encode(BarcodeLib.TYPE.CODE39, "123ABC");

barcodelib image

NetBarcode image

yuriyolshevskyy commented 3 years ago

The compiled EXE encodes UPC-A 000000123456 that reads 000000123457 by the scanner. image

barnhill commented 1 year ago

This is most likely caused by an invalid check digit being on the end so its recalculating it. So its correcting the bad data being input. If you input 00000012345 it will scan as the same as its calculating the check digit even if the input is invalid so that it is a valid barcode.

barnhill commented 1 year ago

I believe the issue with the barcode being shifted to the right by one pixel has been fixed in a previous release. I just tested it just now with a width that barely fits the barcode with multiple pixel bars and it centers and draws the bars to the edges just like expected.