SDK Initialization
License Key
The Docutain SDK for Cordova needs a valid, non-expired license key in order to work. The license key is bound to the widget id
defined in your app's config.xml
file.
Any attempt to use a license key in an app with a different widget id
will fail.
Trial license
The Docutain SDK is a commercial product and requires a paid license for production use. In order to get a trial license, please visit our website via https://sdk.docutain.com/TrialLicense to generate a trial license key.
Production license
To get information about the SDK's functionality and pricing and to purchase a production license, please contact us.
Initialize the SDK
In order to use any functionality of the SDK, you must initialize it first.
- Cordova Promisify
- Cordova Callback
- Ionic
async function onDeviceReady() {
await InitDocutainSDK();
}
async initDocutainSDK(){
try{
await DocutainSDKPromisify.initSDK("YOUR_LICENSE_KEY")
} catch (error) {
//init of Docutain SDK failed
console.log('Unable to initialize the Scanner SDK: ' + error);
//your logic to deactivate access to SDK functionality
}
}
}
async function onDeviceReady() {
...
InitDocutainSDK();
...
}
function initDocutainSDK(){
DocutainSDK.initSDK("YOUR_LICENSE_KEY", function(result) {
// SDK initialized
...
}, function(error) {
//init of Docutain SDK failed
console.log('Unable to initialize the Scanner SDK: ' + error);
//your logic to deactivate access to SDK functionality
}
}
import { DocutainSDKPromisify } from '@docutain/capacitor-plugin-docutain-sdk';
export class HomePage {
constructor() {
this.initDocutainSDK();
}
async initDocutainSDK(){
try{
await DocutainSDKPromisify.initSDK("YOUR_LICENSE_KEY")
} catch (error) {
//init of Docutain SDK failed
console.log('Unable to initialize the Scanner SDK: ' + error);
//your logic to deactivate access to SDK functionality
}
}
}
If the initialization fails, you are responsible to deactivate access to SDK functionality.
Logging
The SDK writes certain information into a log file. You can get the log file by calling DocutainSDK.getTraceFile()
. You can send this log file to us if you have any issues/bugs with the SDK. The Logger has certain levels that you can set depending on your needs. However, we suggest to leave the level to it's default value which ensures that in case of any issues/bugs we can get all the information we need from you.
- Cordova Promisify
- Cordova Callback
//get the log file
const traceFile = await DocutainSDKPromisify.getTraceFile();
//set the log level
await DocutainSDKPromisify.setLogLevel(LogLevel.Error);
//get the log file
DocutainSDK.getTraceFile(function(traceFile) {
...
});
//set the log level
DocutainSDK.setLogLevel(LogLevel.Error);
Depending on the log level, some temporary files get written. These files, if any, will be deleted everytime the SDK starts, so you don't need to worry about spamming the files dir.
If you like, you can delete these files manually by using await DocutainSDKPromisify.deleteTempFiles(false)
.