Document Processing Settings
Processing Modes
- Set the scanning mode:
DocumentReader.setConfig({
functionality: {
captureMode: Regula.DocumentReader.Enum.CaptureMode.CAPTURE_VIDEO
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
- Set the frame resolution, i.e. camera preview size:
DocumentReader.setConfig({
functionality: {
cameraSize: { width: 1920, height: 1080 }, // Android
videoSessionPreset: Regula.DocumentReader.Enum.AVCaptureSessionPreset.Hd1920x1080 // iOS
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
- Adjust a zoom level using the pinch gesture (in a range from 1x to 10x):
DocumentReader.setConfig({
functionality: {
isZoomEnabled: true
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
- Set the zoom level (in a range from 1x to 10x):
DocumentReader.setConfig({
functionality: {
zoomFactor: 2.0
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
- Control in the multipage processing mode:
DocumentReader.setConfig({
functionality: {
manualMultipageMode: true
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
Warning
Do not use multipageProcessing and this one at the same time.
- Define the orientation of activities:
Danger
Make sure that the selected orientation corresponds to your application’s orientation. Otherwise, it may lead to unexpected behavior.
DocumentReader.setConfig({
functionality: {
orientation: Platform.OS === 'ios' ? Regula.DocumentReader.Enum.UIInterfaceOrientationMask.Portrait : Regula.DocumentReader.Enum.DocReaderOrientation.PORTRAIT
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
- Specify the position of a capture device for video sessions:
DocumentReader.setConfig({
functionality: {
cameraPosition: Regula.DocumentReader.Enum.AVCaptureDevicePosition.Front
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
Record Processing
To record the scanning process, use:
DocumentReader.setConfig({
functionality: {
recordScanningProcess: true
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
Frame Processing
- You can assing a scenario that will be used upon tapping the Capture button:
DocumentReader.setConfig({
processParams: {
captureButtonScenario: "Locate"
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
- To manually set the document's bounds, invoke:
DocumentReader.setConfig({
processParams: {
manualCrop: true
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
- Set the following option to true if you know for sure that the image you provide contains an already cropped by edges document:
DocumentReader.setConfig({
processParams: {
alreadyCropped: true
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
Barcode Recognition
There are documents that contain barcodes with data that can be parsed only if the document type verification is performed.
Use the following property to set up the barcode parser type which should be used during the recognition. In this case, the barcode data will be parced without performing the document type verification:
DocumentReader.setConfig({
processParams: {
barcodeParserType: 123
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
Metadata
Display the metadata over the camera preview during the document processing, namely the perspective angle value:
DocumentReader.setConfig({
functionality: {
displayMetadata: true
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });
Custom Params
Set a custom JSON that should be processed along with other process params:
// allows you to depersonalize the document's data
DocumentReader.setConfig({
processParams: {
customParams: { "dePersonalize": [{ "allTextFields": true }, { "allGraphicFields": true }] }
},
}, (str) => { console.log(str) }, (error) => { console.log(error) });