Table of contents

MRZScannerConfig

MRZScannerConfig is the class that defines the configurations for MRZ scanning. It is set via the MRZScannerViewController.

Definition

Assembly: DynamsoftMRZScannerBundle.xcframework

  • Objective-C
  • Swift
  1. @interface DSMRZScannerConfig : NSObject
    
  2. class MRZScannerConfig : NSObject
    

Properties

Property Type Description
license NSString Sets/Returns the license string.
templateFile NSString * Sets or returns the template with a file path or a JSON string.
documentType NSString Sets/Returns the document type to scan, such as ID cards or passports.
isTorchButtonVisible BOOL Sets/Returns the visibility of the torch button.
isBeepEnabled BOOL Sets/Returns whether the beep sound is enabled when a MRZ is scanned.
isVibrateEnabled BOOL Sets/Returns whether the vibration is enabled when a MRZ is scanned.
isCloseButtonVisible BOOL Sets/Returns the visibility of the close button.
isGuideFrameVisible BOOL Sets/Returns the visibility of the guide frame on the display.
isCameraToggleButtonVisible BOOL Sets/Returns the visibility of the camera switch button.
isBeepButtonVisible BOOL Sets/Returns the visibility of the beep toggle button.
isVibrateButtonVisible BOOL Sets/Returns the visibility of the vibrate toggle button.
isFormatSelectorVisible BOOL Sets/Returns the visibility of the document format selector.
returnDocumentImage BOOL Sets/Returns whether to return a cropped document image in the scan result.
returnPortraitImage BOOL Sets/Returns whether to return a cropped portrait image in the scan result.
returnOriginalImage BOOL Sets/Returns whether to return the original frame image in the scan result.
isCameraPermissionPromptEnabled BOOL Sets/Returns whether the scanner presents its own alert when camera access is unavailable.

license

Sets or returns the license string.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) NSString* license;
    
  2. var license: String { get set }
    

templateFile

Sets or returns the template with a file path or a JSON string.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) NSString* templateFile;
    
  2. var templateFile: String? { get set }
    

documentType

Sets or returns the document type to scan, such as ID cards or passports.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) DSDocumentType documentType;
    
  2. var documentType: DocumentType { get set }
    

isTorchButtonVisible

Sets or returns the visibility of the torch button. Users can click the torch button to turn on/off the torch.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL isTorchButtonVisible;
    
  2. var isTorchButtonVisible: Bool { get set }
    

isBeepEnabled

Sets or returns whether the beep sound is enabled when a MRZ is scanned.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL isBeepEnabled;
    
  2. var isBeepEnabled: Bool { get set }
    

isVibrateEnabled

Sets or returns whether the vibration is enabled when a MRZ is scanned.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL isVibrateEnabled;
    
  2. var isVibrateEnabled: Bool { get set }
    

isCloseButtonVisible

Sets or returns the visibility of the close button.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL isCloseButtonVisible;
    
  2. var isCloseButtonVisible: Bool { get set }
    

isGuideFrameVisible

Sets or returns the visibility of the guide frame on the display.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL isGuideFrameVisible;
    
  2. var isGuideFrameVisible: Bool { get set }
    

isCameraToggleButtonVisible

Sets or returns the visibility of the camera switch button that allows users to switch between the rear and front cameras.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL isCameraToggleButtonVisible;
    
  2. var isCameraToggleButtonVisible: Bool { get set }
    

isBeepButtonVisible

Sets or returns the visibility of the beep toggle button. Users can click the beep button to turn on/off the beep sound.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL isBeepButtonVisible;
    
  2. var isBeepButtonVisible: Bool { get set }
    

isVibrateButtonVisible

Sets or returns the visibility of the vibrate toggle button. Users can click the vibrate button to turn on/off the vibration.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL isVibrateButtonVisible;
    
  2. var isVibrateButtonVisible: Bool { get set }
    

isFormatSelectorVisible

Sets or returns the visibility of the document format selector that allows users to switch between scanning modes (ID cards, passports, or both).

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL isFormatSelectorVisible;
    
  2. var isFormatSelectorVisible: Bool { get set }
    

returnDocumentImage

Sets or returns whether to return a cropped document image in the scan result. Enabled by default.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL returnDocumentImage;
    
  2. var returnDocumentImage: Bool { get set }
    

returnPortraitImage

Sets or returns whether to return a cropped portrait image in the scan result. Enabled by default.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL returnPortraitImage;
    
  2. var returnPortraitImage: Bool { get set }
    

returnOriginalImage

Sets or returns whether to return the original full-frame image in the scan result. Disabled by default.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL returnOriginalImage;
    
  2. var returnOriginalImage: Bool { get set }
    

isCameraPermissionPromptEnabled

Sets or returns whether the scanner presents its own alert when camera access is unavailable. Enabled by default.

  • Objective-C
  • Swift
  1. @property(nonatomic, assign) BOOL isCameraPermissionPromptEnabled;
    
  2. var isCameraPermissionPromptEnabled: Bool { get set }
    

Remarks

When enabled, MRZScannerViewController presents a Camera Access Needed alert before reporting, offering Open Settings and Cancel. An integrator who has written no permission handling still gets a usable flow rather than a scanner that closes with no explanation.

Set it to false to suppress that alert and handle the denial entirely from onScannedResult. The denial is still reported either way, as a result status of .exception carrying cameraPermissionDenied (1001) or cameraPermissionRestricted (1002).

The camera is never started without access, regardless of this setting. Disabling the prompt changes who explains the problem to the user, not whether the scanner will open the camera.

Read the error code to decide what to present. cameraPermissionDenied is worth offering a route into Settings; cameraPermissionRestricted is not, because device policy withholds the camera and the per-app toggle is absent from Settings in that state. See DSMRZErrorCode for the full remediation flow.

This page is compatible for: