Class OcrResult.Barcode
Represents a barcode discovered during OCR. See ReadBarCodes which must be set true to use this feature.
Inherited Members
Namespace: IronOcr
Assembly: IronOcr.dll
Syntax
public class Barcode : OcrResult.OcrResultElement
When OCR is also asked to pick up barcodes, each one it finds is reported as an OcrResult.Barcode. It is the item you read to get a barcode's decoded value and its type alongside the recognized text on the same page, so a document scan can yield both its words and its codes in one pass.
Barcode reading is off by default. Set ReadBarCodes to true on the engine configuration before reading, then enumerate the Barcodes on the returned OcrResult to get these items. Each barcode reports Value for the decoded content and Text, a synonym of Value; ToString returns the same text. Format returns an OcrResult.BarcodeEncoding identifying the symbology, such as QRCode or Code128, and BarcodeNumber gives the one-based index within the document.
Because the type derives from OcrResult.OcrResultElement, every barcode also carries the inherited geometry, X, Y, Width, Height, and Location, so you can place the code on the page or crop it. Read Value for the payload and Format to branch on the barcode kind.
The OCR barcodes how-to covers enabling and reading codes, and the OCR barcodes example shows reading a barcode value from a scan.
Properties
BarcodeNumber
One based number of this barcode within the OcrResult document.
Declaration
public int BarcodeNumber { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Format
Barcode format / type.
Declaration
public OcrResult.BarcodeEncoding Format { get; }
Property Value
| Type | Description |
|---|---|
| OcrResult.BarcodeEncoding |
Text
Text value of the barcode. Synonym of Value.
Declaration
public string Text { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Value
Text value of the barcode.
Declaration
public string Value { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Methods
ToString()
Text value of the barcode. Synonym of Value.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |