dwt 17.3.4 → 18.0.2
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/LICENSE.txt +2 -2
- package/README.md +26 -33
- package/dist/addon/dbrjs/dbr-9.2.13.browser.worker.js +11 -0
- package/dist/addon/dbrjs/dbr-9.2.13.full.wasm +0 -0
- package/dist/addon/dbrjs/{dbr-8.8.7.full.wasm.js → dbr-9.2.13.full.wasm.js} +285 -285
- package/dist/addon/dbrjs/dbr.js +21 -22
- package/dist/addon/dynamsoft.webtwain.addon.camera.css +7 -7
- package/dist/dist/DynamsoftServiceSetup-arm64.deb +0 -0
- 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 +327 -191
- package/dist/dynamsoft.webtwain.min.mjs +330 -195
- package/dist/src/{dynamsoft.imagecore-1.7.3.wasm → dynamsoft.imagecore-1.8.0.wasm} +0 -0
- package/dist/src/{dynamsoft.imageio-1.7.3.wasm → dynamsoft.imageio-1.8.0.wasm} +0 -0
- package/dist/src/{dynamsoft.imageio_wasm-1.7.3.js → dynamsoft.imageio_wasm-1.8.0.js} +34 -34
- package/dist/src/dynamsoft.lts.js +12 -34
- package/dist/src/{dynamsoft.pdfReader-1.7.3.wasm → dynamsoft.pdfReader-1.8.0.wasm} +0 -0
- package/dist/src/{dynamsoft.pdfReader_wasm-1.7.3.js → dynamsoft.pdfReader_wasm-1.8.0.js} +34 -34
- package/dist/src/dynamsoft.viewer.css +2 -2
- package/dist/src/dynamsoft.viewer.js +1 -1
- package/dist/src/dynamsoft.webtwain.css +43 -21
- package/dist/src/fastcomp/{dynamsoft.imagecore-1.7.3.wasm → dynamsoft.imagecore-1.8.0.wasm} +0 -0
- package/dist/src/fastcomp/{dynamsoft.imageio-1.7.3.wasm → dynamsoft.imageio-1.8.0.wasm} +0 -0
- package/dist/src/fastcomp/{dynamsoft.imageio_wasm-1.7.3.js → dynamsoft.imageio_wasm-1.8.0.js} +34 -34
- package/dist/types/Addon.Camera.d.ts +22 -4
- package/dist/types/Dynamsoft.Enum.d.ts +14 -0
- package/dist/types/Dynamsoft.d.ts +81 -2
- package/dist/types/WebTwain.Acquire.d.ts +37 -3
- package/dist/types/WebTwain.Viewer.d.ts +21 -17
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/addon/dbrjs/dbr-8.8.7.full.wasm +0 -0
- package/dist/addon/dbrjs/dbr-8.8.7.worker.js +0 -113
- package/dist/dist/DynamsoftServiceSetup-mips64el.deb +0 -0
- package/samples/AcquireImage.html +0 -69
- package/samples/CustomScan.html +0 -98
- package/samples/Dynamic Web TWAIN Online Demo.html +0 -8
- package/samples/Dynamic Web TWAIN Sample Code Gallery.html +0 -8
- package/samples/Edit.html +0 -111
- package/samples/LoadAndSaveImages.html +0 -103
- package/samples/Navigation.html +0 -197
- package/samples/PDFRasterizer.html +0 -88
- package/samples/ReadBarcode.html +0 -231
- package/samples/ScanOrCapture.html +0 -202
- package/samples/Thumbnail.html +0 -88
- package/samples/mobilebrowsercapture.html +0 -13
- /package/dist/src/{dynamsoft.crypto-1.7.3.wasm → dynamsoft.crypto-1.8.0.wasm} +0 -0
- /package/dist/src/{dynamsoft.imageProc-1.7.3.wasm → dynamsoft.imageProc-1.8.0.wasm} +0 -0
- /package/dist/src/{dynamsoft.imageProc-sn-1.7.3.wasm → dynamsoft.imageProc-sn-1.8.0.wasm} +0 -0
- /package/dist/src/{dynamsoft.pdfWriter-1.7.3.wasm → dynamsoft.pdfWriter-1.8.0.wasm} +0 -0
- /package/dist/src/fastcomp/{dynamsoft.crypto-1.7.3.wasm → dynamsoft.crypto-1.8.0.wasm} +0 -0
- /package/dist/src/fastcomp/{dynamsoft.imageProc-1.7.3.wasm → dynamsoft.imageProc-1.8.0.wasm} +0 -0
- /package/dist/src/fastcomp/{dynamsoft.pdfWriter-1.7.3.wasm → dynamsoft.pdfWriter-1.8.0.wasm} +0 -0
package/samples/Navigation.html
DELETED
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Dynamic Web TWAIN Navigation Sample</title>
|
|
6
|
-
<script src="../dist/dynamsoft.webtwain.min.js"></script>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body style="padding: 30px;">
|
|
10
|
-
<select size="1" id="source" style="position: relative; width: 220px;font-size: x-large;"></select>
|
|
11
|
-
<input type="button" style="font-size: x-large;" value="Scan" onclick="AcquireImage();" />
|
|
12
|
-
<input type="button" style="font-size: x-large;" value="Load" onclick="LoadImage();" />
|
|
13
|
-
<br />
|
|
14
|
-
<br />
|
|
15
|
-
<div style="width: 480px; display: block;">
|
|
16
|
-
|
|
17
|
-
<!-- dwtcontrolContainer is the default div id for Dynamic Web TWAIN control.
|
|
18
|
-
If you need to rename the id, you should also change the id in the dynamsoft.webtwain.config.js accordingly. -->
|
|
19
|
-
<div id="dwtcontrolContainer"></div>
|
|
20
|
-
|
|
21
|
-
<div style="width: 800px;">
|
|
22
|
-
<input style="font-size: x-large;" onclick="btnFirstImage_onclick()" type="button" value=" |< " />
|
|
23
|
-
<input style="font-size: x-large;" onclick="btnPreImage_onclick()" type="button" value=" < " />
|
|
24
|
-
<input style="font-size: x-large;" type="text" size="2" id="DW_CurrentImage" readonly="readonly" value="0" /> /
|
|
25
|
-
<input style="font-size: x-large;" type="text" size="2" id="DW_TotalImage" readonly="readonly" value="0" />
|
|
26
|
-
<input style="font-size: x-large;" onclick="btnNextImage_onclick()" type="button" value=" > " />
|
|
27
|
-
<input style="font-size: x-large;" onclick="btnLastImage_onclick()" type="button" value=" >| " /> Preview Mode:
|
|
28
|
-
<select style="font-size: x-large;" size="1" id="DW_PreviewMode" onchange="setlPreviewMode();">
|
|
29
|
-
<option value="0">1X1</option>
|
|
30
|
-
<option value="1">2X2</option>
|
|
31
|
-
<option value="2">3X3</option>
|
|
32
|
-
<option value="3">4X4</option>
|
|
33
|
-
<option value="4">5X5</option>
|
|
34
|
-
</select>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
<input style="font-size: x-large;" onclick="btnRemoveSelectedImages_onclick()" type="button" value="Remove Selected Images" />
|
|
39
|
-
<input style="font-size: x-large;" onclick="btnRemoveAllImages_onclick()" type="button" value="Remove All Images" />
|
|
40
|
-
|
|
41
|
-
<script type="text/javascript">
|
|
42
|
-
Dynamsoft.DWT.ResourcesPath = "../dist";
|
|
43
|
-
Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
|
|
44
|
-
window.onload = function () {
|
|
45
|
-
Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:700, Height:600}];
|
|
46
|
-
Dynamsoft.DWT.Load();
|
|
47
|
-
};
|
|
48
|
-
var console = window['console'] ? window['console'] : { 'log': function () { } };
|
|
49
|
-
|
|
50
|
-
Dynamsoft.DWT.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady); // Register OnWebTwainReady event. This event fires as soon as Dynamic Web TWAIN is initialized and ready to be used
|
|
51
|
-
|
|
52
|
-
var DWObject;
|
|
53
|
-
|
|
54
|
-
function Dynamsoft_OnReady() {
|
|
55
|
-
DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
|
|
56
|
-
if (DWObject) {
|
|
57
|
-
var count = DWObject.SourceCount; // Get how many sources are installed in the system
|
|
58
|
-
|
|
59
|
-
for (var i = 0; i < count; i++)
|
|
60
|
-
document.getElementById("source").options.add(new Option(DWObject.GetSourceNameItems(i), i)); // Add the sources in a drop-down list
|
|
61
|
-
|
|
62
|
-
// The event OnPostTransfer fires after each image is scanned and transferred
|
|
63
|
-
DWObject.RegisterEvent("OnPostTransfer", function () {
|
|
64
|
-
setTimeout(updatePageInfo,20);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// The event OnPostLoad fires after the images from a local directory have been loaded into the control
|
|
68
|
-
DWObject.RegisterEvent("OnPostLoad", function () {
|
|
69
|
-
setTimeout(updatePageInfo,20);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// The event click fires when the mouse clicks on an image on Dynamic Web TWAIN viewer
|
|
73
|
-
DWObject.Viewer.on("click", function () {
|
|
74
|
-
updatePageInfo();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// The event topPageChanged fires when the top image currently displayed in the viewer changes
|
|
78
|
-
DWObject.Viewer.on("topPageChanged", topPageChanged);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function topPageChanged(index){
|
|
83
|
-
DWObject.CurrentImageIndexInBuffer = index;
|
|
84
|
-
updatePageInfo();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function AcquireImage() {
|
|
88
|
-
if (DWObject) {
|
|
89
|
-
var OnAcquireImageSuccess, OnAcquireImageFailure;
|
|
90
|
-
OnAcquireImageSuccess = OnAcquireImageFailure = function () {
|
|
91
|
-
DWObject.CloseSource();
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
DWObject.SelectSourceByIndex(document.getElementById("source").selectedIndex);
|
|
95
|
-
DWObject.OpenSource();
|
|
96
|
-
DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
|
|
97
|
-
DWObject.AcquireImage(OnAcquireImageSuccess, OnAcquireImageFailure);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
//Callback functions for async APIs
|
|
102
|
-
function OnSuccess() {
|
|
103
|
-
console.log('successful');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function OnFailure(errorCode, errorString) {
|
|
107
|
-
alert(errorString);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function LoadImage() {
|
|
111
|
-
if (DWObject) {
|
|
112
|
-
DWObject.IfShowFileDialog = true; // Open the system's file dialog to load image
|
|
113
|
-
DWObject.LoadImageEx("", Dynamsoft.DWT.EnumDWT_ImageType.IT_ALL, OnSuccess, OnFailure); // Load images in all supported formats (.bmp, .jpg, .tif, .png, .pdf). OnSuccess or OnFailure will be called after the operation
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function btnPreImage_onclick() {
|
|
118
|
-
if (DWObject) {
|
|
119
|
-
DWObject.Viewer.off("topPageChanged", topPageChanged);
|
|
120
|
-
DWObject.Viewer.previous();
|
|
121
|
-
updatePageInfo();
|
|
122
|
-
DWObject.Viewer.on("topPageChanged", topPageChanged);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function btnNextImage_onclick() {
|
|
127
|
-
if (DWObject) {
|
|
128
|
-
DWObject.Viewer.off("topPageChanged", topPageChanged);
|
|
129
|
-
DWObject.Viewer.next();
|
|
130
|
-
updatePageInfo();
|
|
131
|
-
DWObject.Viewer.on("topPageChanged", topPageChanged);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function btnFirstImage_onclick() {
|
|
136
|
-
if (DWObject) {
|
|
137
|
-
DWObject.Viewer.first();
|
|
138
|
-
updatePageInfo();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function btnLastImage_onclick() {
|
|
143
|
-
if (DWObject) {
|
|
144
|
-
DWObject.Viewer.off("topPageChanged", topPageChanged);
|
|
145
|
-
|
|
146
|
-
DWObject.Viewer.last();
|
|
147
|
-
updatePageInfo();
|
|
148
|
-
|
|
149
|
-
DWObject.Viewer.on("topPageChanged", topPageChanged);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function setlPreviewMode() {
|
|
153
|
-
if (DWObject) {
|
|
154
|
-
var o = parseInt(document.getElementById("DW_PreviewMode").selectedIndex + 1);
|
|
155
|
-
DWObject.Viewer.off("topPageChanged", topPageChanged);
|
|
156
|
-
DWObject.Viewer.setViewMode(o, o);
|
|
157
|
-
if (document.getElementById("DW_PreviewMode").selectedIndex != 0) {
|
|
158
|
-
DWObject.Viewer.cursor = "pointer";
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
DWObject.Viewer.cursor = "crosshair";
|
|
162
|
-
}
|
|
163
|
-
DWObject.Viewer.on("topPageChanged", topPageChanged);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function btnRemoveSelectedImages_onclick() {
|
|
168
|
-
if (DWObject) {
|
|
169
|
-
DWObject.RemoveAllSelectedImages();
|
|
170
|
-
if (DWObject.HowManyImagesInBuffer == 0) {
|
|
171
|
-
document.getElementById("DW_CurrentImage").value = "0";
|
|
172
|
-
document.getElementById("DW_TotalImage").value = "0";
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
updatePageInfo();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function btnRemoveAllImages_onclick() {
|
|
181
|
-
if (DWObject) {
|
|
182
|
-
DWObject.RemoveAllImages();
|
|
183
|
-
document.getElementById("DW_TotalImage").value = "0";
|
|
184
|
-
document.getElementById("DW_CurrentImage").value = "0";
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function updatePageInfo() {
|
|
189
|
-
if (DWObject) {
|
|
190
|
-
document.getElementById("DW_TotalImage").value = DWObject.HowManyImagesInBuffer;
|
|
191
|
-
document.getElementById("DW_CurrentImage").value = DWObject.CurrentImageIndexInBuffer + 1;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
</script>
|
|
195
|
-
</body>
|
|
196
|
-
|
|
197
|
-
</html>
|
|
@@ -1,88 +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
|
-
<input type="button" style="font-size: x-large;" id="saveButton" value="Save PDFs" onclick="SaveWithFileDialog();" />
|
|
13
|
-
<br />
|
|
14
|
-
<br />
|
|
15
|
-
<div id="dwtcontrolContainer"></div>
|
|
16
|
-
<script type="text/javascript">
|
|
17
|
-
Dynamsoft.DWT.ResourcesPath = "../dist";
|
|
18
|
-
Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
|
|
19
|
-
Dynamsoft.DWT.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);
|
|
20
|
-
window.onload = function () {
|
|
21
|
-
if (Dynamsoft.Lib.env.bMobile) {
|
|
22
|
-
document.getElementById('acquireButton').style.display = "none";
|
|
23
|
-
}
|
|
24
|
-
Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:600, Height:800}];
|
|
25
|
-
Dynamsoft.DWT.Load();
|
|
26
|
-
};
|
|
27
|
-
var DWObject;
|
|
28
|
-
|
|
29
|
-
function Dynamsoft_OnReady() {
|
|
30
|
-
DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function AcquireImage() {
|
|
34
|
-
if (DWObject) {
|
|
35
|
-
DWObject.SelectSource(function () {
|
|
36
|
-
DWObject.OpenSource();
|
|
37
|
-
DWObject.AcquireImage(
|
|
38
|
-
{
|
|
39
|
-
IfShowUI: false,
|
|
40
|
-
PixelType: Dynamsoft.DWT.EnumDWT_PixelType.TWPT_RGB,
|
|
41
|
-
Resolution: 200,
|
|
42
|
-
IfDisableSourceAfterAcquire: true
|
|
43
|
-
},
|
|
44
|
-
function () {
|
|
45
|
-
console.log("Successful!");
|
|
46
|
-
},
|
|
47
|
-
function (settings, errCode, errString) {
|
|
48
|
-
alert(errString)
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
}, function () {
|
|
52
|
-
alert('SelectSource failed!');
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function LoadImages() {
|
|
58
|
-
if (DWObject) {
|
|
59
|
-
if (DWObject.Addon && DWObject.Addon.PDF) {
|
|
60
|
-
DWObject.Addon.PDF.SetResolution(300);
|
|
61
|
-
DWObject.Addon.PDF.SetConvertMode(Dynamsoft.DWT.EnumDWT_ConvertMode.CM_RENDERALL);
|
|
62
|
-
}
|
|
63
|
-
DWObject.LoadImageEx('', 4,
|
|
64
|
-
function () { },
|
|
65
|
-
function (errorCode, errorString) {
|
|
66
|
-
alert('Load Image:' + errorString);
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function SaveWithFileDialog() {
|
|
73
|
-
if (DWObject) {
|
|
74
|
-
if (DWObject.HowManyImagesInBuffer > 0) {
|
|
75
|
-
DWObject.IfShowFileDialog = true;
|
|
76
|
-
DWObject.SaveAllAsPDF("DynamicWebTWAIN.pdf",
|
|
77
|
-
function () { },
|
|
78
|
-
function (errorCode, errorString) {
|
|
79
|
-
alert('Save as PDF:' + errorString);
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
</script>
|
|
86
|
-
</body>
|
|
87
|
-
|
|
88
|
-
</html>
|
package/samples/ReadBarcode.html
DELETED
|
@@ -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.DWT.ResourcesPath = "../dist";
|
|
25
|
-
Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
|
|
26
|
-
Dynamsoft.DWT.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.DWT.Containers = [{ ContainerId: 'dwtcontrolContainer', Width: 600, Height: 800 }];
|
|
33
|
-
Dynamsoft.DWT.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.DWT.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.DWT.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(Dynamsoft.DWT.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(Dynamsoft.DWT.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>
|