Free Support Forum - aspose.com

Specifying options for reading barcodes

Hi.

Looking at the API for the barcode reader it looks very sparse. Is there a way to specify any of the following through the API?

- Direction of barcodes to look for (e.g. left / right, right / left, top / bottom etc.)
If this cannot be specified, what directions will the toolkit look for?

- # of barcodes expected in the image

Other toolkits we are looking at provide a lot of tuning parameters as part of the API.

I attach a test image, it contains 6 barcodes, I am only able to get the Aspose toolkit to recognize one of them (the Code39 one). I have installed the eval license and am passing the following to the constructor:
BarCodeReader br = new BarCodeReader(new Bitmap(image), BarCodeReadType.Codabar | BarCodeReadType.Code11 | BarCodeReadType.Code128 | BarCodeReadType.Code39Extended | BarCodeReadType.Code39Standard | BarCodeReadType.Code93Extended | BarCodeReadType.Code93Standard | BarCodeReadType.DataMatrix | BarCodeReadType.EAN128 | BarCodeReadType.Interleaved2of5 | BarCodeReadType.Pdf417 | BarCodeReadType.QR | BarCodeReadType.EAN13 | BarCodeReadType.UPCA);

Regards

Hi,

Thanks for considering Aspose.

The barcode reader by default look for all directions (orientations) i.e. north, east, south and west.

Could you please download the latest hot fix v3.0.1 from http://www.aspose.com/community/files/51/.net-components/aspose.barcode-for-.net/default.aspx and test your images with it?

I downloaded the hotfix and there seem to be a couple of issues with it. I attach a new version of the test image as it looks before the scan, and what the toolkit reports it finds in it.

Issue 1 - It looks like the toolkit reports a lot of the barcodes twice

Issue 2 - The value returned by the GetReadType() method does not equal the corresponding constant in the BarCodeReadType class. For example, if the method GetReadType() reports “EAN13”, the check “if (br.GetReadType() == BarCodeReadType.EAN13)” evaluates to false.

Issue 3 - The PDF417 barcode is not decoded completely with the hotfix. It was decoded correctly prior to the hotfix.

See the code I use below.

BarCodeReader br = new BarCodeReader(new Bitmap(image), BarCodeReadType.Code128 | BarCodeReadType.Code39Extended | BarCodeReadType.Code39Standard | BarCodeReadType.Code93Extended | BarCodeReadType.Code93Standard | BarCodeReadType.DataMatrix | BarCodeReadType.EAN128 | BarCodeReadType.Interleaved2of5 | BarCodeReadType.Pdf417 | BarCodeReadType.QR | BarCodeReadType.EAN13 | BarCodeReadType.UPCA);
while (br.Read()) {

BarcodeResult bcr = new BarcodeResult(GetEncoding(br.GetReadType()), br.GetCodeText(), “”);
bcr.Location = br.GetRegion().Points[0];
bcr.Size = new Size(br.GetRegion().Points[2].X - bcr.Location.X, br.GetRegion().Points[2].Y - bcr.Location.Y);
result.Barcodes.Add(bcr);

private BarcodeEncoding GetEncoding(BarCodeReadType barCodeReadType) {
if (barCodeReadType == BarCodeReadType.Codabar) {
return BarcodeEncoding.Codabar;
} else if (barCodeReadType == BarCodeReadType.Code11) {
return BarcodeEncoding.Code11;
} else if (barCodeReadType == BarCodeReadType.Code128) {
return BarcodeEncoding.Code128;
} else if (barCodeReadType == BarCodeReadType.Code39Extended) {
return BarcodeEncoding.Code39;
} else if (barCodeReadType == BarCodeReadType.Code39Standard) {
return BarcodeEncoding.Code39;
} else if (barCodeReadType == BarCodeReadType.Code93Extended) {
return BarcodeEncoding.Code93;
} else if (barCodeReadType == BarCodeReadType.Code93Standard) {
return BarcodeEncoding.Code93;
} else if (barCodeReadType == BarCodeReadType.DataMatrix) {
return BarcodeEncoding.DataMatrix;
} else if (barCodeReadType == BarCodeReadType.EAN13) {
return BarcodeEncoding.EAN13;
} else if (barCodeReadType == BarCodeReadType.EAN8) {
return BarcodeEncoding.EAN8;
} else if (barCodeReadType == BarCodeReadType.Interleaved2of5) {
return BarcodeEncoding.Interleaved2of5;
} else if (barCodeReadType == BarCodeReadType.Pdf417) {
return BarcodeEncoding.PDF417;
} else if (barCodeReadType == BarCodeReadType.QR) {
return BarcodeEncoding.QRCode;
} else {
return BarcodeEncoding.Unknown;
}
}

The issues you have found earlier (filed as 11603) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan