How do I restrict scanning to specific document types (e.g., only passports)?
You can restrict the Dynamsoft MRZ Scanner to only scan specific document types by setting the mrzFormatType property of MRZScannerConfig. Specify an array of formats to limit scanning. For example, to allow only passports (TD3) and TD1 ID cards:
const mrzScanner = new Dynamsoft.MRZScanner({
license: "YOUR_LICENSE_KEY",
mrzFormatType: ["passport", "td1"]
});
When only a single format is specified, the format selector UI will not appear.
| Format | Value |
|---|---|
| Passport (TD3) | “passport” |
| ID Card (TD1) | “td1” |
| ID Card (TD2) | “td2” |
💡 Note: Limiting the format enhances user experience and accuracy by hiding the format selector UI when only one format is allowed.