dwt 17.3.1 → 18.1.0
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 +25 -32
- 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 +159 -97
- package/dist/dynamsoft.webtwain.min.mjs +254 -192
- package/dist/src/dynamsoft.lts.js +19 -41
- package/dist/src/dynamsoft.viewer.css +1 -1
- package/dist/src/dynamsoft.viewer.js +1 -1
- package/dist/src/dynamsoft.webtwain.css +43 -21
- package/dist/types/Dynamsoft.Enum.d.ts +14 -0
- package/dist/types/Dynamsoft.d.ts +85 -6
- package/dist/types/WebTwain.Acquire.d.ts +37 -3
- package/dist/types/WebTwain.Viewer.d.ts +21 -31
- package/dist/types/WebTwain.d.ts +0 -2
- 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.full.wasm.js +0 -285
- package/dist/addon/dbrjs/dbr-8.8.7.worker.js +0 -113
- package/dist/addon/dbrjs/dbr.js +0 -22
- package/dist/addon/dynamsoft.webtwain.addon.camera.css +0 -7
- package/dist/dist/DynamsoftServiceSetup-mips64el.deb +0 -0
- package/dist/src/dynamsoft.crypto-1.7.3.wasm +0 -0
- package/dist/src/dynamsoft.imageProc-1.7.3.wasm +0 -0
- package/dist/src/dynamsoft.imageProc-sn-1.7.3.wasm +0 -0
- package/dist/src/dynamsoft.imagecore-1.7.3.wasm +0 -0
- package/dist/src/dynamsoft.imageio-1.7.3.wasm +0 -0
- package/dist/src/dynamsoft.imageio_wasm-1.7.3.js +0 -34
- package/dist/src/dynamsoft.pdfReader-1.7.3.wasm +0 -0
- package/dist/src/dynamsoft.pdfReader_wasm-1.7.3.js +0 -34
- package/dist/src/dynamsoft.pdfWriter-1.7.3.wasm +0 -0
- package/dist/src/fastcomp/dynamsoft.crypto-1.7.3.wasm +0 -0
- package/dist/src/fastcomp/dynamsoft.imageProc-1.7.3.wasm +0 -0
- package/dist/src/fastcomp/dynamsoft.imagecore-1.7.3.wasm +0 -0
- package/dist/src/fastcomp/dynamsoft.imageio-1.7.3.wasm +0 -0
- package/dist/src/fastcomp/dynamsoft.imageio_wasm-1.7.3.js +0 -34
- package/dist/src/fastcomp/dynamsoft.pdfWriter-1.7.3.wasm +0 -0
- package/dist/types/Addon.Camera.d.ts +0 -283
- 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
|
Binary file
|
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import { DynamsoftEnumsDWT } from "./Dynamsoft.Enum";
|
|
2
|
-
export interface Camera {
|
|
3
|
-
/**
|
|
4
|
-
* Hide the camera interface.
|
|
5
|
-
*/
|
|
6
|
-
hide(): void;
|
|
7
|
-
/**
|
|
8
|
-
* Show the camera interface.
|
|
9
|
-
*/
|
|
10
|
-
show(): void;
|
|
11
|
-
/**
|
|
12
|
-
* Return a list of all available cameras.
|
|
13
|
-
*/
|
|
14
|
-
getSourceList(): Promise<DeviceInfo[]>;
|
|
15
|
-
/**
|
|
16
|
-
* Select a camera to use.
|
|
17
|
-
* @param deviceId Specify the camera with its deviceId.
|
|
18
|
-
*/
|
|
19
|
-
selectSource(deviceId: string): Promise<DeviceInfo>;
|
|
20
|
-
/**
|
|
21
|
-
* Return the info about the current camera.
|
|
22
|
-
*/
|
|
23
|
-
getCurrentSource(): DeviceInfo;
|
|
24
|
-
/**
|
|
25
|
-
* Close the current camera.
|
|
26
|
-
*/
|
|
27
|
-
closeSource(): Promise<DeviceInfo>;
|
|
28
|
-
/**
|
|
29
|
-
* Return the resolutions supported by the current camera.
|
|
30
|
-
*/
|
|
31
|
-
getResolution(): Promise<Resolution[]>;
|
|
32
|
-
/**
|
|
33
|
-
* Set the resolution for the current camera.
|
|
34
|
-
* @param resolution Specify the resolution.
|
|
35
|
-
*/
|
|
36
|
-
setResolution(resolution: Resolution): Promise<Resolution>;
|
|
37
|
-
/**
|
|
38
|
-
* Return the resolution of the current camera.
|
|
39
|
-
*/
|
|
40
|
-
getCurrentResolution(): Promise<Resolution>;
|
|
41
|
-
/**
|
|
42
|
-
* Start streaming video from the current camera.
|
|
43
|
-
* @param element Specify an HTML element to put the video stream in.
|
|
44
|
-
* @param resolution Specify the initial resolution.
|
|
45
|
-
*/
|
|
46
|
-
play(element?: HTMLElement,
|
|
47
|
-
resolution?: Resolution,
|
|
48
|
-
fill?: boolean
|
|
49
|
-
): Promise<Resolution>;
|
|
50
|
-
/**
|
|
51
|
-
* Pause the video stream.
|
|
52
|
-
*/
|
|
53
|
-
pause(): void;
|
|
54
|
-
/**
|
|
55
|
-
* Resume the video stream.
|
|
56
|
-
*/
|
|
57
|
-
resume(): void;
|
|
58
|
-
/**
|
|
59
|
-
* Stop the video stream.
|
|
60
|
-
*/
|
|
61
|
-
stop(): void;
|
|
62
|
-
/**
|
|
63
|
-
* Return the status of the current camera.
|
|
64
|
-
*/
|
|
65
|
-
getStatus(): string;
|
|
66
|
-
/**
|
|
67
|
-
* Capture a frame from the video stream.
|
|
68
|
-
*/
|
|
69
|
-
capture(): Promise<Blob>;
|
|
70
|
-
/**
|
|
71
|
-
* Start streaming video from the current camera in the viewer.
|
|
72
|
-
* @param deviceId Specify a camera.
|
|
73
|
-
* @param resolution Specify the initial resolution.
|
|
74
|
-
* @param mode Specify the mode. Allowed values are 'picture' and 'document'. Setting to 'document' mode will enable border detection.
|
|
75
|
-
* @param fill Whether to leave blank margins when showing
|
|
76
|
-
*/
|
|
77
|
-
showVideo(deviceId?: string,
|
|
78
|
-
resolution?: Resolution,
|
|
79
|
-
mode?: string,
|
|
80
|
-
fill?: boolean
|
|
81
|
-
): Promise<Resolution>;
|
|
82
|
-
/**
|
|
83
|
-
* Start streaming video from the current camera in the viewer.
|
|
84
|
-
* @param documentConfiguration The documentConfiguration settings. If not set, the default setting is used.
|
|
85
|
-
*/
|
|
86
|
-
scanDocument(documentConfiguration?: DocumentConfiguration): Promise<Resolution>;
|
|
87
|
-
/**
|
|
88
|
-
* Close the camera and hide the video streaming UI.
|
|
89
|
-
*/
|
|
90
|
-
closeVideo(): void;
|
|
91
|
-
/**
|
|
92
|
-
* Specify an event listener for the specified built-in viewer event.
|
|
93
|
-
* @param eventName Specify the event name.
|
|
94
|
-
* @param callback The event listener.
|
|
95
|
-
*/
|
|
96
|
-
on(eventName: string, callback: (...param: any[]) => void): void;
|
|
97
|
-
/**
|
|
98
|
-
* Remove a built-in viewer event handler.
|
|
99
|
-
* @param eventName Specify the event name.
|
|
100
|
-
*/
|
|
101
|
-
off(eventName: string, callback?: (...param: any[]) => void): void;
|
|
102
|
-
}
|
|
103
|
-
export interface DeviceInfo {
|
|
104
|
-
deviceId: string;
|
|
105
|
-
label: string;
|
|
106
|
-
}
|
|
107
|
-
export interface Resolution {
|
|
108
|
-
width: number;
|
|
109
|
-
height: number;
|
|
110
|
-
}
|
|
111
|
-
export interface ViewerEvent {
|
|
112
|
-
/**
|
|
113
|
-
* The index of the current image.
|
|
114
|
-
*/
|
|
115
|
-
index: number;
|
|
116
|
-
/**
|
|
117
|
-
* The x-coordinate of the upper-left corner of the image.
|
|
118
|
-
*/
|
|
119
|
-
imageX: number;
|
|
120
|
-
/**
|
|
121
|
-
* The y-coordinate of the upper-left corner of the image.
|
|
122
|
-
*/
|
|
123
|
-
imageY: number;
|
|
124
|
-
/**
|
|
125
|
-
* The x-coordinate relative to the browser page.
|
|
126
|
-
*/
|
|
127
|
-
pageX: number;
|
|
128
|
-
/**
|
|
129
|
-
* The y-coordinate relative to the browser page.
|
|
130
|
-
*/
|
|
131
|
-
pageY: number;
|
|
132
|
-
}
|
|
133
|
-
export interface DocumentConfiguration {
|
|
134
|
-
scannerViewer?: ScannerViewer;
|
|
135
|
-
documentEditorSettings?: DocumentEditorSettings;
|
|
136
|
-
}
|
|
137
|
-
export interface ScannerViewer {
|
|
138
|
-
deviceId?: string; //camera id
|
|
139
|
-
maxDocuments?:number; //The maximum documents can be captured/loaded in to the buffer.
|
|
140
|
-
enableBorderDetection?: boolean; //Whether to enable border detection. The default value is true.
|
|
141
|
-
fullScreen?: boolean; //Whether to display the video in full screen. The default value is false.
|
|
142
|
-
polygonStyle?:{ //The sytle of the auto detect border.
|
|
143
|
-
stroke?: string; //default: "#fe8e14". Only supports #16 hexadecimal.
|
|
144
|
-
strokeWidth?: string; //default: "2px"
|
|
145
|
-
dash?: string; //The allowed value are "solid" and "dashed", the default value is "solid".
|
|
146
|
-
};
|
|
147
|
-
element?: HTMLDivElement | string; //Bind the elment or elment id.
|
|
148
|
-
//After binding, display the video in the spcified element, otherwise, display the video in full screen.
|
|
149
|
-
headerStyle?:{
|
|
150
|
-
background?: string; //background color of the head, default : "#000000". Only supports #16 hexadecimal.
|
|
151
|
-
color?: string; //The color of the icons, default : "#ffffff". Only supports #16 hexadecimal.
|
|
152
|
-
selectedColor?: string; //The color of the selected icon, default : "#fe8e14". Only supports #16 hexadecimal.
|
|
153
|
-
};
|
|
154
|
-
bodyStyle?:{
|
|
155
|
-
background?: string; //Background color when the video streaming is not full-screen, default : "#ffffff". Only supports #16 hexadecimal.
|
|
156
|
-
loaderBarSource?: string; //Waiting for the document to appear
|
|
157
|
-
};
|
|
158
|
-
footerStyle?:{
|
|
159
|
-
background?: string; //background color of the foot, default : "#000000". Only supports #16 hexadecimal.
|
|
160
|
-
color?: string; //The color of the icons, default : "#ffffff". Only supports #16 hexadecimal.
|
|
161
|
-
selectedColor?: string; //The color of the selected icon, default : "#fe8e14". Only supports #16 hexadecimal.
|
|
162
|
-
};
|
|
163
|
-
scanButtonStyle?:{
|
|
164
|
-
background?: string; //background color, default : "#fe8e14". Only supports #16 hexadecimal.
|
|
165
|
-
color?: string; //icon color, default : "#ffffff". Only supports #16 hexadecimal.
|
|
166
|
-
};
|
|
167
|
-
resolution?: {
|
|
168
|
-
visibility?: string; //Whether to display the resolution icon in the upper left corner, the value "visible":"hidden". The default value is "visible".
|
|
169
|
-
valueList?: any;
|
|
170
|
-
defaultValue?: Resolution; //Set the default value according to the value set in the valueList.
|
|
171
|
-
};
|
|
172
|
-
autoScan?: { //Automatically capture when a clear document is detected. Only applicable to video scanning.
|
|
173
|
-
visibility?:string; //Whether to display the automatic scan icon. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
174
|
-
enableAutoScan?: boolean; //Whether to enable automatic scan. The default value is false.
|
|
175
|
-
};
|
|
176
|
-
autoDetect?: { //Only applicable to video scanning.
|
|
177
|
-
visibility?:string; //Whether to display the automatic border detection icon. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
178
|
-
enableAutoDetect?: boolean; //Whether to enable automatic border detection. The default value is false.
|
|
179
|
-
acceptedPolygonConfidence?:number; //The default value is 80. The higher the setting, the more accurate the automatic border detection.
|
|
180
|
-
fpsLimit?: number; //The maximum number of frames detected per second. The default value is 3.
|
|
181
|
-
acceptedBlurryScore?:number; //The default value is 0.
|
|
182
|
-
autoCaptureDelay?: number; //The default value is 1000ms.
|
|
183
|
-
};
|
|
184
|
-
continuousScan?: boolean; //Whether to continuou capture. The default value is true.
|
|
185
|
-
switchCamera?: { //The default camera is the rear camera.
|
|
186
|
-
visibility?:string; //Whether to display the switch camera icon. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
loadLocalFile?: {
|
|
190
|
-
visibility?:string; //Whether to display the load local file icon. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
funcConfirmExit?: (bExistImage: boolean) => Promise<boolean>;
|
|
194
|
-
//funcConfirmExit is the callback funtion,
|
|
195
|
-
//Return Promise.resolve(true): End this capture without saving the image data. Return Promise.resolve(false): Stay on the original viewer
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export interface DocumentEditorSettings {
|
|
199
|
-
visibility?:string; //Whether to display the documentEditor. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
200
|
-
element?: HTMLDivElement | string; //Bind the elment or elment id.
|
|
201
|
-
//After binding, display the video in the spcified element, otherwise, display the video in full screen.
|
|
202
|
-
defaultViewerName?:string; // default viewer. The allowed value are "cropViewer" and "mainViewer".
|
|
203
|
-
headerStyle?:{
|
|
204
|
-
background?: string; //background color of the head, default: "#000000". Only supports #16 hexadecimal.
|
|
205
|
-
color?: string; //The color of the icons, default : "#ffffff". Only supports #16 hexadecimal.
|
|
206
|
-
selectedColor?: string; //Selected icon color, default : "#fe8e14". Only supports #16 hexadecimal.
|
|
207
|
-
disabledColor?: string; //disabled color. default: "#808080"
|
|
208
|
-
};
|
|
209
|
-
bodyStyle?:{
|
|
210
|
-
background?: string; //Background color when the video streaming is not full-screen, default : "#ffffff". Only supports #16 hexadecimal.
|
|
211
|
-
loaderBarSource?: string; //Waiting for the document to appear
|
|
212
|
-
};
|
|
213
|
-
footerStyle?:{
|
|
214
|
-
background?: string; //background color of the foot, default : "#000000". Only supports #16 hexadecimal.
|
|
215
|
-
color?: string; //The color of the icons, default : "#ffffff". Only supports #16 hexadecimal.
|
|
216
|
-
selectedColor?: string; //Selected icon color, default: "#fe8e14". Only supports #16 hexadecimal.
|
|
217
|
-
};
|
|
218
|
-
insert?: { //Insert an image
|
|
219
|
-
visibility?:string; //Whether to display the insert icon. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
220
|
-
position?: string; //Set whether to insert the image "before" or "after" the current image. The default value is "before".
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
remove?: { //Remove an image
|
|
224
|
-
visibility?:string; //Whether to display the remove icon.The allowed value are "visible" and "hidden". The default value is "visible".
|
|
225
|
-
funcConfirmRemove?: () => Promise<boolean>;
|
|
226
|
-
//funcConfirmRemove is the callback funtion,
|
|
227
|
-
//Return Promise.resolve(true): delete the image data. Return Promise.resolve(false): Stay on the original viewer
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
rotateLeft?: {
|
|
231
|
-
visibility?:string; //Whether to display the rotate left icon. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
filter?: {
|
|
235
|
-
visibility?:string; //Whether to display the filter icon. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
236
|
-
valueList?:any;
|
|
237
|
-
defaultValue?: string; //Filter selected by default. By default, the original filter is selected.
|
|
238
|
-
applyToAll?: { //Apply to all documents
|
|
239
|
-
visibility?:string; //Whether to display the applyToAll icon. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
240
|
-
enableApplyToAll?: boolean; //Whether to enable to apply to all documents, Default:false.
|
|
241
|
-
label?: string; //the label of the applyToAll, default: "Apply to all"
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
crop?:{
|
|
246
|
-
visibility?:string; //Whether to display the crop icon. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
cropViewer?:CropViewer;
|
|
250
|
-
funcConfirmExit?: (bChanged: boolean, previousViewerName: string) => Promise<Number | DynamsoftEnumsDWT.EnumDWT_ConfirmExitType>;
|
|
251
|
-
//funcConfirmExit is the callback funtion.
|
|
252
|
-
//Return Promise.resolve(EnumDWT_ConfirmExitType.Exit): Exit original viewer without saving the image data.
|
|
253
|
-
//Return Promise.resolve(EnumDWT_ConfirmExitType.SaveAndExit): Exit original viewer with saving the image data.
|
|
254
|
-
//Return Promise.resolve(EnumDWT_ConfirmExitType.Cancel): Stay on the original viewer
|
|
255
|
-
funcConfirmExitAfterSave?: (firedByDocumentEdit: boolean) => void;
|
|
256
|
-
//funcConfirmExitAfterSave is the callback funtion
|
|
257
|
-
}
|
|
258
|
-
export interface CropViewer {
|
|
259
|
-
visibility?: boolean; //Whether to display the crop viewer. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
260
|
-
|
|
261
|
-
polygonStyle?:{ //The polygon style in the crop viewer.
|
|
262
|
-
stroke?: string; //default : "#fe8e14". Only supports #16 hexadecimal.
|
|
263
|
-
strokeWidth?: string; //default: "2px"
|
|
264
|
-
dash?: string; //The allowed value are "solid" and "dashed", the default value is "solid".
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
rotateLeft?:{
|
|
268
|
-
visibility?: string; //Whether to display the rotate left icon. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
269
|
-
};
|
|
270
|
-
rotateRight?:{
|
|
271
|
-
visibility?: string; //Whether to display the rotate right icon. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
272
|
-
};
|
|
273
|
-
autoDetectBorder?:{
|
|
274
|
-
visibility?: string; //Whether to display the automatic border detection icon. The allowed value are "visible" and "hidden". The default value is "visible".
|
|
275
|
-
};
|
|
276
|
-
funcConfirmExit?: (bChanged: boolean, previousViewerName: string) => Promise<Number | DynamsoftEnumsDWT.EnumDWT_ConfirmExitType>;
|
|
277
|
-
//funcConfirmExit is the callback funtion.
|
|
278
|
-
//Return Promise.resolve(EnumDWT_ConfirmExitType.Exit): Exit original viewer without saving the image data.
|
|
279
|
-
//Return Promise.resolve(EnumDWT_ConfirmExitType.SaveAndExit): Exit original viewer with saving the image data.
|
|
280
|
-
//Return Promise.resolve(EnumDWT_ConfirmExitType.Cancel): Stay on the original viewer
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
@@ -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.DWT.ResourcesPath = "../dist";
|
|
21
|
-
Dynamsoft.DWT.ProductKey = 't0078lQAAADsWdgZ/Z0qrJiqNFJSa7Zt76cmJoySg1pTGy1MRCv+r2hmNXQU2fUbBLjks3m21iplEev11L/GEIe4amriEVsGoRPqTcgHqMB8/';
|
|
22
|
-
Dynamsoft.DWT.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.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:600, Height:800}];
|
|
30
|
-
Dynamsoft.DWT.Load();
|
|
31
|
-
};
|
|
32
|
-
var DWObject;
|
|
33
|
-
|
|
34
|
-
function Dynamsoft_OnReady() {
|
|
35
|
-
DWObject = Dynamsoft.DWT.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.DWT.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>
|
package/samples/CustomScan.html
DELETED
|
@@ -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.DWT.ResourcesPath = "../dist";
|
|
41
|
-
Dynamsoft.DWT.ProductKey = 't0078lQAAADsWdgZ/Z0qrJiqNFJSa7Zt76cmJoySg1pTGy1MRCv+r2hmNXQU2fUbBLjks3m21iplEev11L/GEIe4amriEVsGoRPqTcgHqMB8/';
|
|
42
|
-
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
|
|
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.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:600, Height:800}];
|
|
49
|
-
Dynamsoft.DWT.Load();
|
|
50
|
-
};
|
|
51
|
-
var DWObject;
|
|
52
|
-
|
|
53
|
-
function Dynamsoft_OnReady() {
|
|
54
|
-
DWObject = Dynamsoft.DWT.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>
|
package/samples/Edit.html
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Use Dynamic Web TWAIN's Editing features</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();" />
|
|
11
|
-
<input type="button" style="font-size: x-large;" value="Load" onclick="LoadImage();" />
|
|
12
|
-
<input type="button" style="font-size: x-large;" value="Rotate Left" onclick="RotateLeft();" />
|
|
13
|
-
<input type="button" style="font-size: x-large;" value="Rotate Right" onclick="RotateRight();" />
|
|
14
|
-
<input type="button" style="font-size: x-large;" value="Mirror" onclick="Mirror();" />
|
|
15
|
-
<input type="button" style="font-size: x-large;" value="Flip" onclick="Flip();" />
|
|
16
|
-
<input type="button" style="font-size: x-large;" value="Show Image Editor" onclick="ShowImageEditor();" />
|
|
17
|
-
<br />
|
|
18
|
-
<br />
|
|
19
|
-
<!-- dwtcontrolContainer is the default div id for Dynamic Web TWAIN control.
|
|
20
|
-
If you need to rename the id, you should also change the id in the dynamsoft.webtwain.config.js accordingly. -->
|
|
21
|
-
<div id="dwtcontrolContainer"></div>
|
|
22
|
-
|
|
23
|
-
<script type="text/javascript">
|
|
24
|
-
Dynamsoft.DWT.ResourcesPath = "../dist";
|
|
25
|
-
Dynamsoft.DWT.ProductKey = 't0078lQAAADsWdgZ/Z0qrJiqNFJSa7Zt76cmJoySg1pTGy1MRCv+r2hmNXQU2fUbBLjks3m21iplEev11L/GEIe4amriEVsGoRPqTcgHqMB8/';
|
|
26
|
-
window.onload = function () {
|
|
27
|
-
Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:700, Height:800}];
|
|
28
|
-
Dynamsoft.DWT.Load();
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
var console = window['console'] ? window['console'] : { 'log': function () { } };
|
|
32
|
-
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
|
|
33
|
-
|
|
34
|
-
var DWObject;
|
|
35
|
-
|
|
36
|
-
function Dynamsoft_OnReady() {
|
|
37
|
-
DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function AcquireImage() {
|
|
41
|
-
if (DWObject) {
|
|
42
|
-
DWObject.SelectSource(function () {
|
|
43
|
-
var OnAcquireImageSuccess, OnAcquireImageFailure;
|
|
44
|
-
OnAcquireImageSuccess = OnAcquireImageFailure = function () {
|
|
45
|
-
DWObject.CloseSource();
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
DWObject.OpenSource();
|
|
49
|
-
DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
|
|
50
|
-
DWObject.AcquireImage(OnAcquireImageSuccess, OnAcquireImageFailure);
|
|
51
|
-
}, function () {
|
|
52
|
-
console.log('SelectSource failed!');
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
//Callback functions for async APIs
|
|
58
|
-
function OnSuccess() {
|
|
59
|
-
console.log('successful');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function OnFailure(errorCode, errorString) {
|
|
63
|
-
alert(errorString);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function LoadImage() {
|
|
67
|
-
if (DWObject) {
|
|
68
|
-
DWObject.IfShowFileDialog = true; // Open the system's file dialog to load image
|
|
69
|
-
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
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function RotateLeft() {
|
|
74
|
-
if (DWObject)
|
|
75
|
-
if (DWObject.HowManyImagesInBuffer > 0)
|
|
76
|
-
DWObject.RotateLeft(DWObject.CurrentImageIndexInBuffer);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function RotateRight() {
|
|
80
|
-
if (DWObject)
|
|
81
|
-
if (DWObject.HowManyImagesInBuffer > 0)
|
|
82
|
-
DWObject.RotateRight(DWObject.CurrentImageIndexInBuffer);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function Mirror() {
|
|
86
|
-
if (DWObject)
|
|
87
|
-
if (DWObject.HowManyImagesInBuffer > 0)
|
|
88
|
-
DWObject.Mirror(DWObject.CurrentImageIndexInBuffer);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function Flip() {
|
|
92
|
-
if (DWObject)
|
|
93
|
-
if (DWObject.HowManyImagesInBuffer > 0)
|
|
94
|
-
DWObject.Flip(DWObject.CurrentImageIndexInBuffer);
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function ShowImageEditor() {
|
|
99
|
-
if (DWObject) {
|
|
100
|
-
if (DWObject.HowManyImagesInBuffer == 0)
|
|
101
|
-
alert("There is no image in buffer.");
|
|
102
|
-
else{
|
|
103
|
-
var imageEditor = DWObject.Viewer.createImageEditor();
|
|
104
|
-
imageEditor.show();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
</script>
|
|
109
|
-
</body>
|
|
110
|
-
|
|
111
|
-
</html>
|