MRZScanConfig
MRZScanConfig is responsible for the configuration of the MRZ Scanner, from assigning the MRZ Scanner license to configuring the supported document types, along with other customizations.
If you are wondering about the different ways you can customize the MRZ Scanner, please refer to the MRZ Scanner Customization Guide.
Definition
Assembly: dynamsoft-mrz-scanner-bundle-react-native
interface MRZScanConfig
Properties
| Property | Type | Description |
|---|---|---|
license |
string | Represents the MRZ Scanner license string. |
templateFile |
string | Specifies the template configuration that defines the various MRZ Scanner parameters. |
templateNodeRequire |
NodeRequire | Supplies a require-resolved template object when loading the template from a bundled JSON asset. |
documentType |
EnumDocumentType | Specifies the type of document (ID or Passport) that the MRZ Scanner will recognize. |
isTorchButtonVisible |
boolean | Represents the visibility status of the torch button. |
isBeepEnabled |
boolean | Determines whether a beep sound is triggered upon a successful MRZ scan. |
isBeepButtonVisible |
boolean | Represents the visibility status of the beep toggle button. |
isCloseButtonVisible |
boolean | Represents the visibility status of the close button. |
isGuideFrameVisible |
boolean | Represents the visibility status of the guide frame on the display. |
isCameraToggleButtonVisible |
boolean | Specifies whether the camera toggle button is displayed or not. |
isVibrateEnabled |
boolean | Controls the scanner’s ability to make the scanning device vibrate upon a successful MRZ scan. |
isVibrateButtonVisible |
boolean | Represents the visibility status of the vibrate toggle button. |
isFormatSelectorVisible |
boolean | Represents the visibility status of the document format selector. |
returnDocumentImage |
boolean | Specifies whether the scanner captures and returns a cropped document image. |
returnOriginalImage |
boolean | Specifies whether the scanner captures and returns the full camera frame. |
returnPortraitImage |
boolean | Specifies whether the scanner extracts and returns a portrait image from the document. |
license
The license key is the only property whose value must be specified when instantiating the MRZ Scanner instance. If the license is undefined, invalid, or expired, the MRZ Scanner cannot proceed with scanning, and instead displays a pop-up error message instructing the user to contact the app administrator to resolve this license issue.
license?: string
templateFile
Specifies the template configuration with a file path or a JSON string that defines the various MRZ Scanner parameters. These specialized templates are usually used for very specific and customized scanning scenarios.
templateFile?: string
Remarks
The MRZ Scanner comes with a default template file, but you may choose to use a custom template to target specialized use cases. We recommend contacting the Dynamsoft Technical Support Team for assistance with template customization.
templateNodeRequire
Supplies a template configuration as a require-resolved object, which is the standard way to load a bundled JSON asset in a React Native app (Metro resolves require('./my-template.json') at build time). The MRZ Scanner stringifies the resolved object and uses it as the template when templateFile is not set.
templateNodeRequire?: NodeRequire
Remarks
Use templateFile when you have a template as a JSON string or a file path, and templateNodeRequire when you want Metro to bundle a template JSON alongside your app code. If both are provided, templateFile takes precedence.
documentType
Specifies the type of document that the MRZ Scanner will recognize, represented as a EnumDocumentType. This property accepts values defined in the EnumDocumentType such as EnumDocumentType.DT_ALL (TD1/2/3), EnumDocumentType.DT_ID (TD1/2), or EnumDocumentType.DT_PASSPORT (TD3).
documentType?: EnumDocumentType
Remarks
If you would like to learn more about the supported document types, please refer to the Supported Document Types section of the user guide.
isTorchButtonVisible
Determines whether the torch (flashlight) toggle button is visible on the scanning interface. Set to true to allow users to switch the device’s flashlight on or off during MRZ scanning.
isTorchButtonVisible?: boolean
isBeepEnabled
Determines whether a beep sound is triggered upon a successful MRZ scan. When enabled (true), the scanner will play a sound to provide audible feedback.
isBeepEnabled?: boolean
isBeepButtonVisible
Determines whether the beep toggle button is visible on the scanning interface. When visible, users can enable or disable the beep sound themselves during scanning.
isBeepButtonVisible?: boolean
isCloseButtonVisible
Controls the visibility of the close button on the scanner’s UI. If true, a close button will be displayed allowing users to exit the MRZ scanning interface.
isCloseButtonVisible?: boolean
isGuideFrameVisible
Represents the visibility status of the guide frame on the display.
isGuideFrameVisible?: boolean
isCameraToggleButtonVisible
Specifies whether the camera toggle button is displayed. This button lets users switch between available cameras (e.g., front and rear).
isCameraToggleButtonVisible?: boolean
isVibrateEnabled
Controls the scanner’s ability to make the scanning device vibrate upon a successful MRZ scan. When enabled (true), the scanner will vibrate to provide haptic feedback if the device supports it.
isVibrateEnabled?: boolean
isVibrateButtonVisible
Determines whether the vibrate toggle button is visible on the scanning interface. When visible, users can enable or disable haptic feedback themselves during scanning.
isVibrateButtonVisible?: boolean
isFormatSelectorVisible
Determines whether the document format selector is visible on the scanning interface. When visible, users can switch between document types (ID / Passport) during scanning.
isFormatSelectorVisible?: boolean
returnDocumentImage
Specifies whether the scanner captures and returns a cropped, perspective-corrected document image in MRZScanResult. When enabled, both the MRZ side and opposite side images (where available) are returned via mrzSideDocumentImage and oppositeSideDocumentImage.
returnDocumentImage?: boolean
returnOriginalImage
Specifies whether the scanner captures and returns the full camera frame in MRZScanResult. When enabled, the raw frames for both sides (where available) are returned via mrzSideOriginalImage and oppositeSideOriginalImage.
returnOriginalImage?: boolean
returnPortraitImage
Specifies whether the scanner extracts and returns a portrait image from the document in MRZScanResult, available via portraitImage.
returnPortraitImage?: boolean