·
3 commits
to release/v4.x/v4.0.0
since this release
4.0.0 (05/22/2026)
A major release with a redesigned scanner UI, a new image-extraction pipeline, multi-side scanning, first-class visa support, and a leaner API surface that drops the bundled result view in favor of consumer-rendered results.
Highlighted Features
- Image extraction in scan results. Opt in via
returnOriginalImage/returnDocumentImage/returnPortraitImageonMRZScannerConfig, then read the deskewed crop, the full original frame, and the portrait crop viaMRZResult.getDocumentImage(side),getOriginalImage(side), andgetPortraitImage(). Each returns aDSImageDatawithtoCanvas()/toBlob()helpers. - Multi-side scanning. When the portrait sits on the opposite side of the MRZ (typical of TD1 / TD2 ID cards), the scanner prompts the user to flip the document and captures both sides in one session. The new
EnumDocumentSide(MRZ/Opposite) selects which side to retrieve. Tunable viaflipDocumentTimeout(default3000ms). - First-class visa types. Visas are no longer conflated with Passport / TD2.
EnumMRZDocumentTypegainsMRVA(TD3-sized) andMRVB(TD2-sized), with matching values inEnumMRZScanMode. - Redesigned
MRZScannerView. New SVG guide frames, animated scan spinner, and refreshed toolbar. Four newscannerViewConfiginterfaces give full customization:toolbarButtonsConfig(per-button icon / label / className / visibility),formatSelectorConfig(localize format buttons),messagesConfig(localize all on-screen text, including a{seconds}placeholder for the flip-document countdown), andthemeConfig(color, typography, and spacing tokens). - URL input to
launch().launch()now accepts a string URL alongsideBlob,DSImageData, and HTML media elements; the library fetches and decodes the URL internally. OptionalData1andOptionalData2ICAO optional-data fields now exposed onEnumMRZData.MRZData.documentTypeis now typed as DCV'sEnumCodeType.
Breaking Changes
MRZResultViewis removed, along withMRZResultViewConfig,MRZResultViewToolbarButtonsConfig,resultViewConfig, andshowResultView. Consumers render the result themselves — see the User Guide for a worked example.MRZResult.originalImageResultandMRZResult.imageDataare removed, replaced bygetOriginalImage(side). The MWC-specific_imageDatainternal is also gone.- API renames:
showUploadImage→showLoadImageButton,uploadAcceptedTypes→loadImageAcceptedTypes,uploadFileConverter→loadImageFileConverter,showScanGuide→enableScanRegion,EnumMRZScanMode.Passport→EnumMRZScanMode.TD3. EnumMRZDocumentTypestring values changed to disambiguate visas:Passport's value is now"td3_passport"(was"passport"),TD1is"td1_id"(was"td1"),TD2is"td2_id"(was"td2"). Code using the enum references is unaffected; raw-string comparisons must be updated.MRZResultshape changed. Now an interface with image-getter methods. Thestatusfield is optional and usesEnumResultStatusdirectly (was aResultStatusobject withcode/message).- DCV namespace flattened. DCV exports are now reachable directly under
Dynamsoft.*instead of the previousDynamsoft.Dynamsoft.*nesting.
Fixes & Improvements
- Upgraded the underlying DCV to 3.4.2001 under new package names:
dynamsoft-capture-vision-bundleanddynamsoft-capture-vision-data. - New scan-quality controls:
enableMultiFrameCrossFilter(defaulttrue) for DCV multi-frame cross-verification, andenableScanRegion(defaulttrue) for the rectangular guide frame. - Engine resource paths now resolve relative to the script's own URL, so consumers no longer hard-code CDN paths.
UtilizedTemplateNamesaccepts either a string or aTemplatePair({ full, mrzOnly }) per scan mode, enabling separate full-frame and MRZ-only templates.- Reduced repeated camera permission prompts on Firefox Android.
- Removed spurious TD3-visa matches from passport scanning.
- Prevented portrait-image clipping on capture via asymmetric margins.
- Format selector and scan results now respect
mrzFormatType, only surfacing the categories the consumer opted into. - Visual guide-frame visibility properly respects
enableScanRegion. - The configured
cameraAccessDeniedmessage is now displayed on permission denial. - Bundle pruned to ESM + CJS + a single IIFE; template files renamed from
.htmlto.xml(mrz-scanner.ui.xml,mrz-scanner.template.json); fixed nesteddist/artifact in the published package.