Table of contents

How to Upgrade

From v3.2.x to v3.4.x

Update the Libraries

  1. Open the file [App Project Root Path]\settings.gradle and add the Maven repository:

    • groovy
    • kts
    1. dependencyResolutionManagement {
         repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
         repositories {
            google()
            mavenCentral()
            maven {
               url "https://download2.dynamsoft.com/maven/aar"
            }
         }
      }
      
    2. dependencyResolutionManagement {
         repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
         repositories {
            google()
            mavenCentral()
            maven {
               url = uri("https://download2.dynamsoft.com/maven/aar")
            }
         }
      }
      

    If you are using gradle 6.x or older version, the maven dependencies should be configured in [App Project Root Path]\app\build.gradle

  2. Open the file [App Project Root Path]\app\build.gradle and add the dependencies:

    • groovy
    • kts
    1. dependencies {
         implementation 'com.dynamsoft:mrzscannerbundle:{version-number}'
      }
      
    2. dependencies {
         implementation("com.dynamsoft:mrzscannerbundle:{version-number}")
      }
      

    Please view user guide for the correct version number.

  3. Click Sync Now. After the synchronization is complete, the SDK is added to the project.

Adopt the New Image Capture APIs

v3.4.x adds the ability to retrieve captured images alongside the parsed MRZ data. Three types of images are available via MRZScanResult:

  • Document image — a cropped, perspective-corrected image of the document. Enabled by default.
  • Portrait image — the portrait extracted from the document. Enabled by default.
  • Original image — the raw full-frame camera capture. Disabled by default.

Control which images are returned using the new MRZScannerConfig methods:

  • Java
  • Kotlin
  1. MRZScannerConfig config = new MRZScannerConfig();
    config.setReturnDocumentImage(true);  // default: true
    config.setReturnPortraitImage(true);  // default: true
    config.setReturnOriginalImage(false); // default: false — opt in to enable
    
  2. val config = MRZScannerConfig()
    config.setReturnDocumentImage(true)   // default: true
    config.setReturnPortraitImage(true)   // default: true
    config.setReturnOriginalImage(false)  // default: false — opt in to enable
    

Retrieve the images from the scan result:

  • Java
  • Kotlin
  1. ImageData portrait = result.getPortraitImage();
    ImageData docImage = result.getDocumentImage(EnumDocumentSide.DS_MRZ);
    ImageData original = result.getOriginalImage(EnumDocumentSide.DS_MRZ);
    // For two-sided ID cards, also retrieve the opposite side:
    ImageData opposite = result.getDocumentImage(EnumDocumentSide.DS_OPPOSITE);
    
  2. val portrait = result.getPortraitImage()
    val docImage = result.getDocumentImage(EnumDocumentSide.DS_MRZ)
    val original = result.getOriginalImage(EnumDocumentSide.DS_MRZ)
    // For two-sided ID cards, also retrieve the opposite side:
    val opposite = result.getDocumentImage(EnumDocumentSide.DS_OPPOSITE)
    

All three methods return null if the corresponding return flag is disabled or the image was not captured. getDocumentImage(DS_OPPOSITE) and getOriginalImage(DS_OPPOSITE) also return null for single-sided documents such as passports.

From v2 to v3

Update the Libraries

  1. Open the file [App Project Root Path]\settings.gradle and add the Maven repository:

    • groovy
    • kts
    1. dependencyResolutionManagement {
         repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
         repositories {
            google()
            mavenCentral()
            maven {
               url "https://download2.dynamsoft.com/maven/aar"
            }
         }
      }
      
    2. dependencyResolutionManagement {
         repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
         repositories {
            google()
            mavenCentral()
            maven {
               url = uri("https://download2.dynamsoft.com/maven/aar")
            }
         }
      }
      

    If you are using gradle 6.x or older version, the maven dependencies should be configured in [App Project Root Path]\app\build.gradle

  2. Open the file [App Project Root Path]\app\build.gradle and add the dependencies:

    • groovy
    • kts
    1. dependencies {
         implementation 'com.dynamsoft:mrzscannerbundle:{version-number}'
      }
      
    2. dependencies {
         implementation("com.dynamsoft:mrzscannerbundle:{version-number}")
      }
      

    Please view user guide for the correct version number.

  3. Click Sync Now. After the synchronization is complete, the SDK is added to the project.

This page is compatible for: