diff --git a/types/dwt/addon.pdf.d.ts b/types/dwt/addon.pdf.d.ts new file mode 100644 index 0000000000..ef0980abfd --- /dev/null +++ b/types/dwt/addon.pdf.d.ts @@ -0,0 +1,73 @@ +/*! +* Dynamsoft WebTwain PDF Addon +* Product: Dynamsoft Web Twain +* Web Site: http://www.dynamsoft.com +* +* Copyright 2018, Dynamsoft Corporation +* Author: Dynamsoft Support Team +* Version: 13.4 +*/ + +declare enum EnumDWT_ConverMode { + CM_DEFAULT = 0, + TWPT_CM_RENDERALLGRAY = 1 +} + +/** + * @class + */ +interface PDF { + /** + * Download and install pdf rasterizer add-on on the local system. + * @method Dynamsoft.WebTwain#Download + * @param {string} remoteFile specifies the value of which frame to get. + * @param {function} optionalAsyncSuccessFunc optional. + * The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. + * The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + Download(remoteFile: string, + optionalAsyncSuccessFunc?: () => void, + optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Input the password to decrypt PDF files using PDF Rasterizer add-on. + * @method Dynamsoft.WebTwain#SetPassword + * @param {string} password Specifies the PDF password. + * @return {bool} + */ + SetPassword(password: string): boolean; + + /** + * Set the image convert mode for PDF Rasterizer in Dynamic Web TWAIN. + * @method Dynamsoft.WebTwain#SetConvertMode + * @param {EnumDWT_ConverMode} convertMode Specifies the image convert mode. + * @return {bool} + */ + SetConvertMode(convertMode: EnumDWT_ConverMode): boolean; + + /** + * Set the output resolution for the PDF Rasterizer in Dynamic Web TWAIN. + * @method Dynamsoft.WebTwain#ReadRect + * @param {float} fResolution Specifies the resolution for convert image from PDF file. + * @return {bool} + */ + SetResolution(fResolution: number): boolean; + + /** + * Judges whether the local PDF is text-based or not. + * @method Dynamsoft.WebTwain#ReadRect + * @param {string} localFile specifies the local path of the target PDF. + * @return {bool} + */ + IsTextBasedPDF(localFile: string): boolean; +} + +interface WebTwainAddon { + PDF: PDF; +} + +interface WebTwain { + Addon: WebTwainAddon; +} diff --git a/types/dwt/dwt-tests.ts b/types/dwt/dwt-tests.ts index 16a56f1cd2..1be94acca1 100644 --- a/types/dwt/dwt-tests.ts +++ b/types/dwt/dwt-tests.ts @@ -103,8 +103,8 @@ function downloadImage() { function loadPDF() { const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { - DWObject.Addon.PDF.SetResolution(200); - DWObject.Addon.PDF.SetConvertMode(1); + DWObject.Addon.PDF.SetResolution(200); + DWObject.Addon.PDF.SetConvertMode(1); DWObject.IfShowFileDialog = true; DWObject.LoadImageEx(" ", 5); } diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts index b19980603e..b940c6ae4e 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for dwt 13.3 +// Type definitions for dwt 13.4 // Project: http://www.dynamsoft.com/Products/WebTWAIN_Overview.aspx // Definitions by: Xiao Ling // Josh Hall +// Lincoln Hu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -10,68 +11,11 @@ * Product: Dynamsoft Web Twain * Web Site: http://www.dynamsoft.com * -* Copyright 2017, Dynamsoft Corporation +* Copyright 2018, Dynamsoft Corporation * Author: Dynamsoft Support Team -* Version: 13.3 +* Version: 13.4 */ -/** - * Dynamsoft WebTwain Addon PDF - */ -declare enum EnumDWT_ConverMode { - CM_DEFAULT = 0, - TWPT_CM_RENDERALLGRAY = 1 -} - -/** - * @class - */ -interface PDF { - /** - * Download and install pdf rasterizer add-on on the local system. - * @method Dynamsoft.WebTwain#Download - * @param {string} remoteFile specifies the value of which frame to get. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. - * @return {bool} - */ - Download(remoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Input the password to decrypt PDF files using PDF Rasterizer add-on. - * @method Dynamsoft.WebTwain#SetPassword - * @param {string} password Specifies the PDF password. - * @return {bool} - */ - SetPassword(password: string): boolean; - - /** - * Set the image convert mode for PDF Rasterizer in Dynamic Web TWAIN. - * @method Dynamsoft.WebTwain#SetConvertMode - * @param {EnumDWT_ConverMode} convertMode Specifies the image convert mode. - * @return {bool} - */ - SetConvertMode(convertMode: EnumDWT_ConverMode): boolean; - - /** - * Set the output resolution for the PDF Rasterizer in Dynamic Web TWAIN. - * @method Dynamsoft.WebTwain#ReadRect - * @param {float} fResolution Specifies the resolution for convert image from PDF file. - * @return {bool} - */ - SetResolution(fResolution: number): boolean; - - /** - * Judges whether the local PDF is text-based or not. - * @method Dynamsoft.WebTwain#ReadRect - * @param {string} localFile specifies the local path of the target PDF. - * @return {bool} - */ - IsTextBasedPDF(localFile: string): boolean; -} - -///////////////////////////////////////////////////////////////////////////////////////////////////// - /** * @namespace Dynamsoft */ @@ -1318,21 +1262,11 @@ interface Container { Height: string | number; } -interface WebTwainAddon { - PDF: PDF; -} - /** * @class */ // properties (get/set) / sync functions interface WebTwain { - /** - * Returns addon. - * @type {WebTwainAddon} - */ - Addon: WebTwainAddon; - /** * Returns or sets whether multi-page selection is supported. * @type {bool} diff --git a/types/dwt/tsconfig.json b/types/dwt/tsconfig.json index db2ac6bbf4..13f35fcfbf 100644 --- a/types/dwt/tsconfig.json +++ b/types/dwt/tsconfig.json @@ -18,6 +18,7 @@ }, "files": [ "index.d.ts", + "addon.pdf.d.ts", "dwt-tests.ts" ] } \ No newline at end of file