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 (db.dat file) to the project. First of all, follow the next link licensing.regulaforensics.com, select page "Databases" and download db.dat file. After this add db.dat file to your project in the same way as regula.license file.

Adding database using prepareDatabase method

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.

#1

Swift
Objective-C
Swift
DocReader.shared.prepareDatabase(databaseID: "Full", progressHandler: { (progress) in
print(progressValue) // progress block
}, completion: { (success, error) in
if success {
print(success) // Success state
} else {
print(error) // Error status
}
})
Objective-C
[RGLDocReader.shared prepareDatabase:@"Full" progressHandler:^(NSProgress * _Nonnull progress) {
// progress block
} completion:^(BOOL success, NSError * _Nullable error) {
if (success) {
NSLog(success ? @"YES" : @"NO"); // Success state
} else {
NSLog(@"%@", error); // Error status
}
}];

#2

Swift
Objective-C
Swift
DocReader.shared.prepareDatabase(databaseID: "Full") { (success, error) in
if success {
print(success) // Success state
} else {
print(error) // Error status
}
}
Objective-C
[RGLDocReader.shared prepareDatabase:@"Full" completion:^(BOOL success, NSError * _Nullable error) {
if (success) {
NSLog(success ? @"YES" : @"NO"); // Success state
} else {
NSLog(@"%@", error); // Error status
}
}];

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.

Adding database using runAutoUpdate method

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

#1

Swift
Objective-C
Swift
DocReader.shared.runAutoUpdate(databaseID: "Full", progressHandler: { (progress) in
print(progressValue) // progress block
}, completion: { (success, error) in
if success {
print(success) // Success state
} else {
print(error) // Error status
}
})
Objective-C
[RGLDocReader.shared runAutoUpdate:@"Full" progressHandler:^(NSProgress * _Nonnull progress) {
// progress block
} completion:^(BOOL success, NSError * _Nullable error) {
if (success) {
NSLog(success ? @"YES" : @"NO"); // Success state
} else {
NSLog(@"%@", error); // Error status
}
}];

#2

Swift
Objective-C
Swift
DocReader.shared.runAutoUpdate(databaseID: "Full") { (success, error) in
if success {
print(success) // Success state
} else {
print(error) // Error status
}
}
Objective-C
[RGLDocReader.shared runAutoUpdate:@"Full" completion:^(BOOL success, NSError * _Nullable error) {
if (success) {
NSLog(success ? @"YES" : @"NO"); // Success state
} else {
NSLog(@"%@", error); // Error status
}
}];

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:

Swift
Objective-C
Swift
DocReader.shared.removeDatabase { (success, error) in
if success {
print(success) // Success state
} else {
print(error) // Error status
}
}
Objective-C
[RGLDocReader.shared removeDatabase:^(BOOL success, NSError * _Nullable error) {
if (success) {
NSLog(success ? @"YES" : @"NO"); // Success state
} else {
NSLog(@"%@", error); // Error status
}
}];

Cancelling database update

Allows to cancel database update:

Swift
Objective-C
Swift
DocReader.shared.cancelDBUpdate()
Objective-C
[RGLDocReader.shared cancelDBUpdate];

‚Äč