Skip to content

Document Processing Settings

Processing Modes

  • Set the scanning mode:
DocumentReader.Instance().functionality().edit().setCaptureMode(CaptureMode.CAPTURE_VIDEO);
DocumentReader.Instance().functionality().edit().setCaptureMode(CaptureMode.CAPTURE_VIDEO)
  • Set the frame resolution—the camera preview size:
DocumentReader.Instance().functionality().edit().setCameraSize(1920, 1080).apply();
DocumentReader.Instance().functionality().edit().setCameraSize(1920, 1080).apply()
  • Set a camera API:
DocumentReader.Instance().functionality().edit().setCameraMode(CameraMode.CAMERA2).apply();
DocumentReader.Instance().functionality().edit().setCameraMode(CameraMode.CAMERA2).apply()
  • Set a list of devices that must not use the Camera2 API:
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()
  • Adjust a zoom level using the pinch gesture (in a range from 1x to 10x):
DocumentReader.Instance().functionality().edit().setZoomEnabled(true).apply();
DocumentReader.Instance().functionality().edit().setZoomEnabled(true).apply()
  • Set the zoom level (in a range from 1x to 10x):
DocumentReader.Instance().functionality().edit().setZoomFactor(2.0F).apply();
DocumentReader.Instance().functionality().edit().setZoomFactor(2.0F).apply()
  • Control in the multipage processing mode:
DocumentReader.Instance().functionality().edit().setManualMultipageMode(true).apply();
DocumentReader.Instance().functionality().edit().setManualMultipageMode(true).apply()

Warning

Do not use multipageProcessing and this one at the same time.

  • Defines the orientation of activities by using one of the DocReaderOrientation enum values:
DocumentReader.Instance().functionality().edit().setOrientation(DocReaderOrientation.PORTRAIT).apply();
DocumentReader.Instance().functionality().edit().setOrientation(DocReaderOrientation.PORTRAIT).apply()

Record Processing

To record the scanning process, use:

❗ As we use a weak reference to handle the callback object, into setVideoEncoderCompletion, you should put an object with a life cycle longer than the method life cycle. For example, you can create a variable and put it into the method.

private final VideoEncoderCompletion videoEncoderCompletion;
//in constructor:
this.videoEncoderCompletion = new VideoEncoderCompletion();
//implementation:
private class VideoEncoderCompletion implements IVideoEncoderCompletion { ... }
// set up completion
DocumentReader.Instance().setVideoEncoderCompletion(videoEncoderCompletion);
private var videoEncoderCompletion: VideoEncoderCompletion? = null
//in constructor:
videoEncoderCompletion = VideoEncoderCompletion()
//implementation:
private class VideoEncoderCompletion : IVideoEncoderCompletion { ... }
// set up completion
DocumentReader.Instance().setVideoEncoderCompletion(videoEncoderCompletion)

Frame Processing

  • You can assing a scenario that will be used upon tapping the Capture button:
DocumentReader.Instance().processParams().captureButtonScenario = Scenario.SCENARIO_LOCATE;
DocumentReader.Instance().processParams().captureButtonScenario = Scenario.SCENARIO_LOCATE
  • To manually set the document's bounds, invoke:
DocumentReader.Instance().processParams().manualCrop = true;
DocumentReader.Instance().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()
  • Set the following option to true if you know for sure that the image you provide contains an already cropped by edges document:
DocumentReader.Instance().processParams().alreadyCropped = true;

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.Instance().processParams().barcodeParserType = 123;
DocumentReader.Instance().processParams().barcodeParserType = 123

Metadata

Display the metadata over the camera preview during the document processing, namely the perspective angle value:

DocumentReader.Instance().functionality().edit().setDisplayMetadata(true).apply();
DocumentReader.Instance().functionality().edit().setDisplayMetadata(true).apply()

Custom Params

Set a custom JSON that should be processed along with other process params:

// allows you to depersonalize the document's data
DocumentReader.Instance().processParams().customParams = new JSONObject("{\"dePersonalize\":[{\"allTextFields\":true},{\"allGraphicFields\":true}]}");

// allows you to set the maximum DPI for an output image (if set to zero, an image won't be resized):
DocumentReader.Instance().processParams().customParams = new JSONObject("{\"imageDpiOutMax\":0}");
// allows you to depersonalize the document's data
DocumentReader.Instance().processParams().customParams = JSONObject("{\"dePersonalize\":[{\"allTextFields\":true},{\"allGraphicFields\":true}]}")

// allows you to set the maximum DPI for an output image (if set to zero, an image won't be resized):
DocumentReader.Instance().processParams().customParams = JSONObject("{\"imageDpiOutMax\":0}")

Next Steps