Getting results

This page covers the description of how to get various kinds of results

Text Results

If you know exactly what text data are needed, the fastest way to get information is to use special functions.

Getting values

Getting values of text fields indicating fieldType:

Swift
Objective-C
Swift
// Get full name
let surnameAndGivenNames = result.getTextFieldValueByType(fieldType: .ft_Surname_And_Given_Names)
// Get date of birth
let dateOfBirth = result.getTextFieldValueByType(fieldType: .ft_Date_of_Birth)
// Get document number
let documentNumber = result.getTextFieldValueByType(fieldType: .ft_Document_Number)
Objective-C
// Get full name
NSString *surnameAndGivenNames = [resultInstance getTextFieldValueByType:RGLFieldTypeFt_Surname_And_Given_Names];
// Get date of birth
NSString *dateOfBirth = [resultInstance getTextFieldValueByType:RGLFieldTypeFt_Date_of_Birth];
// Get document number
NSString *documentNumber = [resultInstance getTextFieldValueByType:RGLFieldTypeFt_Document_Number];

Getting values of text fields indicating fieldType, lcid:

Swift
Objective-C
Swift
// Get full name
let surnameAndGivenNames = result.getTextFieldValueByType(fieldType: .ft_Surname_And_Given_Names, lcid: .belarusian)
// Get place of birth
let placeOfBirth = result.getTextFieldValueByType(fieldType: .ft_Place_of_Birth, lcid: .germanGermany)
Objective-C
// Get full name
NSString *surnameAndGivenNames = [result getTextFieldValueByType:RGLFieldTypeFt_Surname_And_Given_Names lcid:RGLLCIDBelarusian];
// Get place of birth
NSString *placeOfBirth = [result getTextFieldValueByType:RGLFieldTypeFt_Place_of_Birth lcid:RGLLCIDGermanGermany];

Getting values of text fields indicating fieldType, lcid, source:

Swift
Objective-C
Swift
// Get full name
let surnameAndGivenNames = result.getTextFieldValueByType(fieldType: .ft_Surname_And_Given_Names, lcid: .belarusian, source: .visualOCRExtended)
// Get address
let address = result.getTextFieldValueByType(fieldType: .ft_Address, lcid: .latin, source: .barCodesTextData)
Objective-C
// Get full name
NSString *surnameAndGivenNames = [result getTextFieldValueByType:RGLFieldTypeFt_Surname_And_Given_Names lcid:RGLLCIDBelarusian source:RGLResultTypeVisualOCRExtended];
// Get address
NSString *address = [result getTextFieldValueByType:RGLFieldTypeFt_Address lcid:RGLLCIDLatin source:RGLResultTypeBarCodesTextData];

Getting values of text fields indicating fieldType, lcid, source, original:

Swift
Objective-C
Swift
// Get surname
let surname = result.getTextFieldValueByType(fieldType: .ft_Surname, lcid: .belarusian, source: .visualOCRExtended, original: true)
// Get address
let address = result.getTextFieldValueByType(fieldType: .ft_Address, lcid: .latin, source: .barCodesTextData, original: true)
Objective-C
// Get surname
NSString *surname = [result getTextFieldValueByType:RGLFieldTypeFt_Surname lcid:RGLLCIDBelarusian source:RGLResultTypeVisualOCRExtended original:YES];
// Get address
NSString *address = [result getTextFieldValueByType:RGLFieldTypeFt_Address lcid:RGLLCIDLatin source:RGLResultTypeBarCodesTextData original:YES];

Getting values of text fields indicating fieldType, source:

Swift
Objective-C
Swift
// Get surname
let surname = result.getTextFieldValueByType(fieldType: .ft_Surname, source: .visualOCRExtended)
Objective-C
// Get surname
NSString *surname = [result getTextFieldValueByType:RGLFieldTypeFt_Surname source:RGLResultTypeVisualOCRExtended];

Getting values of text fields indicating fieldType, source, original:

Swift
Objective-C
Swift
// Get surname
let surname = result.getTextFieldValueByType(fieldType: .ft_Surname, source: .visualOCRExtended, original: true)
Objective-C
// Get surname
NSString *surname = [result getTextFieldValueByType:RGLFieldTypeFt_Surname source:RGLResultTypeVisualOCRExtended original:YES];

Getting values of text fields indicating fieldType, original:

Swift
Objective-C
Swift
// Get surname
let surname = result.getTextFieldValueByType(fieldType: .ft_Surname, original: true)
Objective-C
// Get surname
NSString *surname = [result getTextFieldValueByType:RGLFieldTypeFt_Surname original:YES];

You can also go through all instances of text fields and obtain the desired information, e.g.:

Swift
Objective-C
Swift
for textField in result.textResult.fields {
guard let value = result.getTextFieldValueByType(fieldType: textField.fieldType, lcid: textField.lcid) else { continue }
print("fieldName: \(textField.fieldName), value: \(value)")
}
Objective-C
for (RGLDocumentReaderTextField *textField in result.textResult.fields) {
NSString *value = [result getTextFieldValueByType:textField.fieldType lcid:textField.lcid];
NSLog(@"fieldName: %@, value: %@", textField.fieldName, value);
}

Getting instances

Getting instances of text fields indicating fieldType:

Swift
Objective-C
Swift
// Get a surname instance
let surname = result.getTextFieldByType(fieldType: .ft_Surname)
// Get an address instance
let address = result.getTextFieldByType(fieldType: .ft_Address)
Objective-C
// Get a surname instance
RGLDocumentReaderTextField *surname = [result getTextFieldByType:RGLFieldTypeFt_Surname];
// Get an address instance
RGLDocumentReaderTextField *address = [result getTextFieldByType:RGLFieldTypeFt_Address];

Getting instances of text fields indicating fieldType, lcid:

Swift
Objective-C
Swift
// Get a surname instance
let surname = result.getTextFieldByType(fieldType: .ft_Surname, lcid: .belarusian)
// Get a placeOfBirth instance
let placeOfBirth = result.getTextFieldByType(fieldType: .ft_Place_of_Birth, lcid: .germanGermany)
Objective-C
// Get a surname instance
RGLDocumentReaderTextField *surname = [result getTextFieldByType:RGLFieldTypeFt_Surname lcid:RGLLCIDBelarusian];
// Get a placeOfBirth instance
RGLDocumentReaderTextField *placeOfBirth = [result getTextFieldByType:RGLFieldTypeFt_Place_of_Birth lcid:RGLLCIDGermanGermany];

Graphic Results

Getting values

Getting values of graphic fields indicating fieldType:

Swift
Objective-C
Swift
// Get document image
result.getGraphicFieldImageByType(fieldType: .gf_DocumentImage)
// Get portrait image
result.getGraphicFieldImageByType(fieldType: .gf_Portrait)
Objective-C
// Get document image
[result getGraphicFieldImageByType:RGLGraphicFieldTypeGf_DocumentImage];
// Get portrait image
[result getGraphicFieldImageByType:RGLGraphicFieldTypeGf_Portrait];

Getting values of graphic fields indicating fieldType, source:

Swift
Objective-C
Swift
// Get document image
result.getGraphicFieldImageByType(fieldType: .gf_DocumentImage, source: .rawImage)
// Get document image (uncropped)
result.getGraphicFieldImageByType(fieldType: .gf_DocumentImage, source: .rawUncroppedImage)
// Get portrait image
result.getGraphicFieldImageByType(fieldType: .gf_Portrait, source: .graphics)
Objective-C
// Get document image
[result getGraphicFieldImageByType:RGLGraphicFieldTypeGf_DocumentImage source:RGLResultTypeRawImage];
// Get document image (uncropped)
[result getGraphicFieldImageByType:RGLGraphicFieldTypeGf_DocumentImage source:RGLResultTypeRawUncroppedImage];
// Get portrait image
[result getGraphicFieldImageByType:RGLGraphicFieldTypeGf_Portrait source:RGLResultTypeGraphics];

Getting values of graphic fields indicating fieldType, source, pageIndex:

Swift
Objective-C
Swift
// Get document image from the second page
result.getGraphicFieldImageByType(fieldType: .gf_DocumentImage, source: .rawImage, pageIndex: 1)
// Get portrait image from the first page
result.getGraphicFieldImageByType(fieldType: .gf_Portrait, source: .graphics, pageIndex: 0)
Objective-C
// Get document image from the second page
[result getGraphicFieldImageByType:RGLGraphicFieldTypeGf_DocumentImage source:RGLResultTypeRawImage pageIndex:1];
// Get portrait image from the first page
[result getGraphicFieldImageByType:RGLGraphicFieldTypeGf_Portrait source:RGLResultTypeGraphics pageIndex:0];

Getting values of graphic fields indicating fieldType, source, pageIndex, light:

Swift
Objective-C
Swift
// Get document image from the first page with white light
result.getGraphicFieldImageByType(fieldType: .gf_DocumentImage, source: .rawImage, pageIndex: 0, light: .white)
// Get document image from the first page with UV light
result.getGraphicFieldImageByType(fieldType: .gf_DocumentImage, source: .rawImage, pageIndex: 0, light: .UV)
Objective-C
// Get document image from the first page with white light
[result getGraphicFieldImageByType:RGLGraphicFieldTypeGf_DocumentImage source:RGLResultTypeRawImage pageIndex:0 light:RGLGraphicFieldLightWhite];
// Get document image from the first page with UV light
[result getGraphicFieldImageByType:RGLGraphicFieldTypeGf_DocumentImage source:RGLResultTypeRawImage pageIndex:0 light:RGLGraphicFieldLightUV];

Getting instances

Getting instances of graphic fields indicating fieldType:

Swift
Objective-C
Swift
// Get a documentImage instance
let documentImage = result.getGraphicFieldByType(fieldType: .gf_DocumentImage)
// Get a portrait instance
let portrait = result.getGraphicFieldByType(fieldType: .gf_Portrait)
Objective-C
// Get a documentImage instance
RGLDocumentReaderGraphicField *documentImage = [result getGraphicFieldByType:RGLGraphicFieldTypeGf_DocumentImage];
// Get a portrait instance
RGLDocumentReaderGraphicField *portrait = [result getGraphicFieldByType:RGLGraphicFieldTypeGf_Portrait];

Getting instances of graphic fields indicating fieldType, source:

Swift
Objective-C
Swift
// Get a documentImage instance
let documentImage = result.getGraphicFieldByType(fieldType: .gf_DocumentImage, source: .rawImage)
// Get a portrait instance
let portrait = result.getGraphicFieldByType(fieldType: .gf_Portrait, source: .graphics)
Objective-C
// Get a documentImage instance
RGLDocumentReaderGraphicField *documentImage = [result getGraphicFieldByType:RGLGraphicFieldTypeGf_DocumentImage source:RGLResultTypeRawImage];
// Get a portrait instance
RGLDocumentReaderGraphicField *portrait = [result getGraphicFieldByType:RGLGraphicFieldTypeGf_Portrait source:RGLResultTypeGraphics];

Getting instances of graphic fields indicating fieldType, source, pageIndex:

Swift
Objective-C
Swift
// Get a documentImage instance
let documentImage = result.getGraphicFieldByType(fieldType: .gf_DocumentImage, source: .rawImage, pageIndex: 0)
// Get a portrait instance
let portrait = result.getGraphicFieldByType(fieldType: .gf_Portrait, source: .graphics, pageIndex: 0)
Objective-C
// Get a documentImage instance
RGLDocumentReaderGraphicField *documentImage = [result getGraphicFieldByType:RGLGraphicFieldTypeGf_DocumentImage source:RGLResultTypeRawImage pageIndex:0];
// Get a portrait instance
RGLDocumentReaderGraphicField *portrait = [result getGraphicFieldByType:RGLGraphicFieldTypeGf_Portrait source:RGLResultTypeGraphics pageIndex:0];

Getting instances of graphic fields indicating fieldType, source, pageIndex, light:

Swift
Objective-C
Swift
// Get a documentImage instance
let documentImage = result.getGraphicFieldByType(fieldType: .gf_DocumentImage, source: .rawImage, pageIndex: 0, light: .white)
// Get a portrait instance
let portrait = result.getGraphicFieldByType(fieldType: .gf_Portrait, source: .graphics, pageIndex: 0, light: .white)
Objective-C
// Get a documentImage instance
RGLDocumentReaderGraphicField *documentImage = [result getGraphicFieldByType:RGLGraphicFieldTypeGf_DocumentImage source:RGLResultTypeRawImage pageIndex:0 light:RGLGraphicFieldLightWhite];
// Get a portrait instance
RGLDocumentReaderGraphicField *portrait = [result getGraphicFieldByType:RGLGraphicFieldTypeGf_Portrait source:RGLResultTypeGraphics pageIndex:0 light:RGLGraphicFieldLightWhite];