dwt 17.3.4 → 17.3.5
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 +6 -6
- package/dist/dist/DynamsoftServiceSetup-arm64.deb +0 -0
- package/dist/dist/DynamsoftServiceSetup-mips64el.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 +5 -5
- package/dist/dynamsoft.webtwain.min.mjs +5 -5
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- 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
|
@@ -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>
|
|
@@ -1,202 +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
|
-
<div id="divNoteDeploy" style="margin: 10px 0 10px;" >Make sure you deploy the sample to an webserver that
|
|
13
|
-
<ul>
|
|
14
|
-
<li style="margin: 5px 0 5px 20px; font-size: 12px;">Runs HTTPS</li>
|
|
15
|
-
<li style="margin-left: 20px;font-size: 12px;">Serves the *.wasm file with Content-Type: application/wasm.</li>
|
|
16
|
-
</ul>
|
|
17
|
-
</div>
|
|
18
|
-
<label style="font-size: x-large;" id="H5CameraLabel"><input type="checkbox" id="H5Camera" />Use H5
|
|
19
|
-
Camera</label>
|
|
20
|
-
<select style="font-size: x-large;" id="source"></select><br />
|
|
21
|
-
<input type="button" id="btn-switch" style="font-size: x-large;" value="Hide Video" onclick="SwitchViews();" />
|
|
22
|
-
<input type="button" id="btn-grab" style="font-size: x-large;" value="Acquire" onclick="CaptureImage();" />
|
|
23
|
-
<br />
|
|
24
|
-
<br />
|
|
25
|
-
<div id="dwtcontrolContainer"></div>
|
|
26
|
-
</div>
|
|
27
|
-
<script type="text/javascript">
|
|
28
|
-
Dynamsoft.DWT.ResourcesPath = "../dist";
|
|
29
|
-
Dynamsoft.DWT.UseCameraAddonWasm = true;
|
|
30
|
-
Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
|
|
31
|
-
Dynamsoft.DWT.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);
|
|
32
|
-
Dynamsoft.DWT.Containers = [{ ContainerId: 'dwtcontrolContainer', Width: 600, Height: 800 }];
|
|
33
|
-
var bWASMCamera = true, bWASM = false;
|
|
34
|
-
window.onload = function () {
|
|
35
|
-
if (Dynamsoft.Lib.env.bMobile || Dynamsoft.DWT.UseLocalService === false) {
|
|
36
|
-
Dynamsoft.DWT.UseLocalService = false;
|
|
37
|
-
document.getElementById("H5CameraLabel").style.display = "none";
|
|
38
|
-
bWASM = true;
|
|
39
|
-
}
|
|
40
|
-
document.getElementById("H5Camera").onchange = function () {
|
|
41
|
-
sourceChanged(true);
|
|
42
|
-
bWASMCamera = document.getElementById("H5Camera").checked;
|
|
43
|
-
updateSources();
|
|
44
|
-
};
|
|
45
|
-
document.getElementById('source').onchange = function () {
|
|
46
|
-
sourceChanged();
|
|
47
|
-
}
|
|
48
|
-
if (Dynamsoft && Dynamsoft.Lib.env.bWin && Dynamsoft.DWT.UseLocalService && !document.getElementById("H5Camera").checked) {
|
|
49
|
-
bWASMCamera = false;
|
|
50
|
-
}
|
|
51
|
-
Dynamsoft.DWT.Load();
|
|
52
|
-
};
|
|
53
|
-
var DWObject;
|
|
54
|
-
var webCamStartingIndex;
|
|
55
|
-
var isVideoOn = true;
|
|
56
|
-
var devices = [];
|
|
57
|
-
|
|
58
|
-
function Dynamsoft_OnReady() {
|
|
59
|
-
DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer');
|
|
60
|
-
updateSources();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function sourceChanged(closeCamera) {
|
|
64
|
-
if (closeCamera || document.getElementById('source').selectedIndex < webCamStartingIndex) {
|
|
65
|
-
if (bWASMCamera)
|
|
66
|
-
DWObject.Addon.Camera.stop();
|
|
67
|
-
else
|
|
68
|
-
DWObject.Addon.Webcam.StopVideo();
|
|
69
|
-
isVideoOn = false;
|
|
70
|
-
document.getElementById("btn-grab").style.backgroundColor = "";
|
|
71
|
-
document.getElementById('btn-grab').value = 'Acquire From a Scanner';
|
|
72
|
-
document.getElementById("btn-switch").style.display = 'none';
|
|
73
|
-
} else {
|
|
74
|
-
if (bWASMCamera)
|
|
75
|
-
DWObject.Addon.Camera.selectSource(devices[document
|
|
76
|
-
.getElementById("source").selectedIndex].deviceId);
|
|
77
|
-
else
|
|
78
|
-
DWObject.Addon.Webcam.SelectSource(devices[document
|
|
79
|
-
.getElementById("source").selectedIndex].label);
|
|
80
|
-
SetIfWebcamPlayVideo(true);
|
|
81
|
-
document.getElementById('btn-grab').value = 'Acquire From a Camera';
|
|
82
|
-
document.getElementById("btn-switch").style.display = '';
|
|
83
|
-
}
|
|
84
|
-
document.getElementById("btn-grab").disabled = "";
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function showSources() {
|
|
88
|
-
var sourceElement = document.getElementById("source");
|
|
89
|
-
var i, L = sourceElement.options.length - 1;
|
|
90
|
-
for (i = L; i >= 0; i--) {
|
|
91
|
-
sourceElement.remove(i);
|
|
92
|
-
}
|
|
93
|
-
for (var i = 0; i < devices.length; i++)
|
|
94
|
-
sourceElement.options.add(new Option(devices[i].label), i);
|
|
95
|
-
sourceChanged();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function updateSources() {
|
|
99
|
-
devices = [];
|
|
100
|
-
if (DWObject) {
|
|
101
|
-
if (bWASM) {
|
|
102
|
-
webCamStartingIndex = 0;
|
|
103
|
-
DWObject.Addon.Camera.getSourceList().then(function (list) {
|
|
104
|
-
devices = list;
|
|
105
|
-
showSources();
|
|
106
|
-
});
|
|
107
|
-
} else {
|
|
108
|
-
var i = 0, scanners = DWObject.GetSourceNames();
|
|
109
|
-
for (i = 0; i < scanners.length; i++) {
|
|
110
|
-
devices.push({
|
|
111
|
-
deviceId: i,
|
|
112
|
-
label: scanners[i]
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
webCamStartingIndex = i;
|
|
116
|
-
if (bWASMCamera) {
|
|
117
|
-
DWObject.Addon.Camera.getSourceList().then(function (list) {
|
|
118
|
-
devices = devices.concat(list);
|
|
119
|
-
showSources();
|
|
120
|
-
});
|
|
121
|
-
} else {
|
|
122
|
-
var cameras = DWObject.Addon.Webcam.GetSourceList();
|
|
123
|
-
for (i = 0; i < cameras.length; i++) {
|
|
124
|
-
devices.push({
|
|
125
|
-
deviceId: webCamStartingIndex + i,
|
|
126
|
-
label: cameras[i]
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
showSources();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function SetIfWebcamPlayVideo(bShow) {
|
|
136
|
-
if (bShow) {
|
|
137
|
-
if (!bWASMCamera)
|
|
138
|
-
DWObject.Addon.Webcam.StopVideo();
|
|
139
|
-
setTimeout(function () {
|
|
140
|
-
if (bWASMCamera)
|
|
141
|
-
DWObject.Addon.Camera.play();
|
|
142
|
-
else
|
|
143
|
-
DWObject.Addon.Webcam.PlayVideo(DWObject, 80, function () { });
|
|
144
|
-
isVideoOn = true;
|
|
145
|
-
document.getElementById("btn-grab").style.backgroundColor = "";
|
|
146
|
-
document.getElementById("btn-grab").disabled = "";
|
|
147
|
-
document.getElementById("btn-switch").value = "Hide Video";
|
|
148
|
-
}, 30);
|
|
149
|
-
} else {
|
|
150
|
-
if (bWASMCamera)
|
|
151
|
-
DWObject.Addon.Camera.stop();
|
|
152
|
-
else
|
|
153
|
-
DWObject.Addon.Webcam.StopVideo();
|
|
154
|
-
isVideoOn = false;
|
|
155
|
-
document.getElementById("btn-grab").style.backgroundColor = "#aaa";
|
|
156
|
-
document.getElementById("btn-grab").disabled = "disabled";
|
|
157
|
-
document.getElementById("btn-switch").value = "Show Video";
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function SwitchViews() {
|
|
162
|
-
if (isVideoOn == false) {
|
|
163
|
-
// continue the video
|
|
164
|
-
SetIfWebcamPlayVideo(true);
|
|
165
|
-
} else {
|
|
166
|
-
// stop the video
|
|
167
|
-
SetIfWebcamPlayVideo(false);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function CaptureImage() {
|
|
172
|
-
if (DWObject) {
|
|
173
|
-
if (document.getElementById('source').selectedIndex < webCamStartingIndex) {
|
|
174
|
-
DWObject.IfShowUI = true;
|
|
175
|
-
DWObject.IfDisableSourceAfterAcquire = true;
|
|
176
|
-
DWObject.SelectSourceByIndex(document.getElementById('source').selectedIndex);
|
|
177
|
-
DWObject.CloseSource();
|
|
178
|
-
DWObject.OpenSource();
|
|
179
|
-
DWObject.AcquireImage();
|
|
180
|
-
} else {
|
|
181
|
-
var funCaptureImage = function () {
|
|
182
|
-
setTimeout(function () {
|
|
183
|
-
SetIfWebcamPlayVideo(false);
|
|
184
|
-
}, 50);
|
|
185
|
-
};
|
|
186
|
-
if (bWASMCamera){
|
|
187
|
-
var p = document.location.protocol;
|
|
188
|
-
if (p == 'https:' || p == 'http:')
|
|
189
|
-
DWObject.Addon.Camera.capture().then(function (blob) { DWObject.Viewer.render(); funCaptureImage(); });
|
|
190
|
-
else {
|
|
191
|
-
alert("HTTPS is required for accessing cameras.");
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
else
|
|
195
|
-
DWObject.Addon.Webcam.CaptureImage(funCaptureImage, funCaptureImage);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
</script>
|
|
200
|
-
</body>
|
|
201
|
-
|
|
202
|
-
</html>
|
package/samples/Thumbnail.html
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Use Dynamic Web TWAIN to Scan With Thumbnails View</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;" value="Scan" onclick="AcquireImage();" class="btn bgBlue mb15 mr20" />
|
|
11
|
-
<input type="button" style="font-size: x-large;" value="Open a local file" onclick="LoadImages();" class="btn bgBlue mb15" />
|
|
12
|
-
<br />
|
|
13
|
-
<br />
|
|
14
|
-
<div style="display: block; position: absolute;" class="container">
|
|
15
|
-
<div id="dwtcontrolContainer" style="float: left; position:relative; margin-right:20px;"></div>
|
|
16
|
-
<div id="dwtcontrolContainerLargeViewer" style="float: left; position:relative;"></div>
|
|
17
|
-
</div>
|
|
18
|
-
|
|
19
|
-
<script type="text/javascript">
|
|
20
|
-
Dynamsoft.DWT.ResourcesPath = "../dist";
|
|
21
|
-
Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
|
|
22
|
-
window.onload = function () {
|
|
23
|
-
if (Dynamsoft && (!Dynamsoft.Lib.product.bChromeEdition)) {
|
|
24
|
-
var ObjString = [];
|
|
25
|
-
ObjString.push('<div class="p15">');
|
|
26
|
-
ObjString.push("Please note that the sample doesn't work on your current browser, please use a modern browser like Chrome, Firefox, etc.");
|
|
27
|
-
ObjString.push('</div>');
|
|
28
|
-
Dynamsoft.DWT.ShowDialog(400, 180, ObjString.join(''));
|
|
29
|
-
if (document.getElementsByClassName("dynamsoft-dialog-close"))
|
|
30
|
-
document.getElementsByClassName("dynamsoft-dialog-close")[0].style.display = "none";
|
|
31
|
-
} else {
|
|
32
|
-
Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:300, Height:800}];
|
|
33
|
-
Dynamsoft.DWT.Load();
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
Dynamsoft.DWT.AutoLoad = false;
|
|
38
|
-
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
|
|
39
|
-
|
|
40
|
-
var DWObject;
|
|
41
|
-
|
|
42
|
-
function Dynamsoft_OnReady() {
|
|
43
|
-
DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
|
|
44
|
-
if (DWObject) {
|
|
45
|
-
DWObject.Viewer.width = 300;
|
|
46
|
-
DWObject.Viewer.height = 800;
|
|
47
|
-
DWObject.Viewer.cursor = "default";
|
|
48
|
-
Dynamsoft.DWT.CustomizableDisplayInfo.buttons.visibility.close = false;
|
|
49
|
-
DWObject.Viewer.setViewMode(1, 4); // Set the view mode to 1 by 4
|
|
50
|
-
DWObject.ShowImageEditor("dwtcontrolContainerLargeViewer", 750, 800);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function AcquireImage() {
|
|
55
|
-
if (DWObject) {
|
|
56
|
-
DWObject.SelectSource(function () {
|
|
57
|
-
var OnAcquireImageSuccess, OnAcquireImageFailure;
|
|
58
|
-
OnAcquireImageSuccess = OnAcquireImageFailure = function () {
|
|
59
|
-
DWObject.CloseSource();
|
|
60
|
-
};
|
|
61
|
-
DWObject.OpenSource();
|
|
62
|
-
DWObject.IfDisableSourceAfterAcquire = true;
|
|
63
|
-
DWObject.AcquireImage(OnAcquireImageSuccess, OnAcquireImageFailure);
|
|
64
|
-
}, function () {
|
|
65
|
-
console.log('SelectSource failed!');
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function LoadImages() {
|
|
71
|
-
if (DWObject) {
|
|
72
|
-
if (DWObject.Addon && DWObject.Addon.PDF) {
|
|
73
|
-
DWObject.Addon.PDF.SetResolution(300);
|
|
74
|
-
DWObject.Addon.PDF.SetConvertMode(Dynamsoft.DWT.EnumDWT_ConvertMode.CM_RENDERALL);
|
|
75
|
-
}
|
|
76
|
-
DWObject.LoadImageEx('', 5,
|
|
77
|
-
function () {
|
|
78
|
-
},
|
|
79
|
-
function (errorCode, errorString) {
|
|
80
|
-
alert('Load Image:' + errorString);
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
</script>
|
|
86
|
-
</body>
|
|
87
|
-
|
|
88
|
-
</html>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>Please scan the barcode to visit the online demo</title>
|
|
5
|
-
</head>
|
|
6
|
-
<body>
|
|
7
|
-
<h2>Please scan the barcode to visit the online demo</h2>
|
|
8
|
-
<div>Click this <a href="https://demo.dynamsoft.com/web-twain/mobile-online-camera-scanner/" target="_blank" >link</a> to visit the online demo.<br/>
|
|
9
|
-
<div>Click this <a href="https://download.dynamsoft.com/Samples/DWT/SourceCode-DWT-Mobile-Camera-Scanner.zip" target="_blank" >link</a> to download the sample code.<br/>
|
|
10
|
-
Or you can scan the following barcode to visit it in your mobile devices.</div>
|
|
11
|
-
<img style="height:300px; width:300px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQQAAAEECAIAAABBat1dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAISElEQVR4nO3dy27kOBIFULsx///L1ZuLXihRlMMRpDTAObuClaIq7QsixNf3nz9/voCvr3+efgB4C2GAEAYIYYD43+Xf39/fZxq+FO6Xdj/L+sEHqza9foz13ToXNz9b+m8OPsntK5nBJ+n4fE49A4QwQAgDhDBAXAvoi8Hx6VJlWVWqetdPUi3gOgXf1uH/al37a1sr4GN/gV96BviPMEAIA4QwQNwU0Bedccp9DX1ev256tuCrjlhPqQ70rr+i5qDyz2/VtPUvUM8AIQwQwgAhDBC1AnqfrRN3B6crP9h0c0R5X6FffbDXLrvXM0AIA4QwQAgDxFsK6Oaw5bGa7NgK3du2ts6ULk16L935zfQMEMIAIQwQwgBRK6CPFUO3m4h1xlM7/4vqxOlO01t3N+vsfbZueuva661/gXoGCGGAEAYIYYC4KaCPDbg2q65OdVj6bLWy7zS9Nvtg+76x6sfXF2+lZ4AQBghhgBAGiGsB/dSE25M7OQ/Wjr+4YNF0x8lCs1Po3378wSnfegYIYYAQBghhgGjtwn1yh6zBVbklzbHw0k9Ld54tNEsP1tnzvHm3zmdvL9YzQAgDhDBACAPEtYDuHHZ08Z7do46diPx58+b88MXFzSncF52Dqjq3ql6/dfq3ngFCGCCEAUIYIIQBorYhQOfl0uyRZINvad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