Skip to main content

SDK Initialization | Capacitor Document Scanner

License Key

In order to run the Scanbot SDK within your production app, you must purchase and use a valid Scanbot SDK license.

Each license key is valid only for a given app bundle identifier. You will be unable to use any of the SDK features if the license key is corrupted, expired, or invalid in any other way.

App Identifier

Every app has a unique identifier (sometimes also known as "bundle identifier" or "application ID"). Your license will be bound to this identifier. To request a trial license or purchase a production license you have to provide us the bundle identifier of your app.

To change your app's Package ID you can add a capacitor.config.ts file to your project:

import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
appId: '',
appName: 'My Capacitor App',

export default config;

If you are not using TypeScript in your project, you can use a capacitor.config.json file in the same way.

Check the official documentation regarding Capacitor Configuration for more information.

Get a Trial License

The Scanbot SDK will run without a license for one minute per session! To get a free, "no-strings-attached" 7-day trial license, please submit the Trial License Form on our website.

Please kindly note that a trial license can only be used in a development and staging environment. You are not allowed to publish your app to the App Store, Play Store, or any 3rd party Android App Store with a trial license.

Purchase a Production License

To get pricing information and purchase a production license for the Scanbot SDK please request a quote.


Free Developer Support

We provide free "no-strings-attached" developer support for the implementation & testing of the Scanbot SDK. If you encounter technical issues with integrating the Scanbot SDK or need advice on choosing the appropriate framework or features, please visit our Support Page.

The Scanbot SDK must be properly initialized before calling any API methods or launching UI screens. Make sure to call the initialization when the app has been launched and initialized already:

  • In an Angular based project call it inside ngOnInit()
  • In a React Project call it in componentDidMount() or inside a useEffect
  • In an Ionic based project use the platform.ready() promise event.
import {ScanbotSDK} from 'capacitor-plugin-scanbot-sdk';

async initScanbotSdk() {
const config: ScanbotSdkConfiguration = {
loggingEnabled: true,
licenseKey: '',
// see further config parameters
try {
const result = await ScanbotSDK.initializeSDK(config);
} catch (e) {

It's recommended to implement the SDK initialization in a single location in your app. However, the SDK can be re-initialized multiple times during the app's runtime (e.g. in order to update the license key).

Config Parameters

Setting NameDescription
loggingEnabledOptional boolean flag to enable logging. See the "Logging" section below.
enableNativeLoggingOptional boolean flag that enables Scanbot SDK Core native logging (default is false, Android only).
licenseKeyYour license key for the Scanbot SDK. See the License key section above.
storageImageQualityOptional image quality value. It defines the quality factor of JPEG images. The value must be between 1 and 100, where 100 means maximum quality and largest file size. The recommended default value is 80 which is a good compromise between image file size and document legibility.
storageImageFormatOptional image format, either 'JPG' or 'PNG'. The recommended default value is 'JPG'. Please note that 'PNG' will result in larger image files! Also, the storageImageQuality value does not apply for 'PNG'.
storageBaseDirectoryOptional directory as a file URI to override the default storage base directory of the Scanbot SDK. Refer to the section Storage for more details.
documentDetectorModeOptional mode for document detection. - 'ML_BASED' is the recommended mode, based on Machine Learning. - 'EDGE_BASED' legacy mode, based on classic Computer Vision algorithms.
fileEncryptionPasswordOptional file encryption password. Refer to the section Storage Encryption for more details.
fileEncryptionModeOptional file encryption mode, 'AES128' or 'AES256'.
useCameraXReady to Use UI components can now use CameraX under the hood (Android only).
allowXnnpackAccelerationAllows controlling whether the XNN pack optimizations should be used (Android only).
allowGpuAccelerationEnables GPU acceleration for TensorFlow ML models (Android only).


When initializing the Scanbot SDK you can enable logging of the SDK. By default logging is disabled.

config.loggingEnabled = true;

On Android logs are printed into LogCat. The easiest way to check the log outputs on Android is to use Android Studio or Android Debug Bridge (adb) CLI. (e.g. $ adb logcat)

On iOS all logs are printed to the console. Please use Xcode to check the log outputs.

Please note: While it may be useful for development, consider switching logging OFF in production builds for security and performance reasons!

config.loggingEnabled = !environment.production;

Check License Status

Use the API method getLicenseInfo() to check the current state of the license. The SDK must be initialized.

import {ScanbotSDK} from 'capacitor-plugin-scanbot-sdk';

async checkLicense() {
const result = await ScanbotSDK.getLicenseInfo();
if (result.isLicenseValid) {
// OK, we have a valid (trial) license and can now call other Scanbot SDK methods.
// E.g. launch the Document Scanner
} else {
alert('Scanbot SDK license is not valid!');

👉 Please refer to the detailed section License Check in Production Apps to learn more about the license check and handling in production apps.

Next Steps

It's recommended to get a trial license key or a full production license to continue with the next steps.

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?