Skip to main content

Document Scan

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



Initialize the Docutain Capacitor Scanner SDK as described here.

Camera Permission


Declare the following permission 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.


You need to specify the reason for requesting access to the camera as part of the NSCameraUsageDescription in the Info.plist. If you don't the app will crash.


Start Scan

To start the scan process you only have to call DocutainSDK.scanDocument and wait for it to return.

import { DocutainSDK, DocumentScannerConfiguration } from '@docutain/capacitor-plugin-docutain-sdk'

const options: DocumentScannerConfiguration = {
allowCaptureModeSetting: true,
pageEditConfig: {allowPageFilter: true, allowPageRotation: true},
ColorConfig: {
ColorTopBarBackground: {Light:"#ffb6c1", Dark:"#f4a460"},
ColorBottomBarBackground: {Light:"#ff26c1", Dark:"#f49460"},

const result = await DocutainSDK.scanDocument(options);
if(result.return) {
//user finished scan process, continue with your workflow
//generate PDF
const destinationPath = "TestPDF.PDF";
const pdf = await DocutainSDK.writePDF(destinationPath,true,"A4");
//get detected Text
const text = await DocutainSDK.getText();
//get extracted data
const analyzeData = await DocutainSDK.analyze();
} else {
//user canceled scan process

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

const options: DocumentScannerConfiguration = {
allowCaptureModeSetting: true, // defaults to false
pageEditConfig: {
allowPageFilter: true, // defaults to true
allowPageRotation: true // defaults to true

// Further customization options available ...

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:

Capacitor PDF Creation

Capacitor Text Detection

Capacitor Data Extraction