Processing Modes
- Set the scanning mode:
DocReader.shared.functionality.captureMode = CaptureMode.captureVideo
[RGLDocReader shared].functionality.captureMode = RGLCaptureModeCaptureVideo;
DocumentReader.Instance().functionality().edit().setCaptureMode(CaptureMode.CAPTURE_VIDEO)
DocumentReader.Instance().functionality().edit().setCaptureMode(CaptureMode.CAPTURE_VIDEO);
DocumentReader.instance.functionality.captureMode = CaptureMode.CAPTURE_VIDEO;
DocumentReader.setFunctionality({
captureMode: Regula.DocumentReader.Enum.CaptureMode.CAPTURE_VIDEO,
}, (str) => { console.log(str) }, (error) => { console.log(error) });
DocumentReader.setFunctionality({
captureMode: Enum.CaptureMode.CAPTURE_VIDEO
});
DocumentReader.setFunctionality({
captureMode: DocumentReader.Enum.CaptureMode.CAPTURE_VIDEO,
}, function (m) { }, function (e) { console.log(e); });
// Android
DocumentReader.Instance().Functionality().Edit().SetCaptureMode(CaptureMode.CaptureVideo).Apply();
// iOS
RGLDocReader.Shared.Functionality.CaptureMode = RGLCaptureMode.CaptureVideo;
- Set the frame resolution (the camera preview size):
DocReader.shared.functionality.videoSessionPreset = AVCaptureSession.Preset.hd1920x1080
[RGLDocReader shared].functionality.videoSessionPreset = AVCaptureSessionPreset1920x1080;
DocumentReader.Instance().functionality().edit().setCameraSize(1920, 1080).apply()
DocumentReader.Instance().functionality().edit().setCameraSize(1920, 1080).apply();
DocumentReader.instance.functionality.cameraResolutionAndroid = CameraSize(1920, 1080);
DocumentReader.instance.functionality.cameraResolutionIOS = CaptureSessionPreset.PRESET_1920x1080;
DocumentReader.setFunctionality({
cameraSize: { width: 1920, height: 1080 }, // Android
videoSessionPreset: Regula.DocumentReader.Enum.CaptureSessionPreset.PRESET_1920x1080 // iOS,
}, (str) => { console.log(str) }, (error) => { console.log(error) });
DocumentReader.setFunctionality({
cameraSize: { width: 1920, height: 1080 }, // Android
videoSessionPreset: DocumentReader.Enum.CaptureSessionPreset.PRESET_1920x1080 // iOS
});
DocumentReader.setFunctionality({
cameraSize: { width: 1920, height: 1080 }, // Android
videoSessionPreset: DocumentReader.Enum.CaptureSessionPreset.PRESET_1920x1080 // iOS,
}, function (m) { }, function (e) { console.log(e); });
// Android
DocumentReader.Instance().Functionality().Edit().SetCameraSize(1920, 1080).Apply();
// iOS
RGLDocReader.Shared.Functionality.VideoSessionPreset = AVFoundation.AVCaptureSession.Preset1920x1080;
- Set a camera API (Android-only):
DocumentReader.Instance().functionality().edit().setCameraMode(CameraMode.CAMERA2).apply();
DocumentReader.Instance().functionality().edit().setCameraMode(CameraMode.CAMERA2).apply()
DocumentReader.instance.functionality.cameraMode = CameraMode.CAMERA2;
DocumentReader.setFunctionality({
"cameraMode": Enum.CameraMode.CAMERA2
}, _ => { }, _ => { });
DocumentReader.setFunctionality({
"cameraMode": Enum.CameraMode.CAMERA2
});
DocumentReader.setFunctionality({
"cameraMode": Enum.CameraMode.CAMERA2
}, function (m) { }, function (e) { });
// Android
DocumentReader.Instance().Functionality().Edit().SetCameraMode(CameraMode.Camera2).Apply();
- Set a list of devices that must not use the Camera2 API (Android-only):
List<String> models = Arrays.asList("Nexus 5X", "Pixel 4"); // Build.MODEL
DocumentReader.Instance().functionality().edit().setExcludedCamera2Models(models).apply();
val models = Arrays.asList("Nexus 5X", "Pixel 4") // Build.MODEL
DocumentReader.Instance().functionality().edit().setExcludedCamera2Models(models).apply()
DocumentReader.instance.functionality.excludedCamera2Models = [
"Nexus 5X",
"Pixel 4"
];
DocumentReader.setFunctionality({
"excludedCamera2Models": ["Nexus 5X", "Pixel 4"]
}, _ => { }, _ => { });
DocumentReader.setFunctionality({
"excludedCamera2Models": ["Nexus 5X", "Pixel 4"]
});
DocumentReader.setFunctionality({
"excludedCamera2Models": ["Nexus 5X", "Pixel 4"]
}, function (m) { }, function (e) { });
// Android
IList<string> models = (IList<string>)Arrays.AsList("Nexus 5X", "Pixel 4"); // Build.MODEL
DocumentReader.Instance().Functionality().Edit().SetExcludedCamera2Models(models).Apply();
- Adjust a zoom level using the pinch gesture (in a range from 1x to 10x):
DocReader.shared.functionality.isZoomEnabled = true
[RGLDocReader shared].functionality.isZoomEnabled = YES;
DocumentReader.Instance().functionality().edit().setZoomEnabled(true).apply()
DocumentReader.Instance().functionality().edit().setZoomEnabled(true).apply();
DocumentReader.instance.functionality.isZoomEnabled = true;
DocumentReader.setFunctionality({
isZoomEnabled: true,
}, (str) => { console.log(str) }, (error) => { console.log(error) });
DocumentReader.setFunctionality({
isZoomEnabled: true
});
DocumentReader.setFunctionality({
isZoomEnabled: true,
}, function (m) { }, function (e) { console.log(e); });
// Android
DocumentReader.Instance().Functionality().Edit().SetZoomEnabled(true).Apply();
// iOS
RGLDocReader.Shared.Functionality.IsZoomEnabled = true;
- Set the zoom level (in a range from 1x to 10x):
DocReader.shared.functionality.zoomFactor = 2.0
[RGLDocReader shared].functionality.zoomFactor = 2.0;
DocumentReader.Instance().functionality().edit().setZoomFactor(2.0F).apply()
DocumentReader.Instance().functionality().edit().setZoomFactor(2.0F).apply();
DocumentReader.instance.functionality.zoomFactor = 2;
DocumentReader.setFunctionality({
zoomFactor: 2.0,
}, (str) => { console.log(str) }, (error) => { console.log(error) });
DocumentReader.setFunctionality({
zoomFactor: 2.0
});
DocumentReader.setFunctionality({
zoomFactor: 2.0,
}, function (m) { }, function (e) { console.log(e); });
// Android
DocumentReader.Instance().Functionality().Edit().SetZoomFactor(2.0F).Apply();
// iOS
RGLDocReader.Shared.Functionality.ZoomFactor = 2.0F;
- Defines the orientation of activities:
Danger
Make sure that the selected orientation corresponds to your application’s orientation. Otherwise, it may lead to unexpected behavior.
DocReader.shared.functionality.orientation = UIInterfaceOrientationMask.portrait
[RGLDocReader shared].functionality.orientation = UIInterfaceOrientationMaskPortrait;
DocumentReader.Instance().functionality().edit().setOrientation(DocReaderOrientation.PORTRAIT).apply()
DocumentReader.Instance().functionality().edit().setOrientation(DocReaderOrientation.PORTRAIT).apply();
DocumentReader.instance.functionality.orientation = DocReaderOrientation.PORTRAIT;
DocumentReader.setFunctionality({
orientation: Enum.DocReaderOrientation.PORTRAIT,
}, _ => { }, _ => { });
DocumentReader.setFunctionality({
orientation: Enum.DocReaderOrientation.PORTRAIT
});
DocumentReader.setFunctionality({
orientation: Enum.DocReaderOrientation.PORTRAIT,
}, function (m) { }, function (e) { });
// Android
DocumentReader.Instance().Functionality().Edit().SetOrientation(DocReaderOrientation.Portrait).Apply();
// iOS
RGLDocReader.Shared.Functionality.Orientation = UIInterfaceOrientationMask.Portrait;
- You can assign a scenario that will be used upon tapping the Capture button:
DocReader.shared.processParams.captureButtonScenario = RGL_SCENARIO_FULL_PROCESS
[RGLDocReader shared].processParams.captureButtonScenario = RGL_SCENARIO_FULL_PROCESS;
DocumentReader.Instance().processParams().captureButtonScenario = Scenario.SCENARIO_LOCATE
DocumentReader.Instance().processParams().captureButtonScenario = Scenario.SCENARIO_LOCATE;
DocumentReader.instance.processParams.captureButtonScenario = Scenario.LOCATE;
DocumentReader.setProcessParams({
captureButtonScenario: "Locate",
}, (str) => { console.log(str) }, (error) => { console.log(error) });
DocumentReader.setProcessParams({
captureButtonScenario: "Locate"
});
DocumentReader.setProcessParams({
captureButtonScenario: "Locate",
}, function (m) { }, function (e) { console.log(e); });
// Android
DocumentReader.Instance().ProcessParams().CaptureButtonScenario = Scenario.ScenarioLocate;
// iOS
RGLDocReader.Shared.ProcessParams.CaptureButtonScenario = Constants.RGL_SCENARIO_LOCATE;
- To manually set the document's bounds, invoke:
DocReader.shared.processParams.manualCrop = true
[RGLDocReader shared].processParams.manualCrop = @YES;
DocumentReader.Instance().processParams().manualCrop = true
DocumentReader.Instance().processParams().manualCrop = true;
DocumentReader.instance.processParams.manualCrop = true;
DocumentReader.setProcessParams({
manualCrop: true,
}, (str) => { console.log(str) }, (error) => { console.log(error) });
DocumentReader.setProcessParams({
manualCrop: true
});
DocumentReader.setProcessParams({
manualCrop: true,
}, function (m) { }, function (e) { console.log(e); });
// Android
DocumentReader.Instance().ProcessParams().ManualCrop = (Java.Lang.Boolean)true;
// iOS
RGLDocReader.Shared.ProcessParams.ManualCrop = true;
- If set, as soon as a document is detected during the scanning process, a picture will be taken and processed as a single frame. It is used for devices with poor-quality video preview:
DocumentReader.Instance().functionality().edit().setPictureOnBoundsReady(true).apply();
DocumentReader.Instance().functionality().edit().setPictureOnBoundsReady(true).apply()
DocumentReader.instance.functionality.pictureOnBoundsReady = true;
DocumentReader.setFunctionality({
"pictureOnBoundsReady": true
}, _ => { }, _ => { });
DocumentReader.setFunctionality({
"pictureOnBoundsReady": true
});
DocumentReader.setFunctionality({
"pictureOnBoundsReady": true
}, function (m) { }, function (e) { });
// Android
DocumentReader.Instance().Functionality().Edit().SetPictureOnBoundsReady(true).Apply();
- Set the following option to true if you know for sure that the image you provide contains an already cropped by edges document:
DocReader.shared.processParams.alreadyCropped = true
DocumentReader.Instance().processParams().alreadyCropped = true;
DocumentReader.instance.processParams.alreadyCropped = true;
DocumentReader.setProcessParams({
alreadyCropped: true,
}, (str) => { console.log(str) }, (error) => { console.log(error) });
DocumentReader.setProcessParams({
alreadyCropped: true
});
DocumentReader.setProcessParams({
alreadyCropped: true,
}, function (m) { }, function (e) { console.log(e); });
// Android
DocumentReader.Instance().ProcessParams().AlreadyCropped = (Java.Lang.Boolean)true;
// iOS
RGLDocReader.Shared.ProcessParams.AlreadyCropped = true;
- Specify the position of a capture device for video sessions:
DocReader.shared.functionality.cameraPosition = AVCaptureDevice.Position.back
[RGLDocReader shared].functionality.cameraPosition = AVCaptureDevicePositionBack;
DocumentReader.instance.functionality.cameraPositionIOS = CameraPosition.BACK;
DocumentReader.setFunctionality({
cameraPositionIOS: Enum.CameraPosition.BACK
}, _ => { }, _ => { });
DocumentReader.setFunctionality({
cameraPositionIOS: Enum.CameraPosition.BACK
});
DocumentReader.setFunctionality({
cameraPositionIOS: Enum.CameraPosition.BACK
}, function (m) { }, function (e) { });
// iOS
RGLDocReader.Shared.Functionality.CameraPosition = AVFoundation.AVCaptureDevicePosition.Back;