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 void SetActiveBarcodeTypes()
{
BKDView.SetBarcodeTypeEnabled(Plugin.Maui.Barkoder.Enums.BarcodeType.IDDocument, true);
}
You can also obtain the images from the MRZ sample using the following code:
public void DidFinishScanning(BarcodeResult[] results, ImageSource originalImageSource)
{
if (results != null && results.Length > 0)
{
foreach (var result in results)
{
// Check if the barcode type is MRZ
if (result.BarcodeTypeName == "MRZ")
{
if (result.MrzImages != null && result.MrzImages.Length > 0)
{
foreach (var imageDescriptor in result.MrzImages)
{
// Assign images based on their names
switch (imageDescriptor.Name.ToLower())
{
case "main":
MainImage.Source = imageDescriptor.Image;
break;
case "document":
DocumentImage.Source = imageDescriptor.Image;
break;
case "signature":
SignatureImage.Source = imageDescriptor.Image;
break;
case "picture":
PictureImage.Source = imageDescriptor.Image;
break;
}
}
}
}
}
}
}