Document Processing on a Web Service
To get the maximum performance and ease the document processing on a mobile side, you can perform the document processing on the Document Reader Web API.
graph LR
A(Mobile SDK) --->|Request| B(Web API Service);
B --->|Response| A;
The benefits are:
- The document processing is passed faster.
- The size of the mobile application becomes as little as nothing.
Usage
Define Permissions
Add the INTERNET
permission to your AndroidManifest file - it's needed to send requests to the Web API service.
<uses-permission android:name="android.permission.INTERNET" />
Select Processing Mode
Before setting up, you need to specify the processing mode for the Mobile SDK. There two modes available: MANUAL
and AUTO
.
MANUAL
In this mode, the document processing is performed fully on the Web API service, while the Mobile SDK is used only for capturing document images and passing them to the service.
- The processing is performed fully on the backend.
- No need to add the Core framework.
- No need to add the database.
- No need to perform the initialization process.
AUTO
In this mode, the document processing is performed both on the mobile side and on the Web API service.
- The processing is performed on both mobile and web sides.
- Need to add the Core framework.
- Need to add the database, if applicable.
- Need to perform the initialization process.
Set Up
Pass the chosen processing mode to the configuration object:
DocumentReader.setConfig({
functionality: {
onlineProcessingConfiguration: {
mode: OnlineMode.MANUAL
}
}
});
By default, the FullProcess
scenario is used to process the document on the Web API service. You can change the scenario and turn on other configuration settings by defining them in the processParams
property and passing it to the configuration object.
Start the Processing
Now, you can start the document processing:
DocumentReader.showScanner().subscribe(m => {})
See other options of the document processing here.
Processing Configuration
The OnlineProcessingConfig
class may contain the following config parameters:
Parameter | Description |
---|---|
mode |
Determines the operation mode: MANUAL or AUTO. |
processParam |
Сontains a set of processing parameters used during document recognition or data extraction. |
url |
Specifies the web service endpoint or URL to which the SDK will send requests. |
imageFormat |
Specifies the format of the input image or images, such as JPEG or PNG. |
imageCompressionQuality |
Controls the level of compression applied to images during document recognition. |
networkInterceptorListener |
A listener to intercept request to the service. |
You can learn more about OnlineProcessingConfig
here.