Skip to content

Initialization

To start the initialization process, you need to get the license file first. A demo license can be obtained at our Client Portal.

The initializeReader method is designed to perform the initialization process. It accepts an instance of the DocReaderConfig class as a configuration object.

The DocReaderConfig allows you to set the license and other configuration properties. The license is passed to the initializeReader as a bytes array. For more information, please have a look at the API Reference for DocReaderConfig.

The initialization is performed fully offline, although by default the SDK attempts to access the licensing server to keep your license updated. You can change this behavior by setting the setLicenseUpdate method to false in the DocReaderConfig instance.

Here is an example of how to perform initialization with the license stored in the application bundle:

//Reading the license from raw resource file
InputStream licInput = getResources().openRawResource(R.raw.regula);
int available = licInput.available();
byte[] license = new byte[available];
//noinspection ResultOfMethodCallIgnored
licInput.read(license);

DocumentReader.Instance().initializeReader(MainActivity.this, new DocReaderConfig(license), new IDocumentReaderInitCompletion() {
    @Override
    public void onInitCompleted(boolean success, Throwable error) {
        if (success) {
            // initialization successful
        } else {
            // initialization was not successful
        }
    }
});
//Reading the license from raw resource file
val licInput = resources.openRawResource(R.raw.regula)
val available = licInput.available()
val license = ByteArray(available)

licInput.read(license)

DocumentReader.Instance().initializeReader(
    this@MainActivity, DocReaderConfig(license)
    ) { success, error_initializeReader ->
        if (success) {
            // initialization successful
        } else {
            // initialization was not successful
        }
}

Next Steps