How to enable Mrz Mode
MRZ Scanning extracts critical data from the machine-readable zone of documents, particularly travel-related IDs such as passports and visas. This data includes personal information like name, nationality, passport number, and expiration date. MRZ scanning is essential in applications like border control, immigration, and identity verification.
private func setActiveBarcodeTypes() {
guard let decoderConfig = barkoderView.config?.decoderConfig else { return }
decoderConfig.idDocument.enabled = true
}
You can also obtain the images from the MRZ sample using the following code:
func scanningFinished(_ decoderResults: [DecoderResult], thumbnails: [UIImage]?, image: UIImage?) {
for result in decoderResults {
if let images = result.images {
for image in images {
switch image.name {
case "main":
mainImage = image.image
case "document":
documentImage = image.image
case "signature":
signatureImage = image.image
case "picture":
pictureImage = image.image
default:
break
}
}
}
}
}
Register the config:
private func createBarkoderConfig() {
// In order to perform scanning, config property need to be set before
// If license key is not valid you will receive results with asterisks inside
barkoderView.config = BarkoderConfig(licenseKey: "LICENSE_KEY") { licenseResult in
print("Licensing SDK: \(licenseResult)")
}
}