Free Support Forum - aspose.com

Checksum character not always correct

Hello Aspose Team,

This one took me awhile to figure out. ;-)

When I generate a aspose barcode with the checksum enabled and the value of "P2D" or "P20D" aspose sets the checksum character as a period ("."). However this is not correct and when I read the barcode with checksum = true it fails on the checksum check. The appropriate check character for the above codes is "1".

Here's the math.

P=25, 2=2, 0=0, D=13

so

25+2+13=40

40 / 43 = 0 with a remainder of 40

40 corresponds to a "/" not a ".".

See the attached pdf genertated with aspose for more info.

Here is the code used to generate. May barcode lib version is 2.4.0.0.

MemoryStream f = new MemoryStream();

BarCodeWebControl bc = new Aspose.BarCode.Web.UI.BarCodeWebControl(_barcode, Symbology.Code39Standard);

bc.GraphicsUnit = System.Drawing.GraphicsUnit.Point;

bc.Resolution = new Resolution(_resolution, _resolution, ResolutionMode.Graphics);

bc.AutoSize = true;

bc.ImageQuality = ImageQualityMode.AntiAlias;

bc.xDimension = _barWidth;

bc.BarHeight = _barHeight;

bc.Rotate(RotationDirection.Clockwise, _orientation);

bc.EnableChecksum = true;

bc.CodeTextFont = new System.Drawing.Font(System.Drawing.FontFamily.GenericMonospace, _labelFont);

bc.CodeText = "P" + checkedNode.Value.Trim() + "D";

bc.Margins.Left = 0;

bc.Margins.Top = 0;

bc.Margins.Bottom = 0;

bc.Margins.Right = 0;

bc.BarCodeImage.Save(f, System.Drawing.Imaging.ImageFormat.Png);

byte[] barcodeImage = f.ToArray();

Thanks,

Tim

Also please email me with the any responses. gravest ppsc.com