Initialization

This page covers the description of the initialization process

The DocumentReader initialization works fully offline. It simply use license file, which you can get here: licensing.regulaforensics.com. You should add the regula.license file to your project.

var app = this
app.platform.ready().then(() => {
readFile("", "regula.license", (license) => {
DocumentReader.initializeReader(license).then(m => console.log(m)).catch(error)
})
})
‚Äč
function readFile(dirPath: string, fileName: string, callback, ...items) {
File.resolveDirectoryUrl(File.applicationDirectory + dirPath).then(dir => File.getFile(dir, fileName, null).then(fileEntry => fileEntry.file(file => {
var reader = new FileReader()
reader.onloadend = (evt) => {
var data = reader.result as String
data = data.substring(data.indexOf(',') + 1)
callback(data, items)
}
reader.readAsDataURL(file)
})))
}