Interface ScanbotDocumentScannerViewProperties

interface ScanbotDocumentScannerViewProperties {
    acceptedAngleScore?: number;
    acceptedAspectRatioScore?: number;
    acceptedBrightnessThreshold?: number;
    acceptedSizeScore?: number;
    aspectRatios?: CameraViewAspectRatio[];
    autoSnappingDelay?: number;
    autoSnappingEnabled?: boolean;
    autoSnappingSensitivity?: number;
    cameraModule?: CameraModule;
    cameraPreviewMode?: CameraPreviewMode;
    detectDocumentAfterSnap?: boolean;
    finderAspectRatio?: CameraViewAspectRatio;
    finderCornerRadius?: number;
    finderEnabled?: boolean;
    finderLineColor?: ColorValue;
    finderLineWidth?: number;
    finderMinimumPadding?: number;
    finderOverlayColor?: ColorValue;
    flashEnabled?: boolean;
    hardwareButtonsEnabled?: boolean;
    ignoreOrientationMismatch?: boolean;
    onError?: ((error) => void);
    onFrameDetectionResult?: ((detectionResult) => void);
    onSnappedDocumentResult: ((originalImage, documentImage?, detectionResult?) => void | Promise<void>);
    partiallyVisibleDocumentConfiguration?: PartiallyVisibleDocumentConfiguration;
    photoQualityPrioritization?: CapturePhotoQualityPrioritization;
    polygonAutoSnapProgressColor?: ColorValue;
    polygonAutoSnapProgressEnabled?: boolean;
    polygonAutoSnapProgressLineWidth?: number;
    polygonBackgroundColor?: ColorValue;
    polygonBackgroundColorOK?: ColorValue;
    polygonColor?: ColorValue;
    polygonColorOK?: ColorValue;
    polygonCornerRadius?: number;
    polygonEnabled?: boolean;
    polygonLineWidth?: number;
    style?: StyleProp<ViewStyle>;
    touchToFocusEnabled?: boolean;
}

Properties

acceptedAngleScore?: number

The minimum score in percent (0 - 100) of the perspective distortion to accept a detected document. Set lower values to accept more perspective distortion.

Warning: Lower values result in more blurred document images.

Default is 75

acceptedAspectRatioScore?: number

The minimum score in percent (0 - 100) that the aspect ratio of the document must match one of the required aspect ratios (if any) to accept a detected document. If acceptedAspectRatioScore is more than 0, then the document is only accepted if the aspect ratio matches one of the given aspect ratios (if any), otherwise OK_BUT_BAD_ASPECT_RATIO is returned.

Default is 85

acceptedBrightnessThreshold?: number

The minimum brightness value (0-255) to accept a detected document.

Default is 0

acceptedSizeScore?: number

The minimum size in percent (0 - 100) of the screen size to accept a detected document. It is sufficient that height or width match the score.

Warning: Lower values result in low resolution document images.

Default is 80

aspectRatios?: CameraViewAspectRatio[]

The possible desired aspect ratios for the detected document. A document matches if its aspect ratio matches any of the given aspect ratios. If acceptedAspectRatioScore is more than 0, then the document is only accepted if the aspect ratio matches one of the given aspect ratios, otherwise OK_BUT_BAD_ASPECT_RATIO is returned. If empty, no aspect ratio is preferred.

autoSnappingDelay?: number

The minimum delay in seconds between two consecutive automatic image captures. iOS only. Default is 1.0

autoSnappingEnabled?: boolean

When auto-snapping is enabled the document scanner will take a photo automatically when a document is detected, conditions are good and the auto-snapping time-out elapses. In this mode the user can still tap the shutter button to snap a document. Default is true

autoSnappingSensitivity?: number

Controls the auto-snapping speed. Sensitivity must be within the 0..1 range. A value of 1.0 triggers automatic capturing immediately, a value of 0.0 delays the automatic by 3 seconds. Default is 0.66

cameraModule?: CameraModule

The preferred camera module. Default is BACK

cameraPreviewMode?: CameraPreviewMode

Preview mode of the camera. Fit-In or Fill-In. Default is FILL_IN

detectDocumentAfterSnap?: boolean

Whether to detect the document after snapping. If enabled, the document scanner will try to detect the document in the captured image and provide the cropped image of the detected document along with the document detection result in the onSnappedDocumentResult callback. If disabled, only the original image is provided in the onSnappedDocumentResult callback and no document detection is performed on the captured image. Enabling this option may result in a longer processing time after snapping a document, especially on older devices.

Default is true

finderAspectRatio?: CameraViewAspectRatio

Aspect ratio of the finder frame (width to height), which is used to build the actual finder frame.

finderCornerRadius?: number

Radius of the viewfinder's corners. iOS only. Default is 10.0

finderEnabled?: boolean

Whether the viewfinder is visible. Default is false

finderLineColor?: ColorValue

Foreground color of the detection overlay. Default is "#FFFFFF"

finderLineWidth?: number

Width of finder frame border. Default is 2

finderMinimumPadding?: number

Determines the finder padding. Default is 20.0

finderOverlayColor?: ColorValue

Background color outside of the finder window. Default is "#000000CC"

flashEnabled?: boolean

Controls whether the flash should be initially enabled. Default is false

hardwareButtonsEnabled?: boolean

Controls whether the hardware volume buttons and the new hardware camera control button should snap or not. Available in iOS 17.2 and later.

ignoreOrientationMismatch?: boolean

If false, the document scanner will return OK_BUT_ORIENTATION_MISMATCH if the detected document orientation does not match the input image orientation, e.g. if the document is detected as landscape but the input image is portrait. If true, the document scanner will ignore orientation mismatches.

Default is false

onError?: ((error) => void)

An error callback that is triggered when an error occurs.

Type declaration

    • (error): void
    • Parameters

      Returns void

onFrameDetectionResult?: ((detectionResult) => void)

Frame detection result callback that is triggered when a document is detected in the camera preview. The callback provides the document detection result, which includes the document detection result.

Type declaration

onSnappedDocumentResult: ((originalImage, documentImage?, detectionResult?) => void | Promise<void>)

Snapped document result callback that is triggered when a document is snapped. The callback provides the original image and, if detectDocumentAfterSnap is enabled, the cropped image of the detected document along with the document detection result.

Type declaration

    • (originalImage, documentImage?, detectionResult?): void | Promise<void>
    • Parameters

      Returns void | Promise<void>

partiallyVisibleDocumentConfiguration?: PartiallyVisibleDocumentConfiguration

Configuration for handling partially visible documents.

photoQualityPrioritization?: CapturePhotoQualityPrioritization

The prioritization of still image quality and capturing speed. If you experience lots of blurry still images try to set this property to CapturePhotoQualityPrioritization.QUALITY. Note: It has no effect on devices prior to iOS 13.0!. Default is BALANCED

polygonAutoSnapProgressColor?: ColorValue

Stroke color of polygon auto snap progress animation. Default is "#87F2DE"

polygonAutoSnapProgressEnabled?: boolean

Whether polygon auto snap progress animation is enabled or not. Default is true

polygonAutoSnapProgressLineWidth?: number

Line width of polygon auto snap progress animation. Default is 5.0

polygonBackgroundColor?: ColorValue

The background color of the detected document outline when the document's angle, size or aspect ratio is not yet sufficiently good. Default is "#FFFFFF00"

polygonBackgroundColorOK?: ColorValue

The background color of the detected document outline when we are ready to snap OK. Default is "#FFFFFF00"

polygonColor?: ColorValue

The color of the detected document outline when the document's angle, size or aspect ratio is not yet sufficiently good. Default is "#FF00004D"

polygonColorOK?: ColorValue

The color of the detected document outline when we are ready to snap OK. Default is "#00CEA6"

polygonCornerRadius?: number

The radius to use when drawing rounded corners of the polygon. Default is 8.0

polygonEnabled?: boolean

Whether to display the document's polygon. Default is true

polygonLineWidth?: number

Width of the detected document outline. Default is 3

style?: StyleProp<ViewStyle>
touchToFocusEnabled?: boolean

Whether touch-to-focus is enabled on camera preview. Android only. Default is true