You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _articles/indepth/development/mrz.md
+15-14Lines changed: 15 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ One of the solutions that Dynamsoft offers is the [MRZ Scanner](https://www.dyna
13
13
14
14
In this article, we will address how you can integrate the foundational products of the MRZ Scanner JavaScript Edition (Dynamsoft Label Recognizer, Dynamsoft Code Parser) with Dynamic Web TWAIN to implement the ability to read from static images without the need for a camera input.
15
15
16
+
> [!NOTE]
16
17
> You can download the [full sample code](https://github.com/Dynamsoft/mrz-scanner-javascript/tree/main/samples/dwt-mrz) from the Github repository of the MRZ Scanner Samples. Please use this sample as reference when building your own application.
17
18
18
19
## Initialization
@@ -41,7 +42,7 @@ The following is the full code needed to implement the basic functionalities of
@@ -53,13 +54,13 @@ The following is the full code needed to implement the basic functionalities of
53
54
></div>
54
55
55
56
<scripttype="text/javascript">
56
-
var DWTObject;
57
+
var DWTObject;
57
58
var cvRouter;
58
59
59
-
Dynamsoft.DWT.RegisterEvent("OnWebTwainReady", function () {
60
+
Dynamsoft.DWT.RegisterEvent("OnWebTwainReady", function () {
60
61
initializeMRZ();
61
-
DWTObject =Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embedded in the div with id 'dwtcontrolContainer'
62
-
});
62
+
DWTObject =Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embedded in the div with id 'dwtcontrolContainer'
63
+
});
63
64
64
65
/* The objective of this function is to initialize the Capture Vision instance and apply the necessary settings for reading MRZ */
65
66
asyncfunctioninitializeMRZ() {
@@ -81,15 +82,15 @@ The following is the full code needed to implement the basic functionalities of
81
82
}
82
83
83
84
/* This function is used to acquire an image from a physical scanner using the DWT API */
84
-
functionAcquireImage() {
85
+
functionAcquireImage() {
85
86
if (DWTObject) {
86
-
DWTObject.SelectSourceAsync().then(function(){
87
-
returnDWTObject.AcquireImageAsync({
88
-
IfCloseSourceAfterAcquire:true// Scanner source will be closed automatically after the scan.
89
-
});
90
-
}).catch(function (exp) {
91
-
alert(exp.message);
92
-
});
87
+
DWTObject.SelectSourceAsync().then(function(){
88
+
returnDWTObject.AcquireImageAsync({
89
+
IfCloseSourceAfterAcquire:true// Scanner source will be closed automatically after the scan.
90
+
});
91
+
}).catch(function (exp) {
92
+
alert(exp.message);
93
+
});
93
94
}
94
95
}
95
96
@@ -100,7 +101,7 @@ The following is the full code needed to implement the basic functionalities of
100
101
101
102
functionOnFailure(errorCode, errorString) {
102
103
if(errorCode !=-2326)
103
-
alert(errorString);
104
+
alert(errorString);
104
105
}
105
106
106
107
/* The fucntion that is triggered when the user clicks the "Load" button */
0 commit comments