Skip to content

Initialization

The DocumentReader initialization works fully offline. It simply use license file, which you can get here: client.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)
    })))
}