Text Recognition
After a successful scan or import of a document, you can get the detected text of the entire document or single pages.
Initialization
- Follow the Getting started guide
- Initialize the Docutain SDK for Kotlin Multiplatform as described here
Get the detected text
In order to get the detected text of the entire document, call the following line of code:
// ...
// scan or import a file
// ...
val scope = rememberCoroutineScope()
scope.launch {
val text = DocutainSdk.getText()
}
In order to get the detected text of a specific page, specify the page number:
val scope = rememberCoroutineScope()
scope.launch {
val text = DocutainSdk.getTextPage(pageNumber = 1)
}
Pages start at 1.
Both methods are suspend functions. See Coroutines and suspend functions for more details.
info
An empty result means that the document contains no text, or that the text recognition failed. If the operation itself fails, it throws DocutainException. See Error Handling for more details.