readField method
- DocumentImage image,
- String? documentName,
- String? fieldName
Reads a single field in a document.
param image The image that contains the document. Must be a realigned BGR image of the document. param documentName The name of the document to be searched. Must be a key loaded in DocumentLibrary. param fieldName The name of the field to search. return Read Text in the specified field. throws DocumentException An error has occurred during Document Library execution.
Implementation
TextField readField(DocumentImage image, String? documentName, String? fieldName) {
Pointer<Char>? pDocumentName = documentName?.toNativeUtf8().cast<Char>();
Pointer<Char>? pFieldName = fieldName?.toNativeUtf8().cast<Char>();
TextField readText = TextField();
try {
var err = documentSDK.id3DocumentReader_ReadField(_pHandle.value, image.handle, pDocumentName ?? nullptr, pFieldName ?? nullptr, readText.handle);
if (err != DocumentError.success.value) {
readText.dispose();
throw DocumentException(err);
}
return readText;
} finally {
if (pDocumentName != null) {
calloc.free(pDocumentName);
}
if (pFieldName != null) {
calloc.free(pFieldName);
}
}
}