From 91a40945397f508e1fc55c85aa84618a28842d57 Mon Sep 17 00:00:00 2001 From: huqingyu Date: Tue, 13 Mar 2018 08:55:03 +0800 Subject: [PATCH 1/3] change to version 13.4 --- types/dwt/addon.pdf.d.ts | 62 ++++++++++++++++++++++++++++++++++++++ types/dwt/dwt-tests.ts | 2 -- types/dwt/index.d.ts | 65 +++------------------------------------- 3 files changed, 66 insertions(+), 63 deletions(-) create mode 100644 types/dwt/addon.pdf.d.ts diff --git a/types/dwt/addon.pdf.d.ts b/types/dwt/addon.pdf.d.ts new file mode 100644 index 0000000000..90422d2f26 --- /dev/null +++ b/types/dwt/addon.pdf.d.ts @@ -0,0 +1,62 @@ +/** + * 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; +} + +interface WebTwainAddon { + PDF: PDF; +} diff --git a/types/dwt/dwt-tests.ts b/types/dwt/dwt-tests.ts index 16a56f1cd2..7c9e96bf6a 100644 --- a/types/dwt/dwt-tests.ts +++ b/types/dwt/dwt-tests.ts @@ -103,8 +103,6 @@ function downloadImage() { function loadPDF() { const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { - 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..63125cadd5 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -1,4 +1,4 @@ -// 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 @@ -10,68 +10,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 */ -/** - * 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 */ @@ -1319,7 +1262,7 @@ interface Container { } interface WebTwainAddon { - PDF: PDF; + } /** From 8b75f13e8d265d496a210aee5f66a344a11ccdca Mon Sep 17 00:00:00 2001 From: lincoln Date: Tue, 13 Mar 2018 14:20:45 +0800 Subject: [PATCH 2/3] create pdf addon --- types/dwt/addon.pdf.d.ts | 4 ++++ types/dwt/index.d.ts | 11 +---------- types/dwt/tsconfig.json | 1 + 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/types/dwt/addon.pdf.d.ts b/types/dwt/addon.pdf.d.ts index 90422d2f26..73f270c7a4 100644 --- a/types/dwt/addon.pdf.d.ts +++ b/types/dwt/addon.pdf.d.ts @@ -60,3 +60,7 @@ interface PDF { interface WebTwainAddon { PDF: PDF; } + +interface WebTwain { + Addon: WebTwainAddon; +} diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts index 63125cadd5..752e0a8e0a 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -2,6 +2,7 @@ // 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 @@ -1261,21 +1262,11 @@ interface Container { Height: string | number; } -interface WebTwainAddon { - -} - /** * @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 From 3d41a380dfb312e998ea6ca1afce0d5284565519 Mon Sep 17 00:00:00 2001 From: lincoln Date: Tue, 13 Mar 2018 14:37:31 +0800 Subject: [PATCH 3/3] change back for test --- types/dwt/addon.pdf.d.ts | 13 ++++++++++--- types/dwt/dwt-tests.ts | 2 ++ types/dwt/index.d.ts | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/types/dwt/addon.pdf.d.ts b/types/dwt/addon.pdf.d.ts index 73f270c7a4..ef0980abfd 100644 --- a/types/dwt/addon.pdf.d.ts +++ b/types/dwt/addon.pdf.d.ts @@ -1,6 +1,13 @@ -/** - * Dynamsoft WebTwain Addon PDF - */ +/*! +* 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 diff --git a/types/dwt/dwt-tests.ts b/types/dwt/dwt-tests.ts index 7c9e96bf6a..1be94acca1 100644 --- a/types/dwt/dwt-tests.ts +++ b/types/dwt/dwt-tests.ts @@ -103,6 +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.IfShowFileDialog = true; DWObject.LoadImageEx(" ", 5); } diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts index 752e0a8e0a..b940c6ae4e 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -13,7 +13,7 @@ * * Copyright 2018, Dynamsoft Corporation * Author: Dynamsoft Support Team -* Version: 13 +* Version: 13.4 */ /**