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
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Acquire Images</title>
|
|
6
|
-
<script src="../dist/dynamsoft.webtwain.min.js"></script>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body style="padding: 30px;">
|
|
10
|
-
<div id="notMobile">
|
|
11
|
-
<h1>Acquire Images</h1>
|
|
12
|
-
<label style="font-size: x-large;" id="H5CameraLabel"><input type="checkbox" id="H5Camera" />Use H5
|
|
13
|
-
Camera</label>
|
|
14
|
-
<select style="font-size: x-large;" id="source"></select><br />
|
|
15
|
-
<input type="button" id="btn-switch" style="font-size: x-large;" value="Hide Video" onclick="SwitchViews();" />
|
|
16
|
-
<input type="button" id="btn-grab" style="font-size: x-large;" value="Acquire" onclick="CaptureImage();" />
|
|
17
|
-
<br />
|
|
18
|
-
<br />
|
|
19
|
-
<div id="dwtcontrolContainer"></div>
|
|
20
|
-
</div>
|
|
21
|
-
<script type="text/javascript">
|
|
22
|
-
Dynamsoft.WebTwainEnv.ResourcesPath = "../dist";
|
|
23
|
-
Dynamsoft.WebTwainEnv.ProductKey = 't00911wAAADwPAaIxHA38XfQgvv+o7wY1qFx4aAL6m5W9nK9ulevyXbe4DIRCPw4FUKWxOQpvvGnefCmnCtBu/1TALNmgEBeWrEAOcP/Asw44TCBWNwip6r+8VPorfA==';
|
|
24
|
-
Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);
|
|
25
|
-
Dynamsoft.WebTwainEnv.Containers = [{ ContainerId: 'dwtcontrolContainer', Width: 600, Height: 800 }];
|
|
26
|
-
var bWASMCamera = true, bWASM = false;
|
|
27
|
-
window.onload = function () {
|
|
28
|
-
if (Dynamsoft.Lib.env.bMobile || Dynamsoft.WebTwainEnv.UseLocalService === false) {
|
|
29
|
-
Dynamsoft.WebTwainEnv.UseLocalService = false;
|
|
30
|
-
document.getElementById("H5CameraLabel").style.display = "none";
|
|
31
|
-
bWASM = true;
|
|
32
|
-
}
|
|
33
|
-
document.getElementById("H5Camera").onchange = function () {
|
|
34
|
-
sourceChanged(true);
|
|
35
|
-
bWASMCamera = document.getElementById("H5Camera").checked;
|
|
36
|
-
updateSources();
|
|
37
|
-
};
|
|
38
|
-
document.getElementById('source').onchange = function () {
|
|
39
|
-
sourceChanged();
|
|
40
|
-
}
|
|
41
|
-
if (Dynamsoft && Dynamsoft.Lib.env.bWin && Dynamsoft.WebTwainEnv.UseLocalService && !document.getElementById("H5Camera").checked) {
|
|
42
|
-
bWASMCamera = false;
|
|
43
|
-
}
|
|
44
|
-
Dynamsoft.WebTwainEnv.Load();
|
|
45
|
-
};
|
|
46
|
-
var DWObject;
|
|
47
|
-
var webCamStartingIndex;
|
|
48
|
-
var isVideoOn = true;
|
|
49
|
-
var devices = [];
|
|
50
|
-
|
|
51
|
-
function Dynamsoft_OnReady() {
|
|
52
|
-
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
|
53
|
-
updateSources();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function sourceChanged(closeCamera) {
|
|
57
|
-
if (closeCamera || document.getElementById('source').selectedIndex < webCamStartingIndex) {
|
|
58
|
-
if (bWASMCamera)
|
|
59
|
-
DWObject.Addon.Camera.stop();
|
|
60
|
-
else
|
|
61
|
-
DWObject.Addon.Webcam.StopVideo();
|
|
62
|
-
isVideoOn = false;
|
|
63
|
-
document.getElementById("btn-grab").style.backgroundColor = "";
|
|
64
|
-
document.getElementById('btn-grab').value = 'Acquire From a Scanner';
|
|
65
|
-
document.getElementById("btn-switch").style.display = 'none';
|
|
66
|
-
} else {
|
|
67
|
-
if (bWASMCamera)
|
|
68
|
-
DWObject.Addon.Camera.selectSource(devices[document
|
|
69
|
-
.getElementById("source").selectedIndex].deviceId);
|
|
70
|
-
else
|
|
71
|
-
DWObject.Addon.Webcam.SelectSource(devices[document
|
|
72
|
-
.getElementById("source").selectedIndex].label);
|
|
73
|
-
SetIfWebcamPlayVideo(true);
|
|
74
|
-
document.getElementById('btn-grab').value = 'Acquire From a Camera';
|
|
75
|
-
document.getElementById("btn-switch").style.display = '';
|
|
76
|
-
}
|
|
77
|
-
document.getElementById("btn-grab").disabled = "";
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function showSources() {
|
|
81
|
-
var sourceElement = document.getElementById("source");
|
|
82
|
-
var i, L = sourceElement.options.length - 1;
|
|
83
|
-
for (i = L; i >= 0; i--) {
|
|
84
|
-
sourceElement.remove(i);
|
|
85
|
-
}
|
|
86
|
-
for (var i = 0; i < devices.length; i++)
|
|
87
|
-
sourceElement.options.add(new Option(devices[i].label), i);
|
|
88
|
-
sourceChanged();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function updateSources() {
|
|
92
|
-
devices = [];
|
|
93
|
-
if (DWObject) {
|
|
94
|
-
if (bWASM) {
|
|
95
|
-
webCamStartingIndex = 0;
|
|
96
|
-
DWObject.Addon.Camera.getSourceList().then(function (list) {
|
|
97
|
-
devices = list;
|
|
98
|
-
showSources();
|
|
99
|
-
});
|
|
100
|
-
} else {
|
|
101
|
-
var i = 0, scanners = DWObject.GetSourceNames();
|
|
102
|
-
for (i = 0; i < scanners.length; i++) {
|
|
103
|
-
devices.push({
|
|
104
|
-
deviceId: i,
|
|
105
|
-
label: scanners[i]
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
webCamStartingIndex = i;
|
|
109
|
-
if (bWASMCamera) {
|
|
110
|
-
DWObject.Addon.Camera.getSourceList().then(function (list) {
|
|
111
|
-
devices = devices.concat(list);
|
|
112
|
-
showSources();
|
|
113
|
-
});
|
|
114
|
-
} else {
|
|
115
|
-
var cameras = DWObject.Addon.Webcam.GetSourceList();
|
|
116
|
-
for (i = 0; i < cameras.length; i++) {
|
|
117
|
-
devices.push({
|
|
118
|
-
deviceId: webCamStartingIndex + i,
|
|
119
|
-
label: cameras[i]
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
showSources();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function SetIfWebcamPlayVideo(bShow) {
|
|
129
|
-
if (bShow) {
|
|
130
|
-
if (!bWASMCamera)
|
|
131
|
-
DWObject.Addon.Webcam.StopVideo();
|
|
132
|
-
setTimeout(function () {
|
|
133
|
-
if (bWASMCamera)
|
|
134
|
-
DWObject.Addon.Camera.play();
|
|
135
|
-
else
|
|
136
|
-
DWObject.Addon.Webcam.PlayVideo(DWObject, 80, function () { });
|
|
137
|
-
isVideoOn = true;
|
|
138
|
-
document.getElementById("btn-grab").style.backgroundColor = "";
|
|
139
|
-
document.getElementById("btn-grab").disabled = "";
|
|
140
|
-
document.getElementById("btn-switch").value = "Hide Video";
|
|
141
|
-
}, 30);
|
|
142
|
-
} else {
|
|
143
|
-
if (bWASMCamera)
|
|
144
|
-
DWObject.Addon.Camera.stop();
|
|
145
|
-
else
|
|
146
|
-
DWObject.Addon.Webcam.StopVideo();
|
|
147
|
-
isVideoOn = false;
|
|
148
|
-
document.getElementById("btn-grab").style.backgroundColor = "#aaa";
|
|
149
|
-
document.getElementById("btn-grab").disabled = "disabled";
|
|
150
|
-
document.getElementById("btn-switch").value = "Show Video";
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function SwitchViews() {
|
|
155
|
-
if (isVideoOn == false) {
|
|
156
|
-
// continue the video
|
|
157
|
-
SetIfWebcamPlayVideo(true);
|
|
158
|
-
} else {
|
|
159
|
-
// stop the video
|
|
160
|
-
SetIfWebcamPlayVideo(false);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function CaptureImage() {
|
|
165
|
-
if (DWObject) {
|
|
166
|
-
if (document.getElementById('source').selectedIndex < webCamStartingIndex) {
|
|
167
|
-
DWObject.IfShowUI = true;
|
|
168
|
-
DWObject.IfDisableSourceAfterAcquire = true;
|
|
169
|
-
DWObject.SelectSourceByIndex(document.getElementById('source').selectedIndex);
|
|
170
|
-
DWObject.CloseSource();
|
|
171
|
-
DWObject.OpenSource();
|
|
172
|
-
DWObject.AcquireImage();
|
|
173
|
-
} else {
|
|
174
|
-
var funCaptureImage = function () {
|
|
175
|
-
setTimeout(function () {
|
|
176
|
-
SetIfWebcamPlayVideo(false);
|
|
177
|
-
}, 50);
|
|
178
|
-
};
|
|
179
|
-
if (bWASMCamera)
|
|
180
|
-
DWObject.Addon.Camera.capture().then(function (blob) { DWObject.Viewer.render(); funCaptureImage(); });
|
|
181
|
-
else
|
|
182
|
-
DWObject.Addon.Webcam.CaptureImage(funCaptureImage, funCaptureImage);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
</script>
|
|
187
|
-
</body>
|
|
188
|
-
|
|
189
|
-
</html>
|