Skip to main content

Getting started

Sample Project

If you prefer sample projects over documentation, check out our Docutain SDK Cordova Sample on Github.

Docutain SDK Dependencies

The Docutain SDK for Cordova is distributed through npm package.

cordova plugin add @docutain/cordova-plugin-docutain-sdk

Android Manifest

Camera Permission

If you want to use the Document Scanner, declare the following permission in your config.xml

    <platform name="android">
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera"/>
</config-file>
info

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

Memory settings

Your application will work with high-resolution images. To avoid OutOfMemoryError exceptions it is highly recommended to set android:largeHeap="true" in the <application> element of your AndroidManifest.xml file. If you want to use the Document Scanner, declare the following in your config.xml

    <platform name="android">
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest">
<application android:largeHeap="true" />
</edit-config>

iOS Manifest

Camera Permission

If you want to use the document scanner, 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.


NSCameraUsageDescription

Prerequisites

Android

Set android-minSdkVersion = 21 or higher in the config.xml file.

Set android-compileSdkVersion = 34 or higher in the config.xml file.

Set GradlePluginKotlinEnabled = true the config.xml file.

    <platform name="android">
<preference name="android-minSdkVersion" value="21" />
<preference name="android-compileSdkVersion" value="34" />
<preference name="GradlePluginKotlinEnabled" value="true" />
<preference name="GradlePluginKotlinCodeStyle" value="official" />
</platform>

SDK calling signature

The Docutain SDK for Cordova provides an Cordova callback signature API and an promisify signature API.

The callback methods are available in DocutainSDK.

  DocutainSDK.initSDK("License_Key", successCallback, errorCallback)

The promisified methods are available in DocutainSDKPromisify.

    try{
await DocutainSDKPromisify.initSDK("License_Key")
}
catch(err)
{
//init of Docutain SDK failed
...
}