Database

This page covers the description of databases

Database stores the documents' data. It's mandatory to have db.dat file if type of the document, OCR zone information should be recognized. If MRZ, Barcode recognition or image cropping are used, there is no need to have the db.dat file.

After db.dat is added, it'll be unpacked and a few new files will be created.

The options to get the db.dat file are presented below.

Adding database manually

You can manually add database to the project. First of all, follow the next link licensing.regulaforensics.com, select page "Databases" and download db.dat file.

Android
iOS
Android

Create assets and Regula folders in your project and add db.dat file to android/app/src/main/assets/Regula folder.

iOS

Add db.dat file to your project in the same way as regula.license file.

Downloading database using prepareDatabase

To reduce your package size database (db.dat file) can be obtained from the network. In order to download db.dat file you should know its identifier, all database identifiers you can find on https://licensing.regulaforensics.com.

Regula.DocumentReader.prepareDatabase("Full", (respond) => {
console.log(respond);
},
(error) => {
console.log(error);
});

When operation is completed successfully, db.dat file will get to resources in the same way as if you add it manually. This operation should be run before initialization process.

Downloading database using runAutoUpdate

For getting always the latest version of database you can run autoupdate function:

Regula.DocumentReader.runAutoUpdate("Full", (respond) => {
console.log(respond);
},
(error) => {
console.log(error);
});

When operation is completed successfully, db.dat file will get to resources after update and will be used in next initialization.

Removing database using removeDatabase method

Allows to remove the added database:

Regula.DocumentReader.removeDatabase((respond) => {
console.log(respond);
},
(error) => {
console.log(error);
});

Cancelling database update

Allows to cancel database update:

Regula.DocumentReader.cancelDBUpdate((respond) => {
console.log(respond);
},
(error) => {
console.log(error);
});