Skip to main content

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

Text Recognition (OCR) is included in the Docutain Data Extraction/ Data Capture SDK package for Android, so make sure to add a dependency in your app's build.gradle file:

def docutainSdkVersion = '1.7.0.3'
implementation("de.docutain:Docutain-SDK-DataExtraction:$docutainSdkVersion")

Set android.enableJetifier=true in your gradle.properties file.

Initialize the Docutain Android SDK as described here.

Get the detected text

In order to get the detected text of the entire document, call the following line of code:

import de.docutain.sdk.dataextraction.DocumentDataReader

...
//scan or import file
...

val detectedText = DocumentDataReader.getText()

In order to get the detected text of a specific page, specify the page number:

val detectedText = DocumentDataReader.getText(1)