How to Upgrade
From v3.2.x to v3.4.x
Update the Libraries
-
Open the file
[App Project Root Path]\settings.gradleand add the Maven repository:- groovy
- kts
-
dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() maven { url "https://download2.dynamsoft.com/maven/aar" } } } -
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 -
Open the file
[App Project Root Path]\app\build.gradleand add the dependencies:- groovy
- kts
-
dependencies { implementation 'com.dynamsoft:mrzscannerbundle:{version-number}' } -
dependencies { implementation("com.dynamsoft:mrzscannerbundle:{version-number}") }
Please view user guide for the correct version number.
-
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
MRZScannerConfig config = new MRZScannerConfig(); config.setReturnDocumentImage(true); // default: true config.setReturnPortraitImage(true); // default: true config.setReturnOriginalImage(false); // default: false — opt in to enableval 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
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);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
nullif the corresponding return flag is disabled or the image was not captured.getDocumentImage(DS_OPPOSITE)andgetOriginalImage(DS_OPPOSITE)also returnnullfor single-sided documents such as passports.
From v2 to v3
Update the Libraries
-
Open the file
[App Project Root Path]\settings.gradleand add the Maven repository:- groovy
- kts
-
dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() maven { url "https://download2.dynamsoft.com/maven/aar" } } } -
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 -
Open the file
[App Project Root Path]\app\build.gradleand add the dependencies:- groovy
- kts
-
dependencies { implementation 'com.dynamsoft:mrzscannerbundle:{version-number}' } -
dependencies { implementation("com.dynamsoft:mrzscannerbundle:{version-number}") }
Please view user guide for the correct version number.
-
Click Sync Now. After the synchronization is complete, the SDK is added to the project.