dwt 16.2.5 → 16.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/dist/DynamsoftServiceSetup.deb +0 -0
- package/dist/dist/DynamsoftServiceSetup.msi +0 -0
- package/dist/dist/DynamsoftServiceSetup.pkg +0 -0
- package/dist/dist/DynamsoftServiceSetup.rpm +0 -0
- package/dist/dynamsoft.webtwain.min.js +6 -6
- package/dist/dynamsoft.webtwain.min.mjs +5 -5
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/samples/1.AcquireImage.html +0 -69
- package/samples/2.CustomScan.html +0 -98
- package/samples/3.PDFRasterizer.html +0 -73
- package/samples/4.OCRADocument.html +0 -156
- package/samples/5.ReadBarcode.html +0 -231
- package/samples/6.ScanOrCapture.html +0 -189
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dwt",
|
|
3
|
-
"version": "16.2.
|
|
3
|
+
"version": "16.2.6",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Dynamsoft",
|
|
6
6
|
"url": "https://www.dynamsoft.com"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dist",
|
|
17
17
|
"samples"
|
|
18
18
|
],
|
|
19
|
-
"homepage": "https://www.dynamsoft.com/
|
|
19
|
+
"homepage": "https://www.dynamsoft.com/web-twain/overview/",
|
|
20
20
|
"keywords": [
|
|
21
21
|
"TWAIN",
|
|
22
22
|
"JavaScript",
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Use Auto Feeder to scan</title>
|
|
6
|
-
<script src="../dist/dynamsoft.webtwain.min.js"></script>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body style="padding: 30px;">
|
|
10
|
-
<lable id="ADF" style="font-size: x-large;" ><input type="checkbox" checked="checked">Auto Feeder</lable>
|
|
11
|
-
<input type="button" style="font-size: x-large;" id="acquireButton" value="Acquire" onclick="AcquireImage();" />
|
|
12
|
-
<input type="button" style="font-size: x-large;display:none;" id="mobileFile" value="Acquire" onclick="LoadImage()" />
|
|
13
|
-
<!-- dwtcontrolContainer is the default div id for Dynamic Web TWAIN control.
|
|
14
|
-
If you need to rename the id, you should also change the id in the dynamsoft.webtwain.config.js accordingly. -->
|
|
15
|
-
<br />
|
|
16
|
-
<br />
|
|
17
|
-
<div id="dwtcontrolContainer"></div>
|
|
18
|
-
|
|
19
|
-
<script type="text/javascript">
|
|
20
|
-
Dynamsoft.WebTwainEnv.ResourcesPath = "../dist";
|
|
21
|
-
Dynamsoft.WebTwainEnv.ProductKey = 't00911wAAADwPAaIxHA38XfQgvv+o7wY1qFx4aAL6m5W9nK9ulevyXbe4DIRCPw4FUKWxOQpvvGnefCmnCtBu/1TALNmgEBeWrEAOcP/Asw44TCBWNwip6r+8VPorfA==';
|
|
22
|
-
Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);
|
|
23
|
-
window.onload = function () {
|
|
24
|
-
if (Dynamsoft.Lib.env.bMobile) {
|
|
25
|
-
document.getElementById('ADF').style.display = "none";
|
|
26
|
-
document.getElementById('acquireButton').style.display = "none";
|
|
27
|
-
document.getElementById('mobileFile').style.display = "";
|
|
28
|
-
}
|
|
29
|
-
Dynamsoft.WebTwainEnv.Containers = [{ContainerId:'dwtcontrolContainer', Width:600, Height:800}];
|
|
30
|
-
Dynamsoft.WebTwainEnv.Load();
|
|
31
|
-
};
|
|
32
|
-
var DWObject;
|
|
33
|
-
|
|
34
|
-
function Dynamsoft_OnReady() {
|
|
35
|
-
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function AcquireImage() {
|
|
39
|
-
if (DWObject) {
|
|
40
|
-
DWObject.SelectSource(function () {
|
|
41
|
-
DWObject.OpenSource();
|
|
42
|
-
DWObject.AcquireImage(
|
|
43
|
-
{
|
|
44
|
-
IfShowUI: false,
|
|
45
|
-
IfFeederEnabled: document.getElementById("ADF").checked,
|
|
46
|
-
PixelType: Dynamsoft.EnumDWT_PixelType.TWPT_RGB,
|
|
47
|
-
Resolution: 200,
|
|
48
|
-
IfDisableSourceAfterAcquire: true
|
|
49
|
-
},
|
|
50
|
-
function () {
|
|
51
|
-
console.log("Successful!");
|
|
52
|
-
},
|
|
53
|
-
function (settings, errCode, errString) {
|
|
54
|
-
alert(errString)
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
}, function () {
|
|
58
|
-
alert('SelectSource failed!');
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function LoadImage() {
|
|
64
|
-
DWObject.LoadImageEx('', 5);
|
|
65
|
-
}
|
|
66
|
-
</script>
|
|
67
|
-
</body>
|
|
68
|
-
|
|
69
|
-
</html>
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Custom Scan</title>
|
|
6
|
-
<script src="../dist/dynamsoft.webtwain.min.js"></script>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body style="padding: 30px;">
|
|
10
|
-
<div id="scanOptions">
|
|
11
|
-
<label for="BW" >
|
|
12
|
-
<input type="radio" value="0" name="PixelType">B&W </label>
|
|
13
|
-
<label for="Gray">
|
|
14
|
-
<input type="radio" value="1" name="PixelType">Gray</label>
|
|
15
|
-
<label for="RGB">
|
|
16
|
-
<input type="radio" value="2" name="PixelType" checked="checked">Color</label>
|
|
17
|
-
|
|
|
18
|
-
|
|
19
|
-
<label>
|
|
20
|
-
<input type="checkbox" id="ADF" checked="checked">Auto Feeder</label>
|
|
21
|
-
<label>
|
|
22
|
-
<input type="checkbox" id="ShowUI" checked="checked">Show UI
|
|
23
|
-
<br />
|
|
24
|
-
</label>
|
|
25
|
-
|
|
26
|
-
<select id="Resolution">
|
|
27
|
-
<option value="100">100</option>
|
|
28
|
-
<option value="150">150</option>
|
|
29
|
-
<option value="200">200</option>
|
|
30
|
-
<option value="300">300</option>
|
|
31
|
-
</select>
|
|
32
|
-
<select id="source" style="position: relative; width: 220px;"></select>
|
|
33
|
-
|
|
34
|
-
<input type="button" value="Scan" onclick="AcquireImage();" />
|
|
35
|
-
</div>
|
|
36
|
-
<input type="button" id="mobileFile" value="Acquire" style="font-size: x-large;display:none" onclick="LoadImage()" />
|
|
37
|
-
<br />
|
|
38
|
-
<div id="dwtcontrolContainer"></div>
|
|
39
|
-
<script type="text/javascript">
|
|
40
|
-
Dynamsoft.WebTwainEnv.ResourcesPath = "../dist";
|
|
41
|
-
Dynamsoft.WebTwainEnv.ProductKey = 't00911wAAADwPAaIxHA38XfQgvv+o7wY1qFx4aAL6m5W9nK9ulevyXbe4DIRCPw4FUKWxOQpvvGnefCmnCtBu/1TALNmgEBeWrEAOcP/Asw44TCBWNwip6r+8VPorfA==';
|
|
42
|
-
Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady); // Register OnWebTwainReady event. This event fires as soon as Dynamic Web TWAIN is initialized and ready to be used
|
|
43
|
-
window.onload = function () {
|
|
44
|
-
if (Dynamsoft.Lib.env.bMobile) {
|
|
45
|
-
document.getElementById('scanOptions').style.display = "none";
|
|
46
|
-
document.getElementById('mobileFile').style.display = "";
|
|
47
|
-
}
|
|
48
|
-
Dynamsoft.WebTwainEnv.Containers = [{ContainerId:'dwtcontrolContainer', Width:600, Height:800}];
|
|
49
|
-
Dynamsoft.WebTwainEnv.Load();
|
|
50
|
-
};
|
|
51
|
-
var DWObject;
|
|
52
|
-
|
|
53
|
-
function Dynamsoft_OnReady() {
|
|
54
|
-
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
|
|
55
|
-
if (DWObject) {
|
|
56
|
-
var count = DWObject.SourceCount;
|
|
57
|
-
for (var i = 0; i < count; i++)
|
|
58
|
-
document.getElementById("source").options.add(new Option(DWObject.GetSourceNameItems(i), i));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function AcquireImage() {
|
|
63
|
-
if (DWObject) {
|
|
64
|
-
DWObject.SelectSourceByIndex(document.getElementById("source").selectedIndex);
|
|
65
|
-
DWObject.OpenSource();
|
|
66
|
-
var pixelType = 2;
|
|
67
|
-
var pixelTypeInputs = document.getElementsByName("PixelType");
|
|
68
|
-
for (var i = 0; i < pixelTypeInputs.length; i++) {
|
|
69
|
-
if (pixelTypeInputs[i].checked) {
|
|
70
|
-
pixelType = pixelTypeInputs[i].value;
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
DWObject.AcquireImage(
|
|
75
|
-
{
|
|
76
|
-
IfShowUI: document.getElementById("ShowUI").checked,
|
|
77
|
-
IfFeederEnabled: document.getElementById("ADF").checked,
|
|
78
|
-
PixelType: pixelType,
|
|
79
|
-
Resolution: parseInt(document.getElementById("Resolution").value),
|
|
80
|
-
IfDisableSourceAfterAcquire: true
|
|
81
|
-
},
|
|
82
|
-
function () {
|
|
83
|
-
console.log("Successful!");
|
|
84
|
-
},
|
|
85
|
-
function (settings, errCode, errString) {
|
|
86
|
-
alert(errString)
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function LoadImage() {
|
|
93
|
-
DWObject.LoadImageEx('', 5);
|
|
94
|
-
}
|
|
95
|
-
</script>
|
|
96
|
-
</body>
|
|
97
|
-
|
|
98
|
-
</html>
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Rasterize a PDF</title>
|
|
6
|
-
<script src="../dist/dynamsoft.webtwain.min.js"></script>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body style="padding: 30px;">
|
|
10
|
-
<input type="button" style="font-size: x-large;" id="acquireButton" value="Acquire" onclick="AcquireImage();" />
|
|
11
|
-
<input type="button" style="font-size: x-large;" id="loadButton" value="Load PDFs" onclick="LoadImages();" />
|
|
12
|
-
<br />
|
|
13
|
-
<br />
|
|
14
|
-
<div id="dwtcontrolContainer"></div>
|
|
15
|
-
<script type="text/javascript">
|
|
16
|
-
Dynamsoft.WebTwainEnv.ResourcesPath = "../dist";
|
|
17
|
-
Dynamsoft.WebTwainEnv.ProductKey = 't00911wAAADwPAaIxHA38XfQgvv+o7wY1qFx4aAL6m5W9nK9ulevyXbe4DIRCPw4FUKWxOQpvvGnefCmnCtBu/1TALNmgEBeWrEAOcP/Asw44TCBWNwip6r+8VPorfA==';
|
|
18
|
-
Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);
|
|
19
|
-
window.onload = function () {
|
|
20
|
-
if (Dynamsoft.Lib.env.bMobile) {
|
|
21
|
-
document.getElementById('acquireButton').style.display = "none";
|
|
22
|
-
}
|
|
23
|
-
Dynamsoft.WebTwainEnv.Containers = [{ContainerId:'dwtcontrolContainer', Width:600, Height:800}];
|
|
24
|
-
Dynamsoft.WebTwainEnv.Load();
|
|
25
|
-
};
|
|
26
|
-
var DWObject;
|
|
27
|
-
|
|
28
|
-
function Dynamsoft_OnReady() {
|
|
29
|
-
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function AcquireImage() {
|
|
33
|
-
if (DWObject) {
|
|
34
|
-
DWObject.SelectSource(function () {
|
|
35
|
-
DWObject.OpenSource();
|
|
36
|
-
DWObject.AcquireImage(
|
|
37
|
-
{
|
|
38
|
-
IfShowUI: false,
|
|
39
|
-
PixelType: Dynamsoft.EnumDWT_PixelType.TWPT_RGB,
|
|
40
|
-
Resolution: 200,
|
|
41
|
-
IfDisableSourceAfterAcquire: true
|
|
42
|
-
},
|
|
43
|
-
function () {
|
|
44
|
-
console.log("Successful!");
|
|
45
|
-
},
|
|
46
|
-
function (settings, errCode, errString) {
|
|
47
|
-
alert(errString)
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
}, function () {
|
|
51
|
-
alert('SelectSource failed!');
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function LoadImages() {
|
|
57
|
-
if (DWObject) {
|
|
58
|
-
if (DWObject.Addon && DWObject.Addon.PDF) {
|
|
59
|
-
DWObject.Addon.PDF.SetResolution(300);
|
|
60
|
-
DWObject.Addon.PDF.SetConvertMode(EnumDWT_ConvertMode.CM_RENDERALL);
|
|
61
|
-
}
|
|
62
|
-
DWObject.LoadImageEx('', 4,
|
|
63
|
-
function () { },
|
|
64
|
-
function (errorCode, errorString) {
|
|
65
|
-
alert('Load Image:' + errorString);
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
</script>
|
|
71
|
-
</body>
|
|
72
|
-
|
|
73
|
-
</html>
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>OCR scanned or loaded documents</title>
|
|
6
|
-
<script src="../dist/dynamsoft.webtwain.min.js"></script>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body style="padding: 30px;">
|
|
10
|
-
<div id="notMobile">
|
|
11
|
-
<h1>Scan or Load documents and OCR them (English as an example)</h1>
|
|
12
|
-
<h4>Other languages are also supported, contact support@dynamsoft.com for more info.</h4>
|
|
13
|
-
<p>Note: To avoid CORS errors, please deploy this sample to a HTTP server to try.</p>
|
|
14
|
-
<br />
|
|
15
|
-
<input type="button" value="Scan Documents" onclick="AcquireImage();" />
|
|
16
|
-
<input type="button" value="Load Images or PDFs" onclick="LoadImages();" style="margin-right: 20px;" />
|
|
17
|
-
<input type="button" value="OCR An Image in English" onclick="DoOCR();" />
|
|
18
|
-
<br />
|
|
19
|
-
<br />
|
|
20
|
-
<div id="dwtcontrolContainer" style="float:left;"></div>
|
|
21
|
-
<div id="divNoteMessage" ondblclick="this.innerHTML='';"
|
|
22
|
-
style="margin:0px 20px; float:left;width:300px; height:350px; overflow: auto;background-color:#e7f2fd;border:solid 1px black;">
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<br />
|
|
26
|
-
</div>
|
|
27
|
-
<h1 id="mobile" style="margin:10vmin; display: none;">
|
|
28
|
-
The OCR Add-on is coming to the mobile platform in a later version, stay tuned!!
|
|
29
|
-
</h1>
|
|
30
|
-
<script type="text/javascript">
|
|
31
|
-
Dynamsoft.WebTwainEnv.ResourcesPath = "../dist";
|
|
32
|
-
Dynamsoft.WebTwainEnv.ProductKey = 't00911wAAADwPAaIxHA38XfQgvv+o7wY1qFx4aAL6m5W9nK9ulevyXbe4DIRCPw4FUKWxOQpvvGnefCmnCtBu/1TALNmgEBeWrEAOcP/Asw44TCBWNwip6r+8VPorfA==';
|
|
33
|
-
Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);
|
|
34
|
-
window.onload = function () {
|
|
35
|
-
if (Dynamsoft && Dynamsoft.Lib.env.bWin && Dynamsoft.Lib.product.bHTML5Edition && Dynamsoft.WebTwainEnv.UseLocalService) {
|
|
36
|
-
Dynamsoft.WebTwainEnv.Load();
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
if (Dynamsoft.Lib.env.bMobile) {
|
|
40
|
-
document.getElementById('notMobile').style.display = "none";
|
|
41
|
-
document.getElementById('mobile').style.display = "";
|
|
42
|
-
} else
|
|
43
|
-
alert("The OCR add-on doesn't work on your browser or in the WASM mode, please use modern browsers like Chrome, Firefox in the Service mode.");
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
var DWObject;
|
|
47
|
-
|
|
48
|
-
function Dynamsoft_OnReady() {
|
|
49
|
-
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
|
|
50
|
-
if (DWObject) {
|
|
51
|
-
downloadOCRBasic(true);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function downloadOCRBasic(bDownloadDLL) {
|
|
56
|
-
var strOCRPath = Dynamsoft.WebTwainEnv.ResourcesPath + "/addon/OCRx64.zip",
|
|
57
|
-
strOCRLangPath = Dynamsoft.WebTwainEnv.ResourcesPath + '/addon/OCRBasicLanguages/English.zip';
|
|
58
|
-
|
|
59
|
-
if (bDownloadDLL) {
|
|
60
|
-
if (DWObject.Addon.OCR.IsModuleInstalled()) {
|
|
61
|
-
/*console.log('OCR dll is installed');*/
|
|
62
|
-
downloadOCRBasic(false);
|
|
63
|
-
} else {
|
|
64
|
-
DWObject.Addon.OCR.Download(
|
|
65
|
-
strOCRPath,
|
|
66
|
-
function () { /*console.log('OCR dll is installed');*/
|
|
67
|
-
downloadOCRBasic(false);
|
|
68
|
-
},
|
|
69
|
-
function (errorCode, errorString) {
|
|
70
|
-
console.log(errorString);
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
DWObject.Addon.OCR.DownloadLangData(
|
|
76
|
-
strOCRLangPath,
|
|
77
|
-
function () { },
|
|
78
|
-
function (errorCode, errorString) {
|
|
79
|
-
console.log(errorString);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function AcquireImage() {
|
|
85
|
-
if (DWObject) {
|
|
86
|
-
DWObject.SelectSource(function () {
|
|
87
|
-
DWObject.OpenSource();
|
|
88
|
-
DWObject.AcquireImage(
|
|
89
|
-
{
|
|
90
|
-
IfShowUI: false,
|
|
91
|
-
PixelType: Dynamsoft.EnumDWT_PixelType.TWPT_RGB,
|
|
92
|
-
Resolution: 200,
|
|
93
|
-
IfDisableSourceAfterAcquire: true
|
|
94
|
-
},
|
|
95
|
-
function () {
|
|
96
|
-
console.log("Successful!");
|
|
97
|
-
},
|
|
98
|
-
function (settings, errCode, errString) {
|
|
99
|
-
alert(errString)
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
}, function () {
|
|
103
|
-
alert('SelectSource failed!');
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function LoadImages() {
|
|
109
|
-
if (DWObject) {
|
|
110
|
-
if (DWObject.Addon && DWObject.Addon.PDF) {
|
|
111
|
-
DWObject.Addon.PDF.SetResolution(300);
|
|
112
|
-
DWObject.Addon.PDF.SetConvertMode(EnumDWT_ConvertMode.CM_RENDERALL);
|
|
113
|
-
}
|
|
114
|
-
DWObject.LoadImageEx('', 5,
|
|
115
|
-
function () { },
|
|
116
|
-
function (errorCode, errorString) {
|
|
117
|
-
alert('Load Image:' + errorString);
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function DoOCR() {
|
|
124
|
-
if (DWObject) {
|
|
125
|
-
if (DWObject.HowManyImagesInBuffer == 0) {
|
|
126
|
-
alert("Please scan or load an image first.");
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
DWObject.Addon.OCR.SetLanguage('eng');
|
|
130
|
-
DWObject.Addon.OCR.SetOutputFormat(EnumDWT_OCROutputFormat.OCROF_TEXT);
|
|
131
|
-
DWObject.Addon.OCR.Recognize(
|
|
132
|
-
DWObject.CurrentImageIndexInBuffer,
|
|
133
|
-
function (sImageIndex, result) {
|
|
134
|
-
if (result == null)
|
|
135
|
-
return null;
|
|
136
|
-
var _textResult = (Dynamsoft.Lib.base64.decode(result.Get())).split(/\r?\n/g),
|
|
137
|
-
_resultToShow = [];
|
|
138
|
-
for (var i = 0; i < _textResult.length; i++) {
|
|
139
|
-
if (i == 0 && _textResult[i].trim() == "")
|
|
140
|
-
continue;
|
|
141
|
-
_resultToShow.push(_textResult[i] + '<br />');
|
|
142
|
-
}
|
|
143
|
-
_resultToShow.splice(0, 0, '<p style="padding:5px; margin:0;">');
|
|
144
|
-
_resultToShow.push('</p>');
|
|
145
|
-
document.getElementById('divNoteMessage').innerHTML = _resultToShow.join('');
|
|
146
|
-
},
|
|
147
|
-
function (errorcode, errorstring, result) {
|
|
148
|
-
alert(errorstring);
|
|
149
|
-
}
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
</script>
|
|
154
|
-
</body>
|
|
155
|
-
|
|
156
|
-
</html>
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Read Barcode on Scanned or Loaded Documents</title>
|
|
6
|
-
<script src="../dist/dynamsoft.webtwain.min.js"></script>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body style="padding: 30px;">
|
|
10
|
-
<h1>Read Barcode on Scanned or Loaded Documents</h1>
|
|
11
|
-
<br />
|
|
12
|
-
<input id="scanButton" style="font-size: x-large;" type="button" value="Scan Documents" onclick="AcquireImage();" />
|
|
13
|
-
<input type="button" style="font-size: x-large;" id="loadButton" value="Load Images" onclick="LoadImages();" />
|
|
14
|
-
<input type="button" style="font-size: x-large; display: none;" id="loadPDF" value="Load PDF" onclick="LoadPDFs();" />
|
|
15
|
-
<select id="barcodeformat" style="font-size: x-large;"></select>
|
|
16
|
-
<input type="button" style="font-size: x-large;" value="Read Barcode" onclick="ReadBarcode();" />
|
|
17
|
-
<br />
|
|
18
|
-
<br />
|
|
19
|
-
<div id="dwtcontrolContainer" style="float:left;"></div>
|
|
20
|
-
<div id="divNoteMessage" ondblclick="this.innerHTML='';"
|
|
21
|
-
style="margin:0px 20px;float:left;width:300px; height:800px; overflow: auto;background-color:#e7f2fd;border:solid 1px black;">
|
|
22
|
-
</div>
|
|
23
|
-
<script type="text/javascript">
|
|
24
|
-
Dynamsoft.WebTwainEnv.ResourcesPath = "../dist";
|
|
25
|
-
Dynamsoft.WebTwainEnv.ProductKey = 't00911wAAADwPAaIxHA38XfQgvv+o7wY1qFx4aAL6m5W9nK9ulevyXbe4DIRCPw4FUKWxOQpvvGnefCmnCtBu/1TALNmgEBeWrEAOcP/Asw44TCBWNwip6r+8VPorfA==';
|
|
26
|
-
Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);
|
|
27
|
-
window.onload = function () {
|
|
28
|
-
if (Dynamsoft.Lib.env.bMobile) {
|
|
29
|
-
document.getElementById('scanButton').style.display = "none";
|
|
30
|
-
document.getElementById('loadPDF').style.display = "";
|
|
31
|
-
}
|
|
32
|
-
Dynamsoft.WebTwainEnv.Containers = [{ ContainerId: 'dwtcontrolContainer', Width: 600, Height: 800 }];
|
|
33
|
-
Dynamsoft.WebTwainEnv.Load();
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
function fileChanged(inputTarget) {
|
|
37
|
-
DWObject.LoadImageFromBinary(
|
|
38
|
-
inputTarget.files[0],
|
|
39
|
-
function () { inputTarget.value = ""; },
|
|
40
|
-
function (errCode, errString) { alert(errString); });
|
|
41
|
-
}
|
|
42
|
-
var DWObject, dbrObject, barcodeText = [];
|
|
43
|
-
var BarcodeInfo = [{
|
|
44
|
-
desc: "All",
|
|
45
|
-
val: -32505857
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
desc: "1D Barcodes",
|
|
49
|
-
val: 2047
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
desc: "Aztec",
|
|
53
|
-
val: 268435456
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
desc: "QR Code",
|
|
57
|
-
val: 67108864
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
desc: "PDF417",
|
|
61
|
-
val: 33554432
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
desc: "DATAMATRIX",
|
|
65
|
-
val: 134217728
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
desc: "CODE_39",
|
|
69
|
-
val: 1
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
desc: "CODE_128",
|
|
73
|
-
val: 2
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
desc: "CODE_93",
|
|
77
|
-
val: 4
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
desc: "CODABAR",
|
|
81
|
-
val: 8
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
desc: "EAN_13",
|
|
85
|
-
val: 32
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
desc: "EAN_8",
|
|
89
|
-
val: 64
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
desc: "UPC_A",
|
|
93
|
-
val: 128
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
desc: "UPC_E",
|
|
97
|
-
val: 256
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
desc: "Interleaved 2 of 5 (ITF)",
|
|
101
|
-
val: 16
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
desc: "Industrial 2 of 5",
|
|
105
|
-
val: 512
|
|
106
|
-
}
|
|
107
|
-
];
|
|
108
|
-
|
|
109
|
-
function Dynamsoft_OnReady() {
|
|
110
|
-
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
|
111
|
-
if (DWObject) {
|
|
112
|
-
for (var index = 0; index < BarcodeInfo.length; index++)
|
|
113
|
-
document.getElementById("barcodeformat").options.add(new Option(BarcodeInfo[index].desc, index));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function AcquireImage() {
|
|
118
|
-
if (DWObject) {
|
|
119
|
-
DWObject.SelectSource(function () {
|
|
120
|
-
DWObject.OpenSource();
|
|
121
|
-
DWObject.AcquireImage(
|
|
122
|
-
{
|
|
123
|
-
IfShowUI: false,
|
|
124
|
-
PixelType: Dynamsoft.EnumDWT_PixelType.TWPT_RGB,
|
|
125
|
-
Resolution: 200,
|
|
126
|
-
IfDisableSourceAfterAcquire: true
|
|
127
|
-
},
|
|
128
|
-
function () {
|
|
129
|
-
console.log("Successful!");
|
|
130
|
-
},
|
|
131
|
-
function (settings, errCode, errString) {
|
|
132
|
-
alert(errString)
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
}, function () {
|
|
136
|
-
alert('SelectSource failed!');
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function LoadImages() {
|
|
142
|
-
if (DWObject) {
|
|
143
|
-
if (DWObject.Addon && DWObject.Addon.PDF) {
|
|
144
|
-
DWObject.Addon.PDF.SetResolution(300);
|
|
145
|
-
DWObject.Addon.PDF.SetConvertMode(EnumDWT_ConvertMode.CM_RENDERALL);
|
|
146
|
-
}
|
|
147
|
-
DWObject.LoadImageEx('', 5,
|
|
148
|
-
function () { },
|
|
149
|
-
function (errorCode, errorString) {
|
|
150
|
-
alert('Load Image:' + errorString);
|
|
151
|
-
}
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function LoadPDFs() {
|
|
157
|
-
if (DWObject) {
|
|
158
|
-
if (DWObject.Addon && DWObject.Addon.PDF) {
|
|
159
|
-
DWObject.Addon.PDF.SetResolution(300);
|
|
160
|
-
DWObject.Addon.PDF.SetConvertMode(EnumDWT_ConvertMode.CM_RENDERALL);
|
|
161
|
-
}
|
|
162
|
-
DWObject.LoadImageEx('', 4,
|
|
163
|
-
function () { },
|
|
164
|
-
function (errorCode, errorString) {
|
|
165
|
-
alert('Load Image:' + errorString);
|
|
166
|
-
}
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function ReadBarcode() {
|
|
172
|
-
if (DWObject) {
|
|
173
|
-
if (DWObject.HowManyImagesInBuffer == 0) {
|
|
174
|
-
alert("Please scan or load an image first.");
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
Dynamsoft.Lib.showMask();
|
|
178
|
-
DWObject.Addon.BarcodeReader.getRuntimeSettings()
|
|
179
|
-
.then(function (settings) {
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Setting up the barcode reader
|
|
183
|
-
*/
|
|
184
|
-
settings.barcodeFormatIds = BarcodeInfo[document.getElementById("barcodeformat").selectedIndex].val;
|
|
185
|
-
settings.expectedBarcodesCount = 512;
|
|
186
|
-
settings.scaleDownThreshold = 2147483647;
|
|
187
|
-
/** End of settings */
|
|
188
|
-
return DWObject.Addon.BarcodeReader.updateRuntimeSettings(settings);
|
|
189
|
-
})
|
|
190
|
-
.then(function (settings) {
|
|
191
|
-
return DWObject.Addon.BarcodeReader.decode(DWObject.CurrentImageIndexInBuffer);
|
|
192
|
-
})
|
|
193
|
-
.then(function (results) {
|
|
194
|
-
var _now = new Date().toLocaleTimeString() + "<br />";
|
|
195
|
-
var objDiv = document.getElementById('divNoteMessage');
|
|
196
|
-
objDiv.innerHTML += _now;
|
|
197
|
-
if (results.length == 0) {
|
|
198
|
-
objDiv.innerHTML += "Nothing Found!<br />";
|
|
199
|
-
} else {
|
|
200
|
-
objDiv.innerHTML +=
|
|
201
|
-
"<p style='color: #fe8e14'>Barcode Found!!</p>";
|
|
202
|
-
barcodeText = [];
|
|
203
|
-
for (i = 0; i < results.length; i++) {
|
|
204
|
-
var result = results[i];
|
|
205
|
-
Barcode_text = result.BarcodeText;
|
|
206
|
-
var loc = result.LocalizationResult;
|
|
207
|
-
var x = loc.x1;
|
|
208
|
-
var y = loc.y1;
|
|
209
|
-
var format = result.BarcodeFormatString;
|
|
210
|
-
barcodeText.push("barcode[" + (i + 1) + "]: " + "<br />");
|
|
211
|
-
barcodeText.push("<strong>" + Barcode_text + "</strong>");
|
|
212
|
-
barcodeText.push("<br />format:" + format + "<br />");
|
|
213
|
-
barcodeText.push("x:" + x + "y:" + y + "<br />");
|
|
214
|
-
barcodeText.push("------------------------------<br />");
|
|
215
|
-
}
|
|
216
|
-
barcodeText.splice(0, 0, '<p style="padding:5px; margin:0;">');
|
|
217
|
-
barcodeText.push('</p>');
|
|
218
|
-
objDiv.innerHTML += barcodeText.join('');
|
|
219
|
-
}
|
|
220
|
-
objDiv.scrollTop = objDiv.scrollHeight;
|
|
221
|
-
Dynamsoft.Lib.hideMask()
|
|
222
|
-
}, function (ex) {
|
|
223
|
-
alert(ex);
|
|
224
|
-
Dynamsoft.Lib.hideMask()
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
</script>
|
|
229
|
-
</body>
|
|
230
|
-
|
|
231
|
-
</html>
|