Skip to content

Commit e37eeb0

Browse files
authored
Merge pull request #900 from dynamsoft-docs/preview
update to internal commit 0335aaa7
2 parents 86f10d1 + 93a4307 commit e37eeb0

File tree

1 file changed

+15
-14
lines changed
  • _articles/indepth/development

1 file changed

+15
-14
lines changed

_articles/indepth/development/mrz.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ One of the solutions that Dynamsoft offers is the [MRZ Scanner](https://www.dyna
1313

1414
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.
1515

16+
> [!NOTE]
1617
> 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.
1718
1819
## Initialization
@@ -41,7 +42,7 @@ The following is the full code needed to implement the basic functionalities of
4142
</head>
4243

4344
<body>
44-
<input type="button" value="Scan" onclick="AcquireImage();" />
45+
<input type="button" value="Scan" onclick="AcquireImage();" />
4546
<input type="button" value="Load" onclick="LoadImage();" />
4647
<input type="button" value="Read MRZ" onclick="readMRZ();" />
4748
<div id="dwtcontrolContainer" style="width: 350px; height: 380px;"></div>
@@ -53,13 +54,13 @@ The following is the full code needed to implement the basic functionalities of
5354
></div>
5455

5556
<script type="text/javascript">
56-
var DWTObject;
57+
var DWTObject;
5758
var cvRouter;
5859
59-
Dynamsoft.DWT.RegisterEvent("OnWebTwainReady", function () {
60+
Dynamsoft.DWT.RegisterEvent("OnWebTwainReady", function () {
6061
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+
});
6364
6465
/* The objective of this function is to initialize the Capture Vision instance and apply the necessary settings for reading MRZ */
6566
async function initializeMRZ() {
@@ -81,15 +82,15 @@ The following is the full code needed to implement the basic functionalities of
8182
}
8283
8384
/* This function is used to acquire an image from a physical scanner using the DWT API */
84-
function AcquireImage() {
85+
function AcquireImage() {
8586
if (DWTObject) {
86-
DWTObject.SelectSourceAsync().then(function(){
87-
return DWTObject.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+
return DWTObject.AcquireImageAsync({
89+
IfCloseSourceAfterAcquire: true // Scanner source will be closed automatically after the scan.
90+
});
91+
}).catch(function (exp) {
92+
alert(exp.message);
93+
});
9394
}
9495
}
9596
@@ -100,7 +101,7 @@ The following is the full code needed to implement the basic functionalities of
100101
101102
function OnFailure(errorCode, errorString) {
102103
if(errorCode != -2326)
103-
alert(errorString);
104+
alert(errorString);
104105
}
105106
106107
/* The fucntion that is triggered when the user clicks the "Load" button */

0 commit comments

Comments
 (0)