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.
@@ -49,6 +49,10 @@ export interface WebTwainIO extends WebTwainUtil {
49
49
  * Return or set whether to show open/save file dialog when saving images in the buffer or loading images from a local directory.
50
50
  */
51
51
  IfShowFileDialog: boolean;
52
+ /**
53
+ * Return or set whether to load images in the order of selection when displaying the open file dialog.
54
+ */
55
+ IfSortBySelectionOrder: boolean;
52
56
  /**
53
57
  * Return or set whether to show the progress of an operation with a button to cancel it.
54
58
  */
@@ -400,6 +404,31 @@ export interface WebTwainIO extends WebTwainUtil {
400
404
  errorCode: number,
401
405
  errorString: string) => void
402
406
  ): void;
407
+ /**
408
+ * Upload the blob via a HTTP Post.
409
+ * @param URL The server-side script to receive the post.
410
+ * @param blobData Specify the blob.
411
+ * @param fileName The file name.
412
+ * @argument response The response value.
413
+ */
414
+ httpUploadBlob(
415
+ URL: string,
416
+ blobData: Blob,
417
+ fileName: string,
418
+ optionConfig?:{
419
+ //'blob', 'arraybuffer', 'text', 'xml', 'json', default: 'text'
420
+ responseType?: DynamsoftEnumsDWT.EnumDWT_ResponseType,
421
+ formFields?:{
422
+ name: string,
423
+ value: Blob | string,
424
+ fileName ? : string
425
+ }[],
426
+ headers?:{
427
+ name: string,
428
+ value: string
429
+ }[]
430
+ }
431
+ ): Promise<any>;
403
432
  /**
404
433
  * Upload the specified image(s) via a HTTP Post.
405
434
  * @param URL The server-side script to receive the post.
@@ -622,6 +651,14 @@ export interface WebTwainIO extends WebTwainUtil {
622
651
  errorString: string,
623
652
  response: string) => void
624
653
  ): void;
654
+ /**
655
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `LoadImage` instead.
656
+ * Load image(s) specified by its absolute path.
657
+ * @param fileName The path of the image to load.
658
+ */
659
+ LoadImage(
660
+ fileName: string
661
+ ): boolean;
625
662
  /**
626
663
  * Load image(s) specified by its absolute path.
627
664
  * @param fileName The path of the image to load.
@@ -636,7 +673,17 @@ export interface WebTwainIO extends WebTwainUtil {
636
673
  failureCallback?: (
637
674
  errorCode: number,
638
675
  errorString: string) => void
639
- ): void | boolean;
676
+ ): void;
677
+ /**
678
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `LoadImageEx` instead.
679
+ * Load image(s) specified by its absolute path.
680
+ * @param fileName The path of the image to load.
681
+ * @param type The format of the image.
682
+ */
683
+ LoadImageEx(
684
+ fileName: string,
685
+ type:DynamsoftEnumsDWT.EnumDWT_ImageType | number
686
+ ): boolean;
640
687
  /**
641
688
  * Load image(s) specified by its absolute path.
642
689
  * @param fileName The path of the image to load.
@@ -653,7 +700,16 @@ export interface WebTwainIO extends WebTwainUtil {
653
700
  failureCallback?: (
654
701
  errorCode: number,
655
702
  errorString: string) => void
656
- ): void | boolean;
703
+ ): void;
704
+ /**
705
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `LoadImageFromBase64Binary` instead.
706
+ * Load image(s) from a base64 string.
707
+ * @param imageData The image data which is a base64 string without the data URI scheme.
708
+ */
709
+ LoadImageFromBase64Binary(
710
+ imageData: string,
711
+ imageType: DynamsoftEnumsDWT.EnumDWT_ImageType
712
+ ): boolean;
657
713
  /**
658
714
  * Load image(s) from a base64 string.
659
715
  * @param imageData The image data which is a base64 string without the data URI scheme.
@@ -669,7 +725,7 @@ export interface WebTwainIO extends WebTwainUtil {
669
725
  failureCallback?: (
670
726
  errorCode: number,
671
727
  errorString: string) => void
672
- ): void | boolean;
728
+ ): void;
673
729
  /**
674
730
  * Load image(s) from a binary object (Blob | ArrayBuffer).
675
731
  * @param imageData The image data.
@@ -685,6 +741,12 @@ export interface WebTwainIO extends WebTwainUtil {
685
741
  errorCode: number,
686
742
  errorString: string) => void
687
743
  ): void;
744
+ /**
745
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `LoadDibFromClipboard` instead.
746
+ * Load an image from the system clipboard. The image must be in DIB format.
747
+ */
748
+ LoadDibFromClipboard(
749
+ ): boolean;
688
750
  /**
689
751
  * Load an image from the system clipboard. The image must be in DIB format.
690
752
  * @param successCallback A callback function that is executed if the request succeeds.
@@ -697,7 +759,7 @@ export interface WebTwainIO extends WebTwainUtil {
697
759
  failureCallback?: (
698
760
  errorCode: number,
699
761
  errorString: string) => void
700
- ): void | boolean;
762
+ ): void;
701
763
  /**
702
764
  * @deprecated since version 16.1.1. This property will be removed in future versions.
703
765
  * Return or set how many threads can be used when you upload files through POST.
@@ -716,7 +778,17 @@ export interface WebTwainIO extends WebTwainUtil {
716
778
  * Export specified image data in the buffer to a new browser window and use the browser's built-in print feature to print the image(s).
717
779
  * @argument indices The indices of the converted images.
718
780
  */
719
- PrintEx(indices: number[]): void;
781
+ PrintEx(indices: number[]): boolean;
782
+ /**
783
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `SaveAsBMP` instead.
784
+ * Save the specified image as a BMP file.
785
+ * @param fileName The name to save to.
786
+ * @param index The index which specifies the image to save.
787
+ */
788
+ SaveAsBMP(
789
+ fileName: string,
790
+ index: number
791
+ ): boolean;
720
792
  /**
721
793
  * Save the specified image as a BMP file.
722
794
  * @param fileName The name to save to.
@@ -729,9 +801,19 @@ export interface WebTwainIO extends WebTwainUtil {
729
801
  SaveAsBMP(
730
802
  fileName: string,
731
803
  index: number,
732
- successCallback?: () => void,
733
- failureCallback?: (errorCode: number, errorString: string) => void
734
- ): void | boolean;
804
+ successCallback: () => void,
805
+ failureCallback: (errorCode: number, errorString: string) => void
806
+ ): void;
807
+ /**
808
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `SaveAsJPEG` instead.
809
+ * Save the specified image as a JPEG file.
810
+ * @param fileName The name to save to.
811
+ * @param index The index which specifies the image to save.
812
+ */
813
+ SaveAsJPEG(
814
+ fileName: string,
815
+ index: number
816
+ ): boolean;
735
817
  /**
736
818
  * Save the specified image as a JPEG file.
737
819
  * @param fileName The name to save to.
@@ -744,9 +826,19 @@ export interface WebTwainIO extends WebTwainUtil {
744
826
  SaveAsJPEG(
745
827
  fileName: string,
746
828
  index: number,
747
- successCallback?: () => void,
748
- failureCallback?: (errorCode: number, errorString: string) => void
749
- ): void | boolean;
829
+ successCallback: () => void,
830
+ failureCallback: (errorCode: number, errorString: string) => void
831
+ ): void;
832
+ /**
833
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `SaveAsPDF` instead.
834
+ * Save the specified image as a PDF file.
835
+ * @param fileName The name to save to.
836
+ * @param index The index which specifies the image to save.
837
+ */
838
+ SaveAsPDF(
839
+ fileName: string,
840
+ index: number
841
+ ): boolean;
750
842
  /**
751
843
  * Save the specified image as a PDF file.
752
844
  * @param fileName The name to save to.
@@ -759,9 +851,19 @@ export interface WebTwainIO extends WebTwainUtil {
759
851
  SaveAsPDF(
760
852
  fileName: string,
761
853
  index: number,
762
- successCallback?: () => void,
763
- failureCallback?: (errorCode: number, errorString: string) => void
764
- ): void | boolean;
854
+ successCallback: () => void,
855
+ failureCallback: (errorCode: number, errorString: string) => void
856
+ ): void;
857
+ /**
858
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `SaveAsPNG` instead.
859
+ * Save the specified image as a PNG file.
860
+ * @param fileName The name to save to.
861
+ * @param index The index which specifies the image to save.
862
+ */
863
+ SaveAsPNG(
864
+ fileName: string,
865
+ index: number
866
+ ): boolean;
765
867
  /**
766
868
  * Save the specified image as a PNG file.
767
869
  * @param fileName The name to save to.
@@ -774,9 +876,19 @@ export interface WebTwainIO extends WebTwainUtil {
774
876
  SaveAsPNG(
775
877
  fileName: string,
776
878
  index: number,
777
- successCallback?: () => void,
778
- failureCallback?: (errorCode: number, errorString: string) => void
779
- ): void | boolean;
879
+ successCallback: () => void,
880
+ failureCallback: (errorCode: number, errorString: string) => void
881
+ ): void;
882
+ /**
883
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `SaveAsTIFF` instead.
884
+ * Save the specified image as a TIFF file.
885
+ * @param fileName The name to save to.
886
+ * @param index The index which specifies the image to save.
887
+ */
888
+ SaveAsTIFF(
889
+ fileName: string,
890
+ index: number
891
+ ): boolean;
780
892
  /**
781
893
  * Save the specified image as a TIFF file.
782
894
  * @param fileName The name to save to.
@@ -789,9 +901,17 @@ export interface WebTwainIO extends WebTwainUtil {
789
901
  SaveAsTIFF(
790
902
  fileName: string,
791
903
  index: number,
792
- successCallback?: () => void,
793
- failureCallback?: (errorCode: number, errorString: string) => void
794
- ): void | boolean;
904
+ successCallback: () => void,
905
+ failureCallback: (errorCode: number, errorString: string) => void
906
+ ): void;
907
+ /**
908
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `SaveAllAsMultiPageTIFF` instead.
909
+ * Saves all the images in buffer as a multi-page TIFF file.
910
+ * @param fileName The name to save to.
911
+ */
912
+ SaveAllAsMultiPageTIFF(
913
+ fileName: string
914
+ ): boolean;
795
915
  /**
796
916
  * Saves all the images in buffer as a multi-page TIFF file.
797
917
  * @param fileName The name to save to.
@@ -802,9 +922,17 @@ export interface WebTwainIO extends WebTwainUtil {
802
922
  */
803
923
  SaveAllAsMultiPageTIFF(
804
924
  fileName: string,
805
- successCallback?: () => void,
806
- failureCallback?: (errorCode: number, errorString: string) => void
807
- ): void | boolean;
925
+ successCallback: () => void,
926
+ failureCallback: (errorCode: number, errorString: string) => void
927
+ ): void;
928
+ /**
929
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `SaveAllAsPDF` instead.
930
+ * Saves all the images in buffer as a multi-page PDF file.
931
+ * @param fileName The name to save to.
932
+ */
933
+ SaveAllAsPDF(
934
+ fileName: string
935
+ ): boolean;
808
936
  /**
809
937
  * Saves all the images in buffer as a multi-page PDF file.
810
938
  * @param fileName The name to save to.
@@ -815,9 +943,17 @@ export interface WebTwainIO extends WebTwainUtil {
815
943
  */
816
944
  SaveAllAsPDF(
817
945
  fileName: string,
818
- successCallback?: () => void,
819
- failureCallback?: (errorCode: number, errorString: string) => void
820
- ): void | boolean;
946
+ successCallback: () => void,
947
+ failureCallback: (errorCode: number, errorString: string) => void
948
+ ): void;
949
+ /**
950
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `SaveSelectedImagesAsMultiPagePDF` instead.
951
+ * Saves all selected images in buffer as a multi-page PDF file.
952
+ * @param fileName The name to save to.
953
+ */
954
+ SaveSelectedImagesAsMultiPagePDF(
955
+ fileName: string
956
+ ): boolean;
821
957
  /**
822
958
  * Saves all selected images in buffer as a multi-page PDF file.
823
959
  * @param fileName The name to save to.
@@ -828,9 +964,17 @@ export interface WebTwainIO extends WebTwainUtil {
828
964
  */
829
965
  SaveSelectedImagesAsMultiPagePDF(
830
966
  fileName: string,
831
- successCallback?: () => void,
832
- failureCallback?: (errorCode: number, errorString: string) => void
833
- ): void | boolean;
967
+ successCallback: () => void,
968
+ failureCallback: (errorCode: number, errorString: string) => void
969
+ ): void;
970
+ /**
971
+ * @deprecated since version 18.5. This property will be removed in future versions. Use asynchronous function `SaveSelectedImagesAsMultiPageTIFF` instead.
972
+ * Saves all selected images in buffer as a multi-page TIFF file.
973
+ * @param fileName The name to save to.
974
+ */
975
+ SaveSelectedImagesAsMultiPageTIFF(
976
+ fileName: string
977
+ ): boolean;
834
978
  /**
835
979
  * Saves all selected images in buffer as a multi-page TIFF file.
836
980
  * @param fileName The name to save to.
@@ -841,11 +985,11 @@ export interface WebTwainIO extends WebTwainUtil {
841
985
  */
842
986
  SaveSelectedImagesAsMultiPageTIFF(
843
987
  fileName: string,
844
- successCallback?: () => void,
845
- failureCallback?: (
988
+ successCallback: () => void,
989
+ failureCallback: (
846
990
  errorCode: number,
847
991
  errorString: string) => void
848
- ): void | boolean;
992
+ ): void;
849
993
  /**
850
994
  * @deprecated since version 16.1.1. This property will be removed in future versions. Use `SelectedImagesIndices` instead.
851
995
  * Return an index from the selected indices array.
@@ -865,6 +1009,16 @@ export interface WebTwainIO extends WebTwainUtil {
865
1009
  successCallback?: (result: string[]) => void,
866
1010
  failureCallback?: (errorCode: number, errorString: string) => void
867
1011
  ): string | boolean;
1012
+ /**
1013
+ * Save the blob as a local file.
1014
+ * @param fileName The file name.
1015
+ * @param blobData Specify the blob.
1016
+ * @argument response The response value.
1017
+ */
1018
+ saveBlob(
1019
+ fileName: string,
1020
+ blobData: Blob,
1021
+ ): Promise<void>;
868
1022
  /**
869
1023
  * Add a custom field to the HTTP Post Form.
870
1024
  * @param name The name of the field.
@@ -952,7 +1106,7 @@ export interface WebTwainIO extends WebTwainUtil {
952
1106
  * Copy selected area to Blob or base64.
953
1107
  * @param index Image to be copied from.
954
1108
  * @param area Area of image to be copied. X,Y is top left corner origin, width and height is size of area to be copied.
955
- * @param type The target image type of the blob/base64.
1109
+ * @param type The format of the file.
956
1110
  * @param imageFormatType Specify if the return should be Blob or base64 string. Only support blob or base64
957
1111
  */
958
1112
  OutputSelectedAreaAsync(
@@ -966,6 +1120,45 @@ export interface WebTwainIO extends WebTwainUtil {
966
1120
  type: DynamsoftEnumsDWT.EnumDWT_ImageType | number,
967
1121
  imageFormatType: DynamsoftEnumsDWT.EnumDWT_ImageFormatType | number,
968
1122
  ): Promise < Blob|string > ;
1123
+ /**
1124
+ * create Local Storage.
1125
+ * @param Object Allow users to enhance the security of saved Local Storage data by using a password.
1126
+ */
1127
+ createLocalStorage(settings?: {password?:string}): Promise <string>;
1128
+ /**
1129
+ * Check if LocalStorage exists.
1130
+ * @param uid Unique identifier for the created LocalStorage.
1131
+ */
1132
+ localStorageExist(uid: string):Promise<boolean>;
1133
+ /**
1134
+ * Save image data to LocalStorage.
1135
+ * @param Object.uid Unique identifier for the created LocalStorage.
1136
+ * @param Object.password Ensure that the entered password matches the one inputted when creating LocalStorage in order to successfully save.
1137
+ * @param indices The index array to be saved. Default to save all images.
1138
+ */
1139
+ saveToLocalStorage(settings: {
1140
+ uid: string,
1141
+ password?:string,
1142
+ indices?:[]
1143
+ }): Promise<string[]>;
1144
+ /**
1145
+ * Load images saved from LocalStorage.
1146
+ * @param Object.uid Unique identifier for the created LocalStorage.
1147
+ * @param Object.password Ensure that the entered password matches the one inputted when creating LocalStorage in order to successfully load images.
1148
+ */
1149
+ loadFromLocalStorage (settings: {
1150
+ uid: string,
1151
+ password?:string,
1152
+ }) : Promise<{oriImageId:string, newImageId: string}[]>; // uid is returned from
1153
+ /**
1154
+ * Delete the saved LocalStorage.
1155
+ * @param Object.uid Unique identifier for the created LocalStorage.
1156
+ * @param Object.password Ensure that the entered password matches the one inputted when creating LocalStorage in order to successfully delete the specified LocalStorage.
1157
+ */
1158
+ removeLocalStorage(settings: {
1159
+ uid: string,
1160
+ password?:string,
1161
+ }): Promise<boolean>;
969
1162
  }
970
1163
  export interface Base64Result {
971
1164
  /**
@@ -995,3 +1188,10 @@ export interface LicenseDetailItem {
995
1188
  readonly Trial: string;
996
1189
  readonly Version: string;
997
1190
  }
1191
+ export interface MetaData{
1192
+ width: number;
1193
+ height: number;
1194
+ bitDepth: number;
1195
+ resolutionX: number;
1196
+ resolutionY: number;
1197
+ }
@@ -111,22 +111,26 @@ export interface BufferChangeInfo {
111
111
  /**
112
112
  * The image id (not the index) of the current page.
113
113
  */
114
- currentId: number;
114
+ currentId: string;
115
115
  /**
116
116
  * All image ids.
117
117
  */
118
- imageIds: number[];
118
+ imageIds: string[];
119
119
  /**
120
120
  * All selected image ids.
121
121
  */
122
- selectedIds: number[];
122
+ selectedIds: string[];
123
+ /**
124
+ * only when the value of action is 'modify'
125
+ */
126
+ modifiedId?: string;
123
127
  }
124
128
 
125
129
  export interface OutputInfo {
126
130
  /**
127
131
  * Id of the image if it's transferred to the buffer.
128
132
  */
129
- imageId?: number;
133
+ imageId?: string;
130
134
  /**
131
135
  * Path of the image if it's transferred to the disk.
132
136
  */
@@ -922,7 +922,7 @@ export interface CheckboxSettings {
922
922
  export interface PageNumberSettings {
923
923
  visibility?: string; //"visible": hidden", default: "hidden"
924
924
  width?: number | string; //default: "24px", number unit: px, string value: "24px"/"10%", relative to parent container
925
- height?: number | string, //default: "24px", number unit: px, string value: "24px"/"10%", relative to parent container
925
+ height?: number | string; //default: "24px", number unit: px, string value: "24px"/"10%", relative to parent container
926
926
  background?: string; //default: "#ffffff"
927
927
  borderWidth?: number | string; //default: "1px", unit: px, percentage value not supported
928
928
  borderColor?: string; //default: "#a79898"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dwt",
3
- "version": "18.4.2",
3
+ "version": "18.5.0",
4
4
  "author": {
5
5
  "name": "Dynamsoft",
6
6
  "url": "https://www.dynamsoft.com"