dwt 18.4.2 → 18.5.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.
@@ -30,7 +30,7 @@ export interface TextResults extends Array<any> {
30
30
  [index: number]: TextResult;
31
31
  description?: string;
32
32
  exception?: number;
33
- imageid?: number;
33
+ imageid?: string;
34
34
  }
35
35
  export interface TextResult {
36
36
  /**
@@ -92,7 +92,7 @@ export interface OCR {
92
92
  Recognize(
93
93
  index: number,
94
94
  successCallback: (
95
- imageId: number,
95
+ imageId: string,
96
96
  result: OCRResult
97
97
  ) => void,
98
98
  failureCallback: (
@@ -141,7 +141,7 @@ export interface OCR {
141
141
  right: number,
142
142
  bottom: number,
143
143
  successCallback: (
144
- imageId: number,
144
+ imageId: string,
145
145
  left: number,
146
146
  top: number,
147
147
  right: number,
@@ -26,7 +26,7 @@ export interface OCRPro {
26
26
  * @param index Specify the image.
27
27
  * @param successCallback A callback function that is executed if the request succeeds.
28
28
  * @param failureCallback A callback function that is executed if the request fails.
29
- * @argument imageId The imageId of the image which can be used to find the index.
29
+ * @argument index The index of the image.
30
30
  * @argument result The OCR result.
31
31
  * @argument errorCode The error code.
32
32
  * @argument errorString The error string.
@@ -34,7 +34,7 @@ export interface OCRPro {
34
34
  Recognize(
35
35
  index: number,
36
36
  successCallback: (
37
- imageId: number,
37
+ index: number,
38
38
  result: OCRProResult
39
39
  ) => void,
40
40
  failureCallback: (
@@ -68,7 +68,7 @@ export interface OCRPro {
68
68
  * @param aryRects Specify the rectangle(s).
69
69
  * @param successCallback A callback function that is executed if the request succeeds.
70
70
  * @param failureCallback A callback function that is executed if the request fails.
71
- * @argument imageId The imageId of the image which can be used to find the index.
71
+ * @argument index The index of the image.
72
72
  * @argument result The OCR result.
73
73
  * @argument errorCode The error code.
74
74
  * @argument errorString The error string.
@@ -77,7 +77,7 @@ export interface OCRPro {
77
77
  index: number,
78
78
  aryRects: Rect[],
79
79
  successCallback: (
80
- imageId: number,
80
+ index: number,
81
81
  aryRects: Rect[],
82
82
  result: OCRProResult
83
83
  ) => void,
@@ -151,6 +151,10 @@ export interface PDFWSettings {
151
151
  */
152
152
  compressLevel?: number;
153
153
  }
154
+ /**
155
+ * When saving a PDF, you can set a password for protection.
156
+ */
157
+ password?: string;
154
158
  }
155
159
  export interface ReaderOptions {
156
160
  /**
@@ -1508,13 +1508,6 @@ export namespace DynamsoftEnumsDWT {
1508
1508
  IT_MULTIPAGE_PDF = 7,
1509
1509
  IT_MULTIPAGE_TIF = 8
1510
1510
  }
1511
- enum EnumDWT_InitMsg {
1512
- Info = 1,
1513
- Error = 2,
1514
- NotInstalledError = 3,
1515
- DownloadError = 4,
1516
- DownloadNotRestartError = 5
1517
- }
1518
1511
  /** The method to do interpolation. */
1519
1512
  enum EnumDWT_InterpolationMethod {
1520
1513
  IM_NEARESTNEIGHBOUR = 1,
@@ -126,5 +126,5 @@ export interface FormField {
126
126
  Add: (
127
127
  key: string,
128
128
  value: string
129
- ) => void;
129
+ ) => boolean;
130
130
  }
@@ -248,7 +248,7 @@ export interface DWTPro {
248
248
  port: string | number,
249
249
  portSSL: string | number,
250
250
  successCallBack: (DWObject: WebTwain) => void,
251
- failureCallBack: (errorString: string) => void): void;
251
+ failureCallBack: ({code: number, message: string}) => void): void;
252
252
  /**
253
253
  * Create a WebTwain instance with UI.
254
254
  * @param ContainerId Specify the HTML element (typically of the type HTMLDivElement) to hold the UI.
@@ -258,14 +258,14 @@ export interface DWTPro {
258
258
  * @param successCallback A callback function that is executed if the request succeeds.
259
259
  * @param failureCallback A callback function that is executed if the request fails.
260
260
  */
261
- CreateDWTObject(ContainerId: string, successCallBack: (DWObject: WebTwain) => void, failureCallBack: (errorString: string) => void): void;
261
+ CreateDWTObject(ContainerId: string, successCallBack: (DWObject: WebTwain) => void, failureCallBack: ({code: number, message: string}) => void): void;
262
262
  /**
263
263
  * Create a WebTwain instance without UI.
264
264
  * @param WebTwainId Specify the Id of the instance.
265
265
  * @param successCallback A callback function that is executed if the request succeeds.
266
266
  * @param failureCallback A callback function that is executed if the request fails.
267
267
  */
268
- CreateDWTObjectEx(dwtInitialConfig: DWTInitialConfig, successCallBack: (DWObject: WebTwain) => void, failureCallBack: (errorString: string) => void): void;
268
+ CreateDWTObjectEx(dwtInitialConfig: DWTInitialConfig, successCallBack: (DWObject: WebTwain) => void, failureCallBack: (error: {code: number, message: string}) => void): void;
269
269
  /**
270
270
  * Define the display info.
271
271
  */
@@ -320,7 +320,7 @@ export interface DWTPro {
320
320
  /**
321
321
  * Create a WebTwain instance(s).
322
322
  */
323
- Load(): void;
323
+ Load(): Promise<void>;
324
324
  /**
325
325
  * A callback function that is executed when the WebTwain related files are not found.
326
326
  */
@@ -390,7 +390,7 @@ export interface DWTPro {
390
390
  * @param event Specify the event.
391
391
  * @param callback Specify the callback.
392
392
  */
393
- RegisterEvent(event: string, callback: (...args: any[]) => void): void;
393
+ RegisterEvent(event: string, callback: (...args: any[]) => void): boolean;
394
394
  /**
395
395
  * Remove all authorizations for accessing local resources.
396
396
  */
@@ -415,6 +415,10 @@ export interface DWTPro {
415
415
  * The version of the Windows edition (the service, not wasm).
416
416
  */
417
417
  ServerVersionInfo: string;
418
+ /**
419
+ * The version of the Android edition (the service, not wasm).
420
+ */
421
+ ServerAndroidVersionInfo: string;
418
422
  /**
419
423
  * Built-in method to show a modal dialog.
420
424
  * @param width Width of the dialog.
@@ -452,7 +456,7 @@ export interface DWTPro {
452
456
  * IfInstallDWTModuleWithZIP, IfUpdateService,
453
457
  * IfUseEmbeddedDownloadNoticeForActiveX, IfUseViewer,
454
458
  * OnWebTwainInitMessage, OnWebTwainNeedUpgrade,
455
- * OnWebTwainNeedUpgradeWebJavascript, OnWebTwainInitMessage
459
+ * OnWebTwainNeedUpgradeWebJavascript
456
460
  * OnWebTwainOldPluginNotAllowed, OnWebTwainOldPluginNotAllowed
457
461
  * Trial, UseDefaultInstallUI, ViewerJSIntegerited,
458
462
  * inited, _srcUseLocalService
@@ -473,6 +477,16 @@ export interface DWTPro {
473
477
  * Dynamsoft.DWT.ConnectWithSocket
474
478
  */
475
479
  ConnectWithSocket: boolean;
480
+ /**
481
+ * Dynamsoft.DWT.IfCheckCORS
482
+ * Whether to check CORS issue in detail, the default value is false.
483
+ */
484
+ IfCheckCORS: boolean;
485
+ /**
486
+ * Dynamsoft.DWT.IfCheckCert
487
+ * Whether to check certificates issue in detail, default value is true.
488
+ */
489
+ IfCheckCert: boolean;
476
490
  }
477
491
  export interface DisplayInfo {
478
492
  loaderBarSource?: string;
@@ -93,15 +93,15 @@ export interface RemoteScanObject {
93
93
  optionConfig?:{
94
94
  //'blob', 'arraybuffer', 'text', 'xml', 'json', default: 'text'
95
95
  responseType?: DynamsoftEnumsDWT.EnumDWT_ResponseType,
96
- formFields?:[{
96
+ formFields?:{
97
97
  name: string,
98
98
  value: Blob | string,
99
99
  fileName ? : string
100
- }],
101
- headers?:[{
100
+ }[],
101
+ headers?:{
102
102
  name: string,
103
103
  value: string
104
- }]
104
+ }[]
105
105
  }
106
106
  ): Promise<any>;
107
107
  /**
@@ -145,11 +145,11 @@ export interface RemoteScanObject {
145
145
  * Return the index of an image specified by the imageId.
146
146
  * @param imageId The imageId of the image.
147
147
  */
148
- imageIDToIndex(imageId: number): number;
148
+ imageIDToIndex(imageId: string): number;
149
149
  /**
150
150
  * Return the imageId of an image specified by the index.
151
151
  * @param index The index of the image.
152
152
  */
153
- indexToImageID(index: number): number;
153
+ indexToImageID(index: number): string;
154
154
  }
155
155
 
@@ -75,7 +75,7 @@ export interface WebTwainAcquire extends WebTwainEdit {
75
75
  * @param bIncludeDetails Whether to return more details about the data sources or just their names.
76
76
  */
77
77
  GetSourceNamesAsync(bIncludeDetails: boolean): Promise<string[] | SourceDetails[]>;
78
- /**
78
+ /**
79
79
  * Bring up the Source Selection User Interface (UI) for the user to choose a data source.
80
80
  * @param successCallback A callback function that is executed if the request succeeds.
81
81
  * @param failureCallback A callback function that is executed if the request fails.
@@ -83,9 +83,19 @@ export interface WebTwainAcquire extends WebTwainEdit {
83
83
  * @argument errorString The error string.
84
84
  */
85
85
  SelectSource(
86
- successCallBack?: () => void,
87
- failureCallBack?: (errorCode: number, errorString: string) => void
88
86
  ): boolean | string;
87
+
88
+ /**
89
+ * Bring up the Source Selection User Interface (UI) for the user to choose a data source.
90
+ * @param successCallback A callback function that is executed if the request succeeds.
91
+ * @param failureCallback A callback function that is executed if the request fails.
92
+ * @argument errorCode The error code.
93
+ * @argument errorString The error string.
94
+ */
95
+ SelectSource(
96
+ successCallBack: () => void,
97
+ failureCallBack: (errorCode: number, errorString: string) => void
98
+ ): void;
89
99
  /**
90
100
  * Bring up the Source Selection User Interface (UI) for the user to choose a data source.
91
101
  * @param deviceType The device type. Added the parameter deviceType in Dynamic Web TWAIN 18
@@ -424,6 +434,23 @@ export interface WebTwainAcquire extends WebTwainEdit {
424
434
  errorCode: number,
425
435
  errorString: string
426
436
  ) => void
437
+ ): void;
438
+ /**
439
+ * Gets detailed information about specific capabilities of the current data source.
440
+ * @param capabilities Specify one or multiple capabilities.
441
+ * @param successCallback A callback function that is executed if the request succeeds.
442
+ * @param failureCallback A callback function that is executed if the request fails.
443
+ * @argument capabilityDetails Detailed information about the specified capabilities.
444
+ * @argument errorCode The error code.
445
+ * @argument errorString The error string.
446
+ */
447
+ getCapabilities(
448
+ capabilities: DynamsoftEnumsDWT.EnumDWT_Cap[] | number[],
449
+ succssCallback: (capabilityDetails: CapabilityDetails[]) => void,
450
+ failureCallback: (
451
+ errorCode: number,
452
+ errorString: string
453
+ ) => void
427
454
  ): void;
428
455
  /**
429
456
  * Sets up one or multiple capabilities in one call.
@@ -750,7 +777,7 @@ export interface ScanSetup {
750
777
  /**
751
778
  * The name of the data source (the scanner). If not set, the default data source is used.
752
779
  */
753
- scanner?: string;
780
+ scanner?: string | Device;
754
781
  ui?: {
755
782
  /**
756
783
  * Whether to show the UI of the device.
@@ -877,7 +904,9 @@ export interface ScanSetup {
877
904
  /**
878
905
  * Whether to enable automatic brightness adjustment.
879
906
  */
880
- autoBright?: boolean
907
+ autoBright?: boolean,
908
+ autoFeed?: boolean,
909
+ autoScan?: boolean
881
910
  };
882
911
  /**
883
912
  * A callback triggered before the scan, after the scan and after each page has been transferred.
@@ -959,7 +988,6 @@ export interface ScanSetup {
959
988
  httpParams?: {
960
989
  /**
961
990
  * Target of the request.
962
- * Example: "http://dynamsoft.com/receivepost.aspx"
963
991
  */
964
992
  url?: string,
965
993
  /**
@@ -1024,7 +1052,16 @@ export interface CapabilityDetails {
1024
1052
  /**
1025
1053
  * The current value of the Capability
1026
1054
  */
1027
- curValue?: ValueAndLabel;
1055
+ curValue?: ValueAndLabel | string | number | Frame;
1056
+ defValue?: ValueAndLabel | string | number | Frame;
1057
+ maxValue?: number;
1058
+ minValue?: number;
1059
+ stepSize?: number;
1060
+ enums?: ValueAndLabel[] | any[];
1061
+ /**
1062
+ * The available values of the Capability
1063
+ */
1064
+ values?: ValueAndLabel[] | any[];
1028
1065
  /**
1029
1066
  * The index for the default value of the Capability
1030
1067
  */
@@ -1050,10 +1087,6 @@ export interface CapabilityDetails {
1050
1087
  * TWTY_int: 5
1051
1088
  */
1052
1089
  valueType?: ValueAndLabel;
1053
- /**
1054
- * The available values of the Capability
1055
- */
1056
- values?: ValueAndLabel[];
1057
1090
  }
1058
1091
  export interface ValueAndLabel {
1059
1092
  /**
@@ -1070,7 +1103,7 @@ export interface Capabilities {
1070
1103
  /**
1071
1104
  * Whether to "ignore" or "fail" the request if an exception occurs. This is an overall setting that is inherited by all capabilities.
1072
1105
  */
1073
- exceptition: string;
1106
+ exception: string;
1074
1107
  /**
1075
1108
  * Specifies how to set capabilities
1076
1109
  */
@@ -1084,7 +1117,8 @@ export interface CapabilitySetup {
1084
1117
  /**
1085
1118
  * The value to set to the capability or the value of the capability after setting.
1086
1119
  */
1087
- curValue: number | string | object;
1120
+ curValue?: number | string | object;
1121
+ values?:any[];
1088
1122
  errorCode?: number;
1089
1123
  errorString?: string;
1090
1124
  /**
@@ -1102,4 +1136,11 @@ export interface Device {
1102
1136
  deviceType: DynamsoftEnumsDWT.EnumDWT_DeviceType;
1103
1137
  serviceInfo?: ServiceInfo;
1104
1138
  deviceInfo?: any;
1139
+ }
1140
+
1141
+ export interface Frame{
1142
+ left:number,
1143
+ top:number,
1144
+ right:number,
1145
+ bottom:number,
1105
1146
  }
@@ -100,6 +100,14 @@ export interface WebTwainBuffer extends WebTwainIO {
100
100
  * @param type Sepcify the expected file type.
101
101
  */
102
102
  GetSelectedImagesSize(type: DynamsoftEnumsDWT.EnumDWT_ImageType | number): number;
103
+ /**
104
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `GetSkewAngle` instead.
105
+ * Return the skew angle of the specified image.
106
+ * @param index Specify the image.
107
+ */
108
+ GetSkewAngle(
109
+ index: number
110
+ ): number;
103
111
  /**
104
112
  * Return the skew angle of the specified image.
105
113
  * @param index Specify the image.
@@ -116,7 +124,23 @@ export interface WebTwainBuffer extends WebTwainIO {
116
124
  failureCallback?: (
117
125
  errorCode: number,
118
126
  errorString: string) => void
119
- ): number | void;
127
+ ): void;
128
+ /**
129
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `GetSkewAngleEx` instead.
130
+ * Return the skew angle of the specified rectangle on the specified image.
131
+ * @param index Specify the image.
132
+ * @param left The x-coordinate of the upper-left corner of the rectangle.
133
+ * @param top The y-coordinate of the upper-left corner of the rectangle.
134
+ * @param right The x-coordinate of the lower-right corner of the rectangle.
135
+ * @param bottom The y-coordinate of the lower-right corner of the rectangle.
136
+ */
137
+ GetSkewAngleEx(
138
+ index: number,
139
+ left: number,
140
+ top: number,
141
+ right: number,
142
+ bottom: number
143
+ ): number;
120
144
  /**
121
145
  * Return the skew angle of the specified rectangle on the specified image.
122
146
  * @param index Specify the image.
@@ -141,7 +165,7 @@ export interface WebTwainBuffer extends WebTwainIO {
141
165
  failureCallback?: (
142
166
  errorCode: number,
143
167
  errorString: string) => void
144
- ): number | void;
168
+ ): void;
145
169
  /**
146
170
  * Return how many images are held in the buffer
147
171
  */
@@ -154,12 +178,12 @@ export interface WebTwainBuffer extends WebTwainIO {
154
178
  * Return the imageId of an image specified by the index.
155
179
  * @param index The index of the image.
156
180
  */
157
- IndexToImageID(index: number): number;
181
+ IndexToImageID(index: number): string;
158
182
  /**
159
183
  * Return the index of an image specified by the imageId.
160
184
  * @param imageId The imageId of the image.
161
185
  */
162
- ImageIDToIndex(imageId: number): number;
186
+ ImageIDToIndex(imageId: string): number;
163
187
  /**
164
188
  * Check whether the specified image is blank.
165
189
  * @param index Specify the image.
@@ -279,7 +303,7 @@ export interface WebTwainBuffer extends WebTwainIO {
279
303
  * Get the status of the tags for a specific image.
280
304
  * @param index Specify one image.
281
305
  */
282
- GetTagListByIndex(index:number): TagName[];
306
+ GetTagListByIndex(index:number): string[];
283
307
  /**
284
308
  * Get the current document name.
285
309
  */
@@ -367,21 +391,24 @@ export interface WebTwainBuffer extends WebTwainIO {
367
391
  * @argument sourceIndices The indices of the images to be copied.
368
392
  * @argument targetIndex The index at which the source images should be inserted into the new document. If not specifed, the images will be appended to the destination document.
369
393
  */
370
- CopyToDocumentAsync(from: string, to: string, sourceIndices: number[]|number, targetIndex: number): Promise<void>;
394
+ CopyToDocumentAsync(from: string, to: string, sourceIndices: number[], targetIndex: number): Promise<void>;
395
+ /*
396
+ * Update server-side data.
397
+ * @param imageId The imageId of the image.
398
+ * @param blob Specify the blob.
399
+ */
400
+ updateImage(imageId: string, blob: Blob): Promise <void>;
371
401
  }
372
402
 
373
- export interface TagName {
374
- name: string;
375
- }
376
403
 
377
404
  export interface TagInfo {
378
405
  name: string;
379
- imageIds: number[];
406
+ imageIds: string[];
380
407
  }
381
408
 
382
409
  export interface DocumentInfo {
383
410
  name: string;
384
- imageIds: number[];
411
+ imageIds: string[];
385
412
  }
386
413
 
387
414
  export interface RawData {