Interface IDocumentScannerHandle

interface IDocumentScannerHandle {
    detectAndCrop(): Promise<DocumentScannerScanResponse>;
    disableAutoCapture(): void;
    dispose(): void;
    enableAutoCapture(): void;
    fetchAvailableCameras(): Promise<CameraInfo[]>;
    getActiveCameraInfo(): CameraInfo;
    getCapabilities(): MediaTrackCapabilities;
    isAutoCaptureEnabled(): boolean;
    setFacingMode(mode): Promise<void>;
    setTorchState(state): Promise<void>;
    setZoom(zoom): void;
    switchCamera(deviceId, mirrored?): void;
    updateConfiguration(config): void;
}

Hierarchy

  • IScannerCommon
    • IDocumentScannerHandle

Methods

  • Returns void

  • Returns void

  • Returns void

  • Returns Promise<CameraInfo[]>

  • Returns CameraInfo

  • Returns MediaTrackCapabilities

  • Returns boolean

  • Parameters

    Returns Promise<void>

  • Parameters

    • state: boolean

    Returns Promise<void>

  • Parameters

    • zoom: number

    Returns void

  • Parameters

    • deviceId: string
    • Optional mirrored: boolean

    Returns void

  • Parameters

    • config: {
          autoCaptureDelay?: number;
          autoCaptureEnabled?: boolean;
          autoCaptureSensitivity?: number;
          autoCrop?: boolean;
          backgroundColor?: string;
          container?: { accessKey?: string; readonly accessKeyLabel?: string; autocapitalize?: string; dir?: string; draggable?: boolean; hidden?: boolean; inert?: boolean; innerText?: string; lang?: string; readonly offsetHeight?: number; ... 288 more ...; focus?: (options?: FocusOptions) => void; };
          containerId?: string;
          finder?: { readonly _type?: "ViewFinderConfiguration"; style?: ({ strokeColor?: string; strokeWidth?: number; cornerRadius?: number; } & { readonly _type: "FinderCorneredStyle"; }) | ({ strokeColor?: string; strokeWidth?: number; cornerRadius?: number; } & { ...; }); ... 4 more ...; visible?: boolean; };
          mirrored?: boolean;
          onCaptureButtonClick?: ((e) => void);
          onDocumentDetected?: ((result) => void);
          onError?: ((e) => void);
          preferredCamera?: string;
          previewMode?: "FIT_IN" | "FILL_IN";
          scannerConfiguration?: DeepPartial<DocumentScannerConfiguration>;
          spinnerColor?: string;
          style?: { outline?: { polygon?: { strokeCapturing?: string; strokeSearching?: string; fillCapturing?: string; fillSearching?: string; strokeWidthCapturing?: number; strokeWidthSearching?: number; }; path?: { ...; }; label?: { ...; }; }; captureButton?: { ...; }; };
          text?: { hint?: { NOT_ACQUIRED?: string; OK?: string; OK_BUT_TOO_SMALL?: string; OK_BUT_BAD_ANGLES?: string; OK_BUT_BAD_ASPECT_RATIO?: string; OK_BUT_ORIENTATION_MISMATCH?: string; OK_BUT_OFF_CENTER?: string; ... 6 more ...; ERROR_TOO_NOISY?: string; }; initializing?: { ...; }; };
          useImageCaptureAPI?: boolean;
          videoConstraints?: any;
      }
      • Optional autoCaptureDelay?: number

        Delay in milliseconds before the auto-capture is triggered after 'onDocumentDetected' has been called. This delay is used to prevent too many documents being captured in a row. In essence, autoCaptureSensitivity controls the speed of autocapture during the detection phase, while autoCaptureDelay controls the speed of autocapture after the detection phase. Default is 1000ms.

      • Optional autoCaptureEnabled?: boolean

        If auto-capture is enabled and when a document is detected, it will be automatically captured when conditions are good and the auto-snapping time-out elapses.

      • Optional autoCaptureSensitivity?: number

        Controls the auto-capture 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. The default value is 0.66 (2 seconds)

      • Optional autoCrop?: boolean

        Determines whether the captured image should be automatically cropped to the detected document's outline.

      • Optional backgroundColor?: string
      • Optional container?: { accessKey?: string; readonly accessKeyLabel?: string; autocapitalize?: string; dir?: string; draggable?: boolean; hidden?: boolean; inert?: boolean; innerText?: string; lang?: string; readonly offsetHeight?: number; ... 288 more ...; focus?: (options?: FocusOptions) => void; }

        The container HTML element of Scanbot Web SDK camera. Required when 'containerId' property is left undefined when calling any ScanbotSDK createScanner function. If both are provided, 'container' property takes precedence.

      • Optional containerId?: string

        The container HTML element id of Scanbot Web SDK camera. Required when 'container' property is left undefined when calling any ScanbotSDK createScanner function If both are provided, 'container' property takes precedence.

      • Optional finder?: { readonly _type?: "ViewFinderConfiguration"; style?: ({ strokeColor?: string; strokeWidth?: number; cornerRadius?: number; } & { readonly _type: "FinderCorneredStyle"; }) | ({ strokeColor?: string; strokeWidth?: number; cornerRadius?: number; } & { ...; }); ... 4 more ...; visible?: boolean; }
      • Optional mirrored?: boolean
      • Optional onCaptureButtonClick?: ((e) => void)
          • (e): void
          • By default, capture button invokes 'onDocumentDetected' callback, if you want custom behavior, you can optionally override this button

            Parameters

            • e: any

            Returns void

      • Optional onDocumentDetected?: ((result) => void)
          • (result): void
          • Document detected callback. Continuous callback, stopped only when detection is stopped or camera widget is disposed.

            Parameters

            Returns void

      • Optional onError?: ((e) => void)
          • (e): void
          • Error callback of the SDK. If any error was reported, your scanner might not be scanning anymore, e.g. due to an out-of-memory error.

            Parameters

            • e: any

            Returns void

      • Optional preferredCamera?: string

        Camera id or camera label. A list of available cameras can be obtained from ScanbotSDK.cameras.

      • Optional previewMode?: "FIT_IN" | "FILL_IN"

        In FIT_IN – Fits the entire preview (camera) frame into the view. If aspect ratio does not fit, will contain black edges

      • Optional scannerConfiguration?: DeepPartial<DocumentScannerConfiguration>
      • Optional spinnerColor?: string
      • Optional style?: { outline?: { polygon?: { strokeCapturing?: string; strokeSearching?: string; fillCapturing?: string; fillSearching?: string; strokeWidthCapturing?: number; strokeWidthSearching?: number; }; path?: { ...; }; label?: { ...; }; }; captureButton?: { ...; }; }
      • Optional text?: { hint?: { NOT_ACQUIRED?: string; OK?: string; OK_BUT_TOO_SMALL?: string; OK_BUT_BAD_ANGLES?: string; OK_BUT_BAD_ASPECT_RATIO?: string; OK_BUT_ORIENTATION_MISMATCH?: string; OK_BUT_OFF_CENTER?: string; ... 6 more ...; ERROR_TOO_NOISY?: string; }; initializing?: { ...; }; }
      • Optional useImageCaptureAPI?: boolean

        Attempts to take a single exposure using the video capture device, resulting in a high resolution image and potentially greatly improved detection quality. Relies on the experimental ImageCapture API that: https://developer.mozilla.org/en-US/docs/Web/API/ImageCapture. Use with caution. At the time of writing this, reliably only works on Android devices with Google Chrome. If enabled, this only affects extraction after the document outline has been identified. This may also trigger your device's default "snap" animation, making scanbotSDK.utils.flash(); irrelevant Defaults to false.

      • Optional videoConstraints?: any

        ScanbotCameraView video constraints

    Returns void

Generated using TypeDoc