DecodeFileRect Method
Description
Reads barcode from the specified area on a local image.
Syntax
public BarcodeResult[] DecodeFileRect(string strFileName, Rectangle rect);
Parameters
-
strFileName
- The path of the file.
-
rect
- The specified area on the file which is a rectangle.
Return Value
All barcodes have been read. If no barcodes are read, null is returned.
Remarks
The file to decode needs to be an image in the formats BMP, JPG, PNG, TIFF or PDF.
Example
ReaderOptions option = new ReaderOptions();
option.BarcodeFormats = (
BarcodeFormat.OneD |
BarcodeFormat.QR_CODE |
BarcodeFormat.PDF417 |
BarcodeFormat.DATAMATRIX
);
option.MaxBarcodesToReadPerPage = 1;
BarcodeReader reader = new BarcodeReader();
reader.ReaderOptions = option;
try
{
BarcodeResult[] results = reader.DecodeFileRect("C:\\test.bmp", rect);
for(int i = 0; i < results.Length; ++i)
{
BarcodeResult barcode = results[i];
Console.WriteLine("{0}: {1}", i, barcode.BarcodeText);
}
}
catch(BarcodeReaderException exp)
{
Console.WriteLine("Error: {0}, {1}", exp.Code.ToString(), exp.Message);
}
See Also
.NET > Classes > BarcodeReader > DecodeFile
.NET > Classes > ReaderOptions > BarcodeFormats
.NET > Classes > ReaderOptions > MaxBarcodesToReadPerPage
.NET > Classes > BarcodeReaderException
.NET > Enumeration > BarcodeFormat
.NET > Enumeration > ErrorCode