Methods

Methods

  • Starts the MRZ (Machine Readable Zone) scanner by launching a new page (Activity on Android or ViewController on iOS).

    This function initiates the MRZ scanning process by launching a new page dedicated to scanning. It accepts an optional configuration object to customize the scanning behavior. If no configuration is provided, it uses a default configuration. The function returns a Promise that resolves with the scan result or rejects with an error if the scanning process fails.

    For Android, this function starts an Activity that handles the MRZ scanning. For iOS, it presents a ViewController for the same purpose. After scanning, the function handles the result and closes the scanning page if necessary.

    Parameters

    • Optionalconfig: MRZScanConfig

      (optional) Configuration parameters for the MRZ scanner, including:

      • license (string): Dynamsoft license key. If empty, the license is not set.
      • isTorchButtonVisible (boolean): Whether to display the torch button, default is true.
      • isBeepEnabled (boolean): Whether to enable the beep sound on successful scan, default is false.
      • isCloseButtonVisible (boolean): Whether to display the close button, default is true.
      • documentType (EnumDocumentType): The type of document to be scanned, default is EnumDocumentType.DT_ALL. This can be set to specific document types like EnumDocumentType.DT_ID or EnumDocumentType.DT_PASSPORT to optimize scanning.
      • isGuideFrameVisible (boolean): Whether to display the guide frame to assist with scanning, default is true.
      • templateFile - The content of the template as a json string.
      • templateNodeRequire - The template node require object.

    Returns Promise<MRZScanResult>

    A Promise that resolves with the scan result as an MRZScanResult object.

    • If the scan is successful, the Promise resolves with the scan result.
    • If an error occurs during the scan, the Promise rejects with an error message.
    • If the user manually exits the scanner, the Promise resolves with null.