From ebd4258ba7cfdc2a2f8db70c8d05dacb06e87ccc Mon Sep 17 00:00:00 2001 From: yushulx Date: Thu, 8 Feb 2018 13:26:07 +0800 Subject: [PATCH] Add PDF addon definition --- types/dwt/index.d.ts | 69 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts index d72fab058f..230cd63d19 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -12,9 +12,66 @@ * * Copyright 2017, Dynamsoft Corporation * Author: Dynamsoft Support Team -* Version: 13 +* Version: 13.3 */ +/** + * 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 */ @@ -1261,11 +1318,21 @@ 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}