Skip to main content

Getting Started | Cordova Document Scanner

To get started with the integration of the Scanbot SDK Cordova Plugin in your project please follow this guide and check out our example projects.

Example Projects#

Check out our example projects on GitHub:


The Scanbot SDK Cordova Plugin is available as NPM package cordova-plugin-scanbot-sdk. You can simply install and add it to your Cordova project with the following command:

cordova plugin add cordova-plugin-scanbot-sdk

Or in an Ionic based projects:

ionic cordova plugin add cordova-plugin-scanbot-sdk

Android: Tuning the AndroidManifest.xml#

Since your application will work with high-resolution images, it is strongly recommended to add the attribute android:largeHeap="true" in the <application> element of your AndroidManifest.xml file, especially for Android <= v7.x. Processing hi-res images is a memory intensive task and this property will ensure your app has enough heap allocated to avoid OutOfMemoryError exceptions.

Add this attribute via <edit-config> inside the <platform name="android"> element of the config.xml file of your project:

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

See the config.xml of our example app.

Please note the file path of AndroidManifest.xml:

  • for cordova-android 7.x or newer: app/src/main/AndroidManifest.xml
  • for older versions: AndroidManifest.xml

When making any changes to the config.xml do not forget to reinstall the Cordova android platform to apply those on the re-generated Android project artifacts in platforms/android/:

cordova platform remove androidcordova platform add android


During the installation the plugin automatically adds all required permissions to your app. Here is a listing of those permissions just for your information:

Android (will be added in your AndroidManifest.xml file)

  • <uses-permission android:name="android.permission.CAMERA" /> - This permission is used for the camera views.

iOS (will be added in your Info.plist file)

  • NSCameraUsageDescription - "Privacy - Camera Usage Description". Describe why your app wants to access the camera. By default an empty string value will be added. You can change this value in the config.xml file of your Cordova project - see CAMERA_USAGE_DESCRIPTION.


import ScanbotSdk, { ScanbotSDKConfiguration, ... } from 'cordova-plugin-scanbot-sdk';

Promise-based API#

The base JavaScript API of the plugin uses the Cordova-style plugin callback signature, where the success and error callbacks are always passed as the first and second argument to each plugin method.

To use a more convenient and modern TypeScript API with support for typings the ScanbotSdk.promisify() method returns an object that has all the plugin functions with a promisified signature. In that promisified SDK instance, every method returns a Promise, instead of taking success/error callbacks as parameters. The promise-based API is only available when there is a global Promise function provided either by the runtime or by a polyfill. The arrow-style and async/await syntaxes are available only with transpilation, which is available by default to Ionic projects thanks to webpack and Babel. The promisified methods of ScanbotSdk.UI are available in ScanbotSdk.promisify().UI.

const SDK = ScanbotSdk.promisify();// const result = await SDK.someApiMethod(...);// const result = await SDK.UI.launchSomeUI(...);