Skip to main content

SDK Initialization

License Key​

The Docutain SDK for Windows needs a valid, non-expired license key in order to work. The license key is bound to the code signing certificate issuer or the FileVersionInfo LegalCopyright of your app. Any attempt to use a license key in an app with a different code signing certificate or FileVersionInfo LegalCopyright will fail.

Trial license​

Without a license key, you can test the Docutain SDK for 60 seconds. After that, you need to restart the app to continue testing.

To get a free trial license, visit https://sdk.docutain.com/TrialLicense.

Production license​

To get information about the SDK's functionality and pricing and to purchase a production license, please contact us.

Initialize​

Base Initialization​

In order to use any functionality of the SDK, you must initialize it first. Add the following code to initialize.

if(!DocutainSDK.InitSDK("<YOUR-LICENSE-KEY>", Path.GetTempPath())){
//init of Docutain SDK failed, get the last error message
string error = DocutainSDK.GetLastError();
//your logic to deactivate access to SDK functionality
...
}
caution

If the initialization fails, you are responsible to deactivate access to SDK functionality.

Text detection (OCR) / data extraction initialization​

If you want to use text detection (OCR) and/or data extraction features you need to provide an AnalyzeConfiguration right after initializing the SDK.

if(!DocutainSDK.initSDK(this, "<YOUR-LICENSE-KEY>")){
//init of Docutain SDK failed, get the last error message
string error = DocutainSDK.getLastError();
//your logic to deactivate access to SDK functionality
...
}

AnalyzeConfiguration analyzeConfiguration = new Docutain.SDK.Windows.AnalyzeConfiguration();
analyzeConfiguration.ReadBIC = true; //defaults to false
analyzeConfiguration.ReadPaymentState = true; //defaults to false
if(!DocutainSDK.SetAnalyzeConfiguration(analyzeConfiguration)){
string error = DocutainSDK.GetLastError();
}
info

All configuration values of AnalyzeConfiguration are optional.

Logging​

The SDK writes certain information into a log file. You can get the log file by calling Logger.Filename. 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.

//get the log file
var logFile = Logger.Filename;

//set the log level
Logger.SetLogLevel(Logger.Level.Verbose);

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 DocutainSDK.DeleteTempFiles().