Skip to main content

Document Scan

The Docutain Document Scanner SDK for Android comes with integrated, ready to use UI components for the document scan process. Colors and icons can be changed to match your branding.



Make sure you have defined the following package dependencies in your app's build.gradle file:

def docutainSdkVersion = ''
//For Document Scanner components

Initialize the Docutain Android Scanner SDK as described here.

Camera Permission

Declare permissions to use the camera in your AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name=""/>

Runtime permission for camera is handled automatically by the Docutain SDK.

Start Scan

To start the scan process you only have to launch an ActivityResultLauncher with our predefined ScanResult contract and wait for it to return.

import de.docutain.sdk.ui.ScanResult

val documentScanResult = registerForActivityResult(ScanResult()) { result ->
//user finished scan process, continue with your workflow
//generate PDF by using Document.writePDF()
//get detected Text by using DocumentDataReader.getText()
//get data by using DocumentDataReader.analyze()
} else{
//user canceled scan process

myButton.setOnClickListener {
val scanConfig = DocumentScannerConfiguration()

An instance of DocumentScannerConfiguration is required to launch the scan activity. It provides the possibility to change some behaviours to adopt it to your needs.

val scanConfig = DocumentScannerConfiguration()
//currently supported configs
scanConfig.allowCaptureModeSetting = true //defaults to false
scanConfig.pageEditConfig.allowPageFilter = true //defaults to true
scanConfig.pageEditConfig.allowPageRotation = true //defaults to true
scanConfig.autoCapture = true //defaults to true
scanConfig.defaultScanFilter = ScanFilter.ILLUSTRATION //defaults to ScanFilter.ILLUSTRATION

All parameters in DocumentScannerConfiguration are optional.

Result handling

After the scan process is successfully finished, you can do a bunch of things with the scanned pages:

Android PDF Creation

Android Text Detection

Android Data Extraction