readDocument method
- DocumentImage image,
- String? documentName
Reads all the fields 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. return A list of all the text fields read in the document. throws DocumentException An error has occurred during Document Library execution.
Implementation
TextFieldList readDocument(DocumentImage image, String? documentName) {
Pointer<Char>? pDocumentName = documentName?.toNativeUtf8().cast<Char>();
TextFieldList readTexts = TextFieldList();
try {
var err = documentSDK.id3DocumentReader_ReadDocument(_pHandle.value, image.handle, pDocumentName ?? nullptr, readTexts.handle);
if (err != DocumentError.success.value) {
readTexts.dispose();
throw DocumentException(err);
}
return readTexts;
} finally {
if (pDocumentName != null) {
calloc.free(pDocumentName);
}
}
}