Get Barcode Results
Result Class
The Analyze method returns an array of Result objects. Each element of the Result array contains the results of a single recognized barcode (or unsolved barcode. See ReturnPossibleBarcodes).
C# - To get the recognition results using Accusoft.BarcodeXpress14.Net
// call Analyze to detect barcodes in the image
// all detected barcodes will be returned to the
// Result object array.
Result[] results = bcXpress.reader.Analyze(hDib);
// get some results info, if any
for (short i = 0; i < results.Length; i++)
{
// get result for current barcode
Result curResult = (Result)results.GetValue(i);
// do something with results
MessageBox.Show(curResult.BarcodeName);
MessageBox.Show(curResult.BarcodeValue);
}
1D barcode values are generally 7 bit ASCII, except for Code 128, which permits the use of 8 bit data. If you are using values above 127, you must use the BarcodeDataAsByte property of the Result class instead of the BarcodeValue property, and your data must be encoded. Also, the reader and writer must both use the same character set.
C# - To get the recognition results for Code 128 using encoded 8859-15
// get some results info, if any
for (short i = 0; i < results.Length; i++)
{
// get result for current barcode
Result curResult = results[i];
System.Text.Encoding iso = System.Text.Encoding.GetEncoding("ISO-8859-15");
String resultString = iso.GetString(curResult.BarcodeDataAsByte);
// do something with results
MessageBox.Show(curResult.BarcodeName);
MessageBox.Show(resultString);
}
ResultInfo2D
For supported barcodes, the Info2D property provides both the encoded indicator pattern and the detected number of rows and columns of a single barcode. For the PDF417 barcode, column is the number of code word columns.
Order of Results
Since Barcode Xpress can return multiple barcode results from a single scan, the detected barcode results (both solved and unsolved) will be sorted using the following criteria. Note that all solved barcodes will be ordered before unsolved barcodes.
- First, the confidence factor is used to sort the barcode results from highest confidence to lowest. The Confidence property gets the confidence of the barcode that was recognized.
- Next, for any barcodes with the same confidence, they will then be sorted by their location, from top to bottom, then left to right.
See the Barcode Xpress Overview topic for code examples on recognition results.