reorganize the defintions, adds definitions for addons including OCRP and PDF

This commit is contained in:
Tom Kent
2019-01-25 11:28:16 +08:00
parent ada0172fa2
commit d8190651e4
4 changed files with 4025 additions and 3774 deletions
+135
View File
@@ -0,0 +1,135 @@
// Type definitions for dwt 14.3.1
// 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>
// Tom Kent <https://github.com/Tom-Dynamsoft>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/*!
* Based on Dynamsoft WebTwain JavaScript Intellisense
* Product: Dynamsoft Web Twain
* Web Site: http://www.dynamsoft.com
*
* Copyright 2019, Dynamsoft Corporation
* Author: Dynamsoft Support Team
* Version: 14.3.1
*/
/**
* @namespace Dynamsoft
*/
declare namespace Dynamsoft {
let Lib: DynamsoftLib
let WebTwainEnv: dwtEnv
namespace WebTwain {
namespace Addon {
let OCRPro: OCRProAddon
}
}
namespace DWT {
let defaultEnv: dwtEnv
}
}
declare const dwt: WebTwain;
interface dwtEnv {
ActiveXInstallWithCAB: boolean;
ActiveXVersion: string;
AutoLoad: boolean;
CloseDialog(): void;
ContainerMap: {};
Containers: Container[];
CreateDWTObject(newObjID: string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void;
CreateDWTObject(newObjID: string, ip: number | string, port: number | string, portSSL: number | string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void;
Debug: boolean;
DeleteDWTObject(objID: string): void;
DynamicContainers: string[];
DynamicDWTMap: {};
GetWebTwain(cid: string): WebTwain;
IfUpdateService: boolean;
IfUseActiveXForIE10Plus: boolean;
JSVersion: string;
Load(): void;
/*ignored
OnWebTwainInitMessage OnWebTwainNeedUpgrade OnWebTwainNeedUpgradeWebJavascript OnWebTwainNotFound OnWebTwainOldPluginNotAllowed
*/
OnWebTwainPostExecute(): void;
OnWebTwainPreExecute(): void;
/*ignored
OnWebTwainReady
*/
PluginVersion: string;
ProductKey: string;
RegisterEvent(event: string, fn: (...args: any[]) => void): void;
RemoveAllAuthorizations(): void;
ResourcesPath: string;
ServerVersionInfo: string;
ShowDialog(_dialogWidth: number, _dialogHeight: number, _strDialogMessageWithHtmlFormat: string, _bChangeImage: boolean, bHideCloseButton: boolean): void;
Trial: boolean;
Unload(): void;
UseDefaultInstallUI: boolean;
initQueue: any[];
inited: boolean;
}
interface DynamsoftLib {
/*ignored
Addon_Events Addon_Sendback_Events AttachAndShowImage BIO DOM DynamicLoadAddonFuns DynamicWebTwain EnumMouseButton
Errors Events IntToColorStr LS OnGetImageByURL OnGetImageFromServer Path ProgressBar UI Uri
addEventListener ajax all appendMessage appendRichMessage aryControlLoadImage attachAddon attachProperty
base64 bio cancelFrome clearMessage closeAll closeProgress colorStrToInt config css currentStyle
debug*/
detect: {
/*ignored
OnCreatWS OnDetectNext OnWebTwainPostExecute OnWebTwainPreExecute StartWSByIPTimeoutId StartWSTimeoutId
aryReconnectSTwains arySTwains arySTwainsByIP bFirst bNeedUpgradeEvent bNoControlEvent bOK bPromptJSOrServerOutdated
cUrlIndex dcpCallbackType dcpStatus detectType getVersionArray global_dlg hideMask isDWTVersionLatest onNoControl
onNotAllowedForChrome ports scriptLoaded showMask starting tryTimes*/
ssl: boolean;
}
/*ignored
detectButton dialog dialogShowStatus dlgProgress dlgRef drawBoxBorder drawImageWithHermite
each empty endsWith
*/
env: {
WSSession: number, WSVersion: string,
bChrome: boolean, bEdge: boolean, bFileSystem: boolean, bFirefox: boolean,
bIE: boolean, bLinux: boolean, bMac: boolean, bSafari: boolean, bWin: boolean, bWin64: boolean,
basePath: string, iPluginLength: number, isX64: boolean, pathType: number,
strChromeVersion: string, strFirefoxVersion: string, strIEVersion: string
}
/*ignored
error escapeHtml escapeRegExp extend filter fireEvent fromUnicode get getColor getCss
getElDimensions getHex getHexColor getHttpUrl getLogger getOffset getRandom getRealPath getScript
getWS getWSUrl getWheelDelta globalEval guid hide html5 imageControlCount indexOf install
io isArray isBoolean isDef isFunction isLocalIP isNaN isNull isNumber isObject
isPlainObject isString isUndef isUndefined isWindow keys log main makeArray mix
needShowTwiceShowDialog nil noop now obj one page param parse parseHTML parser
product progressMessage ready removeEventListener replaceAll replaceControl show showProgress startWS
startWSByIP startsWith stopPropagation stringify style support switchEvent tmp toggle trim
type unEscapeHtml unparam upperCaseFirst urlDecode urlEncode utf8 win
...other internal ones
*/
hideMask(): void;
showMask(): void;
}
/**
* interface for a DWT container which basically defines a DIV on the page
*/
interface Container {
ContainerId: string;
Width: string | number;
Height: string | number;
}
+182
View File
@@ -0,0 +1,182 @@
// Type definitions for dwt 14.3.1
// 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>
// Tom Kent <https://github.com/Tom-Dynamsoft>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.2.2
/*!
* Product: Dynamsoft Web Twain
* Web Site: http://www.dynamsoft.com
*
* Copyright 2019, Dynamsoft Corporation
* Author: Dynamsoft Support Team
*/
interface Redaction {
FindText: string,
FindTextFlags: EnumDWT_OCRFindTextFlags.OCRFT_WHOLEWORD;
FindTextAction: EnumDWT_OCRFindTextAction.OCRFT_MARKFORREDACT;
}
interface OCRZone {
left: number,
top: number,
right: number,
bottom: number
}
interface OCRReadPara {
STWAIN: WebTwain,
AjaxFunctionUrl: string,
FunctionName: string,
ImageIndex: number,
FileNames: string,
Type: string,
AryZone: number[],
JsonString: string,
OnSuccess(): void,
OnFailure(): void
}
interface OCRError {
responseText: string,
errorString: string
}
interface Settings {
RecognitionModule: string,
Languages: string
OutputFormat: EnumDWT_OCRProOutputFormat,
PDFVersion: EnumDWT_OCRProPDFVersion,
PDFAVersion: EnumDWT_OCRProPDFAVersion,
LicenseChecker: string,
Redaction: Redaction
}
interface DynamsoftLib {
NewRedaction(): Redaction,
NewOCRReadPara(): OCRReadPara,
NewOCRZone(): OCRZone
}
interface OCRProAddon {
NewOCRError(): OCRError,
NewOCRReadPara(): OCRReadPara,
NewOCRZone(): OCRZone,
NewSettings(): Settings
}
declare enum EnumDWT_OCRFindTextFlags {
OCRFT_WHOLEWORD = 1,
OCRFT_MATCHCASE = 2,
OCRFT_FUZZYMATCH = 4
}
declare enum EnumDWT_OCRFindTextAction {
OCRFT_HIGHLIGHT = 0,
OCRFT_STRIKEOUT = 1,
OCRFT_MARKFORREDACT = 2
}
declare enum EnumDWT_OCRProOutputFormat {
OCRPFT_IOTPDF = "IOTPDF",
OCRPFT_IOTPDF_MRC = "IOTPDF_MRC",
OCRPFT_TXTCSV = "TXTCSV",
OCRPFT_TXTF = "TXTF",
OCRPFT_TXTS = "TXTS",
OCRPFT_XML = "XML"
}
declare enum EnumDWT_OCRProPDFAVersion {
OCRPPDFAV_1A = "pdf/a-1a",
OCRPPDFAV_1B = "pdf/a-1b",
OCRPPDFAV_2A = "pdf/a-2a",
OCRPPDFAV_2B = "pdf/a-2b",
OCRPPDFAV_2U = "pdf/a-2u",
OCRPPDFAV_3A = "pdf/a-3a",
OCRPPDFAV_3B = "pdf/a-3b",
OCRPPDFAV_3U = "pdf/a-3u"
}
declare enum EnumDWT_OCRProPDFVersion {
OCRPPDFV_0 = "1.0",
OCRPPDFV_1 = "1.1",
OCRPPDFV_2 = "1.2",
OCRPPDFV_3 = "1.3",
OCRPPDFV_4 = "1.4",
OCRPPDFV_5 = "1.5",
OCRPPDFV_6 = "1.6",
OCRPPDFV_7 = "1.7"
}
declare enum EnumDWT_OCRProRecognitionModule {
OCRPM_AUTO = "AUTO",
OCRPM_MOSTACCURATE = "MOSTACCURATE",
OCRPM_BALANCED = "BALANCED",
OCRPM_FASTEST = "FASTEST"
}
declare enum EnumDWT_OCRProType {
OCRDT_File = 0,
OCRDT_Index = 1
}
interface OCRPro {
/**
* Returns whether OCR Pro addon is installed
* @return {boolean}
*/
IsModuleInstalled(): boolean
/**
* Downloads and installs the ocr add-on on the local system.
* @param {string} remoteFile specifies the URL to download a ZIP which contains the OCR Pro addon
* @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 {void}
*/
Download(remoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
/**
* Performs OCR on a given image.
* @param {number} sImageIndex Specifies the index of the image.
* @param {function} AsyncSuccessFunc The function to call when OCR operation succeeds. Please refer to the function prototype OnOCRSuccess.
* @param {function} AsyncFailureFunc The function to call when OCR operation fails. Please refer to the function prototype OnOCRFailure.
* @return {void}
*/
Recognize(sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
/**
* Performs OCR on one or multiple specified local file(s) directly.
* @param {string} fileNames Specifies the local paths of the target files. If multiple files are given, they should be separated by the '|' character.
* @param {function} AsyncSuccessFunc The function to call when OCR operation succeeds. Please refer to the function prototype OnOCRSuccess.
* @param {function} AsyncFailureFunc The function to call when OCR operation fails. Please refer to the function prototype OnOCRFailure.
* @return {void}
*/
RecognizeFile(fileNames: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
/**
* Peforms OCR on the given rectangle on a specified image.
* @param {number} sImageIndex Specifies the index of the image.
* @param {number[]} aryZone specifies the coordinates of the rectangle.
* @param {function} AsyncSuccessFunc The function to call when OCR operation succeeds. Please refer to the function prototype OnOCRSuccess.
* @param {function} AsyncFailureFunc The function to call when OCR operation fails. Please refer to the function prototype OnOCRFailure.
* @return {void}
*/
RecognizeRect(sImageIndex: number, aryZone: number[], optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
/**
* Performs OCR on the currently selected images in the buffer.
* @param {function} AsyncSuccessFunc The function to call when OCR operation succeeds. Please refer to the function prototype OnOCRSuccess.
* @param {function} AsyncFailureFunc The function to call when OCR operation fails. Please refer to the function prototype OnOCRFailure.
* @return {void}
*/
RecognizeSelectedImages(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
}
interface WebTwainAddon {
OCRPro: OCRPro;
}
+3701
View File
File diff suppressed because it is too large Load Diff
+7 -3774
View File
File diff suppressed because it is too large Load Diff