Merge pull request #24251 from dynamsoft-dwt/master

create pdf addon
This commit is contained in:
Arthur Ozga
2018-03-15 12:31:42 -07:00
committed by GitHub
4 changed files with 80 additions and 72 deletions
+73
View File
@@ -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;
}
+2 -2
View File
@@ -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);
}
+4 -70
View File
@@ -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 <https://github.com/yushulx>
// Josh Hall <https://github.com/jbh>
// Lincoln Hu <https://github.com/lincoln2018>
// 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}
+1
View File
@@ -18,6 +18,7 @@
},
"files": [
"index.d.ts",
"addon.pdf.d.ts",
"dwt-tests.ts"
]
}