mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
v14.3.1 (#35615)
* fix bugs with types * fixed type errors * more type errors fixed * fixed errors and added missing type definitions * fix all typos and added all missing ones * change inappropriate names * Updated names to be more accurate. * adds EnumDWT_ConvertMode to make compatible with the old enum * update to 14.2 * add v13 * delete v13 for test not pass * remove base64 * fixed conflict * add back GetLicenseInfo * change header version to 14.2 * Added definitions for new APIs as well as APIs whose definitions were missing before. Also adding APIs for addons * remove unused file * adding types for barcode reader and changing the copyright year * comment change, TS to 3.2.2 * adds more definitions to dwt barcode reader * rollback * update * update index.d.ts * Update Dynamsoft.d.ts It's ok * Update index.d.ts 1. update 2017 -> 2019 2. update parameters * Update index.d.ts rollback * Update index.d.ts rollback * Update addon.pdf.ts rollback * Update index.d.ts rollback * Update index.d.ts rollback * Update index.d.ts rollback * Update index.d.ts rollback * Update index.d.ts no changes but whites * Update index.d.ts TypeScript Version can be 3.2 2017 => 2019 * Update index.d.ts rollback * update * Update index.d.ts start new request * Update index.d.ts delete this file * Update delete this file * a a * rollback * update * remove package.json * add current version to v13 * 1) update to version 14.3.1 2) change index.d.ts declare Dynamsoft * update comments * remove WebTWAIN.d.ts * change v13 tsconfig.json * change to v14.3.1 * change to v14.3.1 * change to version 14.3 * change to version 14.3 * update * update * Update index.d.ts * Update index.d.ts * Update tsconfig.json * Update tsconfig.json * update * update * aa * a * a * update * remove dwt.d.ts * remove v12 * update1 * update * update * a * a * a * a * a * a * a * a * d * a * a * b * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d * d
This commit is contained in:
parent
3efd8e7833
commit
7c60c01ab5
3742
types/dwt/Dynamsoft.d.ts
vendored
3742
types/dwt/Dynamsoft.d.ts
vendored
File diff suppressed because it is too large
Load Diff
16
types/dwt/README.md
Normal file
16
types/dwt/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Installation
|
||||
> `npm install --save @types/dwt`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for DWT and its add-ons(http://www.dynamsoft.com/Products/WebTWAIN_Overview.aspx).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dwt
|
||||
|
||||
Additional Details
|
||||
* Last updated: 15 Jan 2019 17:34:42 GMT
|
||||
* Dependencies: none
|
||||
* Global values: dynamsoft, Dynamsoft, EnumDWT_BorderStyle, EnumDWT_Cap, EnumDWT_CapBitOrder, EnumDWT_CapBitdepthReduction, EnumDWT_CapFeederAlignment, EnumDWT_CapFeederOrder, EnumDWT_CapFilterType, EnumDWT_CapFlash, EnumDWT_CapFlipRotation, EnumDWT_CapImageFilter, EnumDWT_CapLanguage, EnumDWT_CapLightPath, EnumDWT_CapLightSource, EnumDWT_CapNoiseFilter, EnumDWT_CapORientation, EnumDWT_CapOverscan, EnumDWT_CapPixelFlavor, EnumDWT_CapPlanarChunky, EnumDWT_CapPrinter, EnumDWT_CapPrinterMode, EnumDWT_CapSupportedSizes, EnumDWT_CapType, EnumDWT_CapValueType, EnumDWT_ConverMode, EnumDWT_ConvertMode, EnumDWT_DUPLEX, EnumDWT_DataSourceStatus, EnumDWT_Error, EnumDWT_FileFormat, EnumDWT_FitWindowType, EnumDWT_ImageType, EnumDWT_InitMsg, EnumDWT_InterpolationMethod, EnumDWT_Language, EnumDWT_MagType, EnumDWT_MessageType, EnumDWT_MouseShape, EnumDWT_PDFCompressionType, EnumDWT_PixelType, EnumDWT_PlatformType, EnumDWT_ShowMode, EnumDWT_TIFFCompressionType, EnumDWT_TransferMode, EnumDWT_UnitType, EnumDWT_UploadDataFormat, etc.
|
||||
|
||||
# Credits
|
||||
These definitions were written 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>.
|
||||
14
types/dwt/addon.ocr.d.ts
vendored
14
types/dwt/addon.ocr.d.ts
vendored
@ -1,3 +1,15 @@
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
/*!
|
||||
* Product: Dynamsoft Web Twain
|
||||
* Web Site: http://www.dynamsoft.com
|
||||
*
|
||||
* Copyright 2019, Dynamsoft Corporation
|
||||
* Author: Dynamsoft Support Team
|
||||
*/
|
||||
|
||||
declare enum EnumDWT_OCRLanguage {
|
||||
OCRL_ENG = "eng",
|
||||
OCRL_ARA = "ara",
|
||||
@ -187,6 +199,6 @@ interface OCR {
|
||||
SetOutputFormat(value: EnumDWT_OCROutputFormat): void;
|
||||
}
|
||||
|
||||
interface WebTwainAddon {
|
||||
interface DynamsoftWebTwainAddon {
|
||||
OCR: OCR;
|
||||
}
|
||||
|
||||
26
types/dwt/addon.ocrp.d.ts
vendored
26
types/dwt/addon.ocrp.d.ts
vendored
@ -1,3 +1,15 @@
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
/*!
|
||||
* 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;
|
||||
@ -45,13 +57,6 @@ interface DynamsoftLib {
|
||||
NewOCRZone(): OCRZone;
|
||||
}
|
||||
|
||||
interface OCRProAddon {
|
||||
NewOCRError(): OCRError;
|
||||
NewOCRReadPara(): OCRReadPara;
|
||||
NewOCRZone(): OCRZone;
|
||||
NewSettings(): Settings;
|
||||
}
|
||||
|
||||
declare enum EnumDWT_OCRFindTextFlags {
|
||||
OCRFT_WHOLEWORD = 1,
|
||||
OCRFT_MATCHCASE = 2,
|
||||
@ -157,8 +162,13 @@ interface OCRPro {
|
||||
* @return {void}
|
||||
*/
|
||||
RecognizeSelectedImages(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
|
||||
|
||||
NewOCRError(): OCRError;
|
||||
NewOCRReadPara(): OCRReadPara;
|
||||
NewOCRZone(): OCRZone;
|
||||
NewSettings(): Settings;
|
||||
}
|
||||
|
||||
interface WebTwainAddon {
|
||||
interface DynamsoftWebTwainAddon {
|
||||
OCRPro: OCRPro;
|
||||
}
|
||||
|
||||
14
types/dwt/addon.pdf.d.ts
vendored
14
types/dwt/addon.pdf.d.ts
vendored
@ -1,3 +1,15 @@
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
/*!
|
||||
* Product: Dynamsoft Web Twain
|
||||
* Web Site: http://www.dynamsoft.com
|
||||
*
|
||||
* Copyright 2019, Dynamsoft Corporation
|
||||
* Author: Dynamsoft Support Team
|
||||
*/
|
||||
|
||||
declare enum EnumDWT_ConvertMode {
|
||||
CM_DEFAULT = 0,
|
||||
CM_RENDERALL = 1
|
||||
@ -59,6 +71,6 @@ interface PDF {
|
||||
IsTextBasedPDF(localFile: string): boolean;
|
||||
}
|
||||
|
||||
interface WebTwainAddon {
|
||||
interface DynamsoftWebTwainAddon {
|
||||
PDF: PDF;
|
||||
}
|
||||
|
||||
14
types/dwt/addon.webcam.d.ts
vendored
14
types/dwt/addon.webcam.d.ts
vendored
@ -1,3 +1,15 @@
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
/*!
|
||||
* Product: Dynamsoft Web Twain
|
||||
* Web Site: http://www.dynamsoft.com
|
||||
*
|
||||
* Copyright 2019, Dynamsoft Corporation
|
||||
* Author: Dynamsoft Support Team
|
||||
*/
|
||||
|
||||
/** -2400 to -2499 is webcam error code */
|
||||
declare enum EnumDWT_ErrorCode {
|
||||
/** All error from directshow sdk */
|
||||
@ -329,6 +341,6 @@ interface Webcam {
|
||||
SetCameraControlPropertySetting(property: EnumDWT_CameraControlProperty, value: number, auto: boolean): boolean;
|
||||
}
|
||||
|
||||
interface WebTwainAddon {
|
||||
interface DynamsoftWebTwainAddon {
|
||||
Webcam: Webcam;
|
||||
}
|
||||
|
||||
64
types/dwt/dbr.d.ts
vendored
64
types/dwt/dbr.d.ts
vendored
@ -1,3 +1,15 @@
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
/*!
|
||||
* Product: Dynamsoft Web Twain
|
||||
* Web Site: http://www.dynamsoft.com
|
||||
*
|
||||
* Copyright 2019, Dynamsoft Corporation
|
||||
* Author: Dynamsoft Support Team
|
||||
*/
|
||||
|
||||
interface RunTimeSetting {
|
||||
mAntiDamageLevel: number;
|
||||
mBarcodeFormatIds: number;
|
||||
@ -30,18 +42,13 @@ interface dbrEnv {
|
||||
onAutoConnectServiceError(status: any): void;
|
||||
}
|
||||
|
||||
interface TaskQueue {
|
||||
push(task: (bLoadingWhenPush: boolean) => void, context?: any, args?: []): void;
|
||||
unshift(task: (bLoadingWhenPush: boolean) => void, context?: any, args?: []): void;
|
||||
next(): void;
|
||||
}
|
||||
|
||||
declare namespace dynamsoft {
|
||||
let TaskQueue: TaskQueue;
|
||||
let dbrEnv: dbrEnv;
|
||||
/**dbrMasterPage20170526 */
|
||||
let dcp: {
|
||||
ifCheck64bitServiceFirst: boolean;
|
||||
};
|
||||
/**dwtDbrDemo20170613 */
|
||||
let initOrder: any;
|
||||
let lib: any;
|
||||
let managerEnv: any;
|
||||
let navInfo: any;
|
||||
namespace BarcodeReader {
|
||||
/** Barcode Formats */
|
||||
enum EnumBarcodeFormat {
|
||||
@ -104,10 +111,12 @@ declare namespace dynamsoft {
|
||||
DBR_RESERVEDINFO_NOT_MATCHED = -10040,
|
||||
DBR_DBRERR_AZTEC_LICENSE_INVALID = -10041
|
||||
}
|
||||
|
||||
enum EnumConflictMode {
|
||||
ECM_Ignore = 1,
|
||||
ECM_Overwrite = 2
|
||||
}
|
||||
|
||||
enum EnumImagePixelFormat {
|
||||
IPF_Binary = 0,
|
||||
IPF_BinaryInverted = 1,
|
||||
@ -118,27 +127,35 @@ declare namespace dynamsoft {
|
||||
IPF_RGB_888 = 6,
|
||||
IPF_ARGB_8888 = 7
|
||||
}
|
||||
|
||||
enum EnumResultType {
|
||||
EDT_CandidateText = 2,
|
||||
EDT_PartialText = 3,
|
||||
EDT_RawText = 1,
|
||||
EDT_StandardText = 0
|
||||
}
|
||||
|
||||
enum EnumTerminateStage {
|
||||
ETS_Localized = 1,
|
||||
ETS_Prelocalized = 0,
|
||||
ETS_Recognized = 2
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class BarcodeReader {
|
||||
/**
|
||||
* Constructs a new KPainter
|
||||
*/
|
||||
constructor(dbrKey?: string);
|
||||
|
||||
static BarcodeReaderException(): any;
|
||||
static initServiceConnection(): Promise<any>;
|
||||
static name: string;
|
||||
static length: number;
|
||||
static version: string;
|
||||
|
||||
// appendTplStringToRuntimeSettings(b, d):
|
||||
/**
|
||||
/**
|
||||
* Read barcode from the source image.
|
||||
* @method BarcodeReader#decode
|
||||
* @param {string} source specifies the image to read on
|
||||
@ -169,7 +186,8 @@ declare namespace dynamsoft {
|
||||
// ie6-9 does not support '.catch(function(ex){...})'
|
||||
if(ex){alert(ex.message||ex);}
|
||||
});
|
||||
```
|
||||
```
|
||||
|
||||
*/
|
||||
decode(source: string): Promise<any>;
|
||||
|
||||
@ -184,9 +202,17 @@ declare namespace dynamsoft {
|
||||
outputSettingsToString(): any;
|
||||
resetRuntimeSettings(): void;
|
||||
updateRuntimeSettings(setting: RunTimeSetting): void;
|
||||
/**
|
||||
* Constructs a new barcode reader
|
||||
*/
|
||||
constructor(dbrKey?: string);
|
||||
}
|
||||
|
||||
let TaskQueue: TaskQueue;
|
||||
let dbrEnv: dbrEnv;
|
||||
/**dbrMasterPage20170526 */
|
||||
let dcp: {
|
||||
ifCheck64bitServiceFirst: boolean;
|
||||
};
|
||||
/**dwtDbrDemo20170613 */
|
||||
let initOrder: any;
|
||||
let lib: any;
|
||||
let managerEnv: any;
|
||||
let navInfo: any;
|
||||
}
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
import * as Dynamsoft from 'dwt';
|
||||
|
||||
function dwtOnReady() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
|
||||
if (DWObject) {
|
||||
|
||||
20
types/dwt/index.d.ts
vendored
20
types/dwt/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for dwt 14.4
|
||||
// Type definitions for dwt 14.3
|
||||
// Project: https://www.dynamsoft.com/products/webtwain_overview.aspx
|
||||
// Definitions by: Xiao Ling <https://github.com/yushulx>
|
||||
// Josh Hall <https://github.com/jbh>
|
||||
@ -6,13 +6,25 @@
|
||||
// Tom Kent <https://github.com/Tom-Dynamsoft>
|
||||
// Dave Sueltenfuss <https://github.com/dsueltenfuss>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
// TypeScript Version: 3.1
|
||||
|
||||
/// <reference path="Dynamsoft.d.ts" />
|
||||
/// <reference path="addon.ocr.d.ts" />
|
||||
/// <reference path="addon.ocrp.d.ts" />
|
||||
/// <reference path="addon.pdf.d.ts" />
|
||||
/// <reference path="addon.webcam.d.ts" />
|
||||
/// <reference path="dbr.d.ts" />
|
||||
/// <reference path="dwt.d.ts" />
|
||||
/// <reference path="Dynamsoft.d.ts" />
|
||||
/// <reference path="mbc.d.ts" />
|
||||
|
||||
/*!
|
||||
* 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
|
||||
*/
|
||||
|
||||
declare const Dynamsoft: DynamsoftStatic;
|
||||
export = Dynamsoft;
|
||||
|
||||
401
types/dwt/mbc.d.ts
vendored
401
types/dwt/mbc.d.ts
vendored
@ -1,23 +1,43 @@
|
||||
/**`constructor` MBC()
|
||||
* Syntax:* `new MBC(license)`
|
||||
* | parameter | type | description |
|
||||
* | | | |
|
||||
* | license | `String` | |
|
||||
* example:*
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
/*!
|
||||
* Product: Dynamsoft Web Twain
|
||||
* Web Site: http://www.dynamsoft.com
|
||||
*
|
||||
* Copyright 2019, Dynamsoft Corporation
|
||||
* Author: Dynamsoft Support Team
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
## `constructor` MBC()
|
||||
|
||||
*Syntax:* `new MBC(license)`
|
||||
|
||||
| parameter | type | description |
|
||||
| | | |
|
||||
| license | `String` | |
|
||||
|
||||
*example:*
|
||||
```javascript
|
||||
// MBC without a license can be used for evaluation purposes. It is not stable for long time usage.
|
||||
var painter = new MBC();
|
||||
// MBC need a license in production environments.
|
||||
painter = new MBC('xxxxx');
|
||||
// MBC without a license can be used for evaluation purposes. It is not stable for long time usage.
|
||||
var painter = new MBC();
|
||||
// MBC need a license in production environments.
|
||||
painter = new MBC('xxxxx');
|
||||
```
|
||||
*/
|
||||
declare namespace MBC {
|
||||
*/
|
||||
|
||||
// export = KPainter;
|
||||
|
||||
declare class MBC {
|
||||
/**
|
||||
* Tell this painter the directory where you place`cv-wasm.js` and`cv-wasm.wasm`.
|
||||
|
||||
* Syntax:* `MBC.cvFolder = 'js';`
|
||||
*/
|
||||
let cvFolder: string;
|
||||
cvFolder: string;
|
||||
|
||||
/**
|
||||
* You should call`MBC.loadCvScriptAsync()` first before use`Free Transform` and`Brush` module.
|
||||
@ -30,17 +50,17 @@ declare namespace MBC {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
MBC.loadCvScriptAsync(function(bSuccess){
|
||||
if(bSuccess){
|
||||
console.log('load cv script success.');
|
||||
painter.enterFreeTransformModeAsync();
|
||||
}else{
|
||||
console.log('load cv script fail.');
|
||||
}
|
||||
});
|
||||
MBC.loadCvScriptAsync(function(bSuccess){
|
||||
if(bSuccess){
|
||||
console.log('load cv script success.');
|
||||
painter.enterFreeTransformModeAsync();
|
||||
}else{
|
||||
console.log('load cv script fail.');
|
||||
}
|
||||
});
|
||||
```
|
||||
*/
|
||||
function loadCvScriptAsync(): any;
|
||||
loadCvScriptAsync: () => void;
|
||||
}
|
||||
|
||||
interface rectangle {
|
||||
@ -62,34 +82,22 @@ interface cornerPoints {
|
||||
rightBottom: point;
|
||||
}
|
||||
|
||||
declare class TaskQueue {
|
||||
_queue: any[];
|
||||
isWorking: boolean;
|
||||
timeout: number;
|
||||
/**
|
||||
* Constructs a new task queue
|
||||
*/
|
||||
constructor();
|
||||
}
|
||||
|
||||
interface TaskQueue {
|
||||
push(task: any, context?: any, args?: any): void;
|
||||
unshift(task: any, context?: any, args?: any): void;
|
||||
push(task: (bLoadingWhenPush: boolean) => void, context?: any, args?: []): void;
|
||||
unshift(task: (bLoadingWhenPush: boolean) => void, context?: any, args?: []): void;
|
||||
next(): void;
|
||||
}
|
||||
|
||||
declare class KPainter {
|
||||
/**
|
||||
* Constructs a new KPainter
|
||||
*/
|
||||
constructor(mbcKey?: string);
|
||||
declare function KPainter(mbcKey?: string): void;
|
||||
|
||||
interface KPainter {
|
||||
/**
|
||||
* @example
|
||||
```javascript
|
||||
var painterDom = painter.getHtmlElement();
|
||||
painterDom.style.width = '100%';
|
||||
painterDom.style.height = '100%';
|
||||
document.getElementById('painter-container').appendChild(painterDom);
|
||||
var painterDom = painter.getHtmlElement();
|
||||
painterDom.style.width = '100%';
|
||||
painterDom.style.height = '100%';
|
||||
document.getElementById('painter-container').appendChild(painterDom);
|
||||
```
|
||||
*
|
||||
*/
|
||||
@ -112,15 +120,14 @@ declare class KPainter {
|
||||
|
||||
/**
|
||||
*
|
||||
@example
|
||||
```javascript
|
||||
// A way to access to inner data. Don't modify it if you are not sure.
|
||||
var imgOri = painter.getImage(true);
|
||||
// This image can be used in any place and free to modify it.
|
||||
var imgCopyed = painter.getImage();
|
||||
imgCopyed.style.width = '100px';
|
||||
imgCopyed.style.height = '100px';
|
||||
document.getElementById('image-container').appendChild(imgCopyed);
|
||||
@example```javascript
|
||||
// A way to access to inner data. Don't modify it if you are not sure.
|
||||
var imgOri = painter.getImage(true);
|
||||
// This image can be used in any place and free to modify it.
|
||||
var imgCopyed = painter.getImage();
|
||||
imgCopyed.style.width = '100px';
|
||||
imgCopyed.style.height = '100px';
|
||||
document.getElementById('image-container').appendChild(imgCopyed);
|
||||
```
|
||||
*/
|
||||
getImage(isOri: boolean, index: number): HTMLImageElement;
|
||||
@ -128,11 +135,10 @@ declare class KPainter {
|
||||
/**
|
||||
* Binding a function that would be called when starting an expensive operation.
|
||||
* Syntax:* `function(){}`
|
||||
@example
|
||||
```javascript
|
||||
painter.onStartLoading = function(){
|
||||
document.getElementById('animation').show();
|
||||
};
|
||||
@example```javascript
|
||||
painter.onStartLoading = function(){
|
||||
document.getElementById('animation').show();
|
||||
};
|
||||
```
|
||||
*/
|
||||
onStartLoading: () => void;
|
||||
@ -150,15 +156,14 @@ declare class KPainter {
|
||||
*/
|
||||
onFinishLoading: () => void;
|
||||
|
||||
// Image Store
|
||||
|
||||
// # Image Store
|
||||
/**
|
||||
* Show file choose window by click the hidden file input.Can't process during `Editing` mode.
|
||||
* @example
|
||||
```javascript
|
||||
document.getElementById('btn-add-image').addEventListener('click', function(){
|
||||
painter.showFileChooseWindow();
|
||||
});
|
||||
document.getElementById('btn-add-image').addEventListener('click', function(){
|
||||
painter.showFileChooseWindow();
|
||||
});
|
||||
```
|
||||
*/
|
||||
showFileChooseWindow(): boolean;
|
||||
@ -166,10 +171,10 @@ declare class KPainter {
|
||||
/**
|
||||
* @example
|
||||
```javascript
|
||||
// warning: never redefine it if you are not sure
|
||||
// painter.defaultFileInput = document.createElement('input');
|
||||
painter.defaultFileInput.accept = "image/png";
|
||||
painter.defaultFileInput.multiple = false;
|
||||
// warning: never redefine it if you are not sure
|
||||
// painter.defaultFileInput = document.createElement('input');
|
||||
painter.defaultFileInput.accept = "image/png";
|
||||
painter.defaultFileInput.multiple = false;
|
||||
```
|
||||
*/
|
||||
defaultFileInput: HTMLInputElement;
|
||||
@ -181,20 +186,20 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
painter.beforeAddImgFromFileChooseWindow = function(ev, callback){
|
||||
var files = ev.target.files;
|
||||
var newBlobs = [];
|
||||
var finishedIndex = 0;
|
||||
for(var i = 0; i < files.length; ++i){
|
||||
var file = files[i];
|
||||
doSomeWorkToGetANewBlob(file, function(blob){
|
||||
newBlobs.push(blob);
|
||||
if(files.length == ++finishedIndex){
|
||||
callback(newBlobs);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
painter.beforeAddImgFromFileChooseWindow = function(ev, callback){
|
||||
var files = ev.target.files;
|
||||
var newBlobs = [];
|
||||
var finishedIndex = 0;
|
||||
for(var i = 0; i < files.length; ++i){
|
||||
var file = files[i];
|
||||
doSomeWorkToGetANewBlob(file, function(blob){
|
||||
newBlobs.push(blob);
|
||||
if(files.length == ++finishedIndex){
|
||||
callback(newBlobs);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
```
|
||||
*/
|
||||
beforeAddImgFromFileChooseWindow: () => void;
|
||||
@ -206,9 +211,9 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
painter.afterAddImgFromFileChooseWindow = function(bSuccess){
|
||||
if(bSuccess){console.log('The new image(s) has been added from file choose window.');}
|
||||
};
|
||||
painter.afterAddImgFromFileChooseWindow = function(bSuccess){
|
||||
if(bSuccess){console.log('The new image(s) has been added from file choose window.');}
|
||||
};
|
||||
```
|
||||
*/
|
||||
afterAddImgFromFileChooseWindow: () => void;
|
||||
@ -217,20 +222,20 @@ declare class KPainter {
|
||||
* Syntax:* `function(event, callback){}`
|
||||
@example
|
||||
```javascript
|
||||
painter.beforeAddImgFromDropFile = function(ev, callback){
|
||||
var files = ev.dataTransfer.files;
|
||||
var newBlobs = [];
|
||||
var finishedIndex = 0;
|
||||
for(var i = 0; i < files.length; ++i){
|
||||
var file = files[i];
|
||||
doSomeWorkToGetANewBlob(file, function(blob){
|
||||
newBlobs.push(blob);
|
||||
if(files.length == ++finishedIndex){
|
||||
callback(newBlobs);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
painter.beforeAddImgFromDropFile = function(ev, callback){
|
||||
var files = ev.dataTransfer.files;
|
||||
var newBlobs = [];
|
||||
var finishedIndex = 0;
|
||||
for(var i = 0; i < files.length; ++i){
|
||||
var file = files[i];
|
||||
doSomeWorkToGetANewBlob(file, function(blob){
|
||||
newBlobs.push(blob);
|
||||
if(files.length == ++finishedIndex){
|
||||
callback(newBlobs);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
```
|
||||
*/
|
||||
beforeAddImgFromDropFile: () => any;
|
||||
@ -241,9 +246,9 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
painter.afterAddImgFromDropFile = function(bSuccess){
|
||||
if(bSuccess){console.log('The new image(s) has been added from dropping.');}
|
||||
};
|
||||
painter.afterAddImgFromDropFile = function(bSuccess){
|
||||
if(bSuccess){console.log('The new image(s) has been added from dropping.');}
|
||||
};
|
||||
```
|
||||
*
|
||||
*/
|
||||
@ -259,9 +264,9 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
painter.addImageAsync(image, function(bSuccess){
|
||||
console.log('Add success');
|
||||
});
|
||||
painter.addImageAsync(image, function(bSuccess){
|
||||
console.log('Add success');
|
||||
});
|
||||
```
|
||||
*/
|
||||
addImageAsync(imgData: Blob | HTMLCanvasElement | HTMLImageElement | string | string[], callback?: () => void): void;
|
||||
@ -292,11 +297,11 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
window.addEventListener('resize',function(){
|
||||
painter.updateUIOnResize(true, function(){
|
||||
console.log('painter update');
|
||||
});
|
||||
window.addEventListener('resize',function(){
|
||||
painter.updateUIOnResize(true, function(){
|
||||
console.log('painter update');
|
||||
});
|
||||
});
|
||||
```
|
||||
*/
|
||||
updateUIOnResize(isLazy?: boolean, callback?: () => void): void;
|
||||
@ -308,9 +313,9 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
painter.onNumChange = function(curIndex, length){
|
||||
console.log('curIndex: '+curIndex+', length:'+length);
|
||||
};
|
||||
painter.onNumChange = function(curIndex, length){
|
||||
console.log('curIndex: '+curIndex+', length:'+length);
|
||||
};
|
||||
```
|
||||
*/
|
||||
onNumChange: (curIndex: number, length: number) => void;
|
||||
@ -327,21 +332,21 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
document.getElementById('btn-first').addEventListener('click', function(){
|
||||
painter.changePage('f');
|
||||
});
|
||||
document.getElementById('btn-pre').addEventListener('click', function(){
|
||||
painter.changePage('p');
|
||||
});
|
||||
document.getElementById('btn-next').addEventListener('click', function(){
|
||||
painter.changePage('n');
|
||||
});
|
||||
document.getElementById('btn-last').addEventListener('click', function(){
|
||||
painter.changePage('l');
|
||||
});
|
||||
document.getElementById('btn-toThisPage').addEventListener('click', function(){
|
||||
painter.changePage(parseInt(document.getElementById('ipt-page').value));
|
||||
});
|
||||
document.getElementById('btn-first').addEventListener('click', function(){
|
||||
painter.changePage('f');
|
||||
});
|
||||
document.getElementById('btn-pre').addEventListener('click', function(){
|
||||
painter.changePage('p');
|
||||
});
|
||||
document.getElementById('btn-next').addEventListener('click', function(){
|
||||
painter.changePage('n');
|
||||
});
|
||||
document.getElementById('btn-last').addEventListener('click', function(){
|
||||
painter.changePage('l');
|
||||
});
|
||||
document.getElementById('btn-toThisPage').addEventListener('click', function(){
|
||||
painter.changePage(parseInt(document.getElementById('ipt-page').value));
|
||||
});
|
||||
```
|
||||
*/
|
||||
changePage(cmd: number | string): boolean;
|
||||
@ -408,11 +413,11 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
document.getElementById('btn-download').addEventListener('click', function(){
|
||||
for(var i = 0; i < painter.getCount(); ++i){
|
||||
painter.download(null, i);
|
||||
}
|
||||
});
|
||||
document.getElementById('btn-download').addEventListener('click', function(){
|
||||
for(var i = 0; i < painter.getCount(); ++i){
|
||||
painter.download(null, i);
|
||||
}
|
||||
});
|
||||
```
|
||||
*/
|
||||
download(filename?: string, index?: number): number;
|
||||
@ -429,17 +434,17 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
painter.bindThumbnailBox(document.getElementById('div-thumbnailContainer'), function(cvs){
|
||||
console.log(cvs.className);// 'kPainterThumbnailCanvas', never remove this class
|
||||
var box = document.createElement('div');
|
||||
box.className = 'div-thumbnailBox';
|
||||
box.appendChild(cvs);
|
||||
box.addEventListener('click', function(){
|
||||
var idx = box.getKPainterIndex();// get index
|
||||
painter.changePage(idx);
|
||||
});
|
||||
return box;
|
||||
painter.bindThumbnailBox(document.getElementById('div-thumbnailContainer'), function(cvs){
|
||||
console.log(cvs.className);// 'kPainterThumbnailCanvas', never remove this class
|
||||
var box = document.createElement('div');
|
||||
box.className = 'div-thumbnailBox';
|
||||
box.appendChild(cvs);
|
||||
box.addEventListener('click', function(){
|
||||
var idx = box.getKPainterIndex();// get index
|
||||
painter.changePage(idx);
|
||||
});
|
||||
return box;
|
||||
});
|
||||
```
|
||||
*/
|
||||
bindThumbnailBox(container: HTMLElement, funWrap?: () => HTMLElement, maxWH?: number): boolean;
|
||||
@ -454,13 +459,12 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
painter.bindThumbnailBox(document.getElementById('div-thumbnailContainer'));
|
||||
painter.bindThumbnailBox(document.getElementById('div-thumbnailContainer'));
|
||||
```
|
||||
*/
|
||||
unbindThumbnailBox(container: HTMLElement): boolean;
|
||||
|
||||
// Gesture
|
||||
|
||||
// # Gesture
|
||||
/**
|
||||
*
|
||||
Set the zoom rate when user left double click.
|
||||
@ -491,11 +495,11 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
painter.onUpdateImgPosZoom(function(){
|
||||
console.log(painter.getZoom());
|
||||
console.log(painter.getEditWidth());
|
||||
console.log(painter.getEditHeight());
|
||||
});
|
||||
painter.onUpdateImgPosZoom(function(){
|
||||
console.log(painter.getZoom());
|
||||
console.log(painter.getEditWidth());
|
||||
console.log(painter.getEditHeight());
|
||||
});
|
||||
```
|
||||
*/
|
||||
onUpdateImgPosZoom: () => void;
|
||||
@ -524,10 +528,9 @@ declare class KPainter {
|
||||
*/
|
||||
setZoom(num: number, isRate: boolean): number;
|
||||
|
||||
// Basic Editor
|
||||
|
||||
// # Basic Editor
|
||||
/**
|
||||
* The can - not - store step(freeTransform, brush) will generate a step image.If the step images' count over `stepImgsGCThreshold`, oldest not protected one would be GC.
|
||||
* The can - not - store step(freeTransform, brush) will generate a step image.If the step images' count over `stepImgsGCThreshold`, oldest not protected one would be GC.
|
||||
|
||||
* Syntax:* `.stepImgsGCThreshold = 10;`
|
||||
*/
|
||||
@ -545,35 +548,35 @@ declare class KPainter {
|
||||
@example
|
||||
```javascript
|
||||
// sample code: save and give up editing about freeTransform mode
|
||||
document.getElementById('btn-enterFreeTransformMode').addEventListener('click', function(){
|
||||
// pretect step when enter freeTransform mode
|
||||
painter.addProtectedStep(painter.getCurStep());
|
||||
// presume that `MBC.loadCvScriptAsync(callback)` has been called and success
|
||||
painter.enterFreeTransformModeAsync();
|
||||
});
|
||||
document.getElementById('btn-enterFreeTransformMode').addEventListener('click', function(){
|
||||
// pretect step when enter freeTransform mode
|
||||
painter.addProtectedStep(painter.getCurStep());
|
||||
// presume that `MBC.loadCvScriptAsync(callback)` has been called and success
|
||||
painter.enterFreeTransformModeAsync();
|
||||
});
|
||||
|
||||
document.getElementById('btn-saveFreeTransform').addEventListener('click', function(){
|
||||
// remove the the last pretect step
|
||||
var protectedSteps = painter.getProtectedSteps();
|
||||
painter.removeProtectedStep(protectedSteps[protectedSteps.length - 1]);
|
||||
// transform and exitFreeTransformMode
|
||||
painter.freeTransformAsync(function(){
|
||||
painter.exitFreeTransformModeAsync();
|
||||
});
|
||||
document.getElementById('btn-saveFreeTransform').addEventListener('click', function(){
|
||||
// remove the the last pretect step
|
||||
var protectedSteps = painter.getProtectedSteps();
|
||||
painter.removeProtectedStep(protectedSteps[protectedSteps.length - 1]);
|
||||
// transform and exitFreeTransformMode
|
||||
painter.freeTransformAsync(function(){
|
||||
painter.exitFreeTransformModeAsync();
|
||||
});
|
||||
|
||||
document.getElementById('btn-giveUpFreeTransform').addEventListener('click', function(){
|
||||
// pretect step when enter freeTransform mode
|
||||
var protectedSteps = painter.getProtectedSteps();
|
||||
var lastPretectedStep = protectedSteps[protectedSteps.length - 1];
|
||||
// remove the the last pretect step
|
||||
painter.removeProtectedStep(lastPretectedStep);
|
||||
// exitFreeTransformMode
|
||||
painter.exitFreeTransformModeAsync(function(){
|
||||
// jump to the last pretect step
|
||||
painter.setCurStepAsync(lastPretectedStep);
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('btn-giveUpFreeTransform').addEventListener('click', function(){
|
||||
// pretect step when enter freeTransform mode
|
||||
var protectedSteps = painter.getProtectedSteps();
|
||||
var lastPretectedStep = protectedSteps[protectedSteps.length - 1];
|
||||
// remove the the last pretect step
|
||||
painter.removeProtectedStep(lastPretectedStep);
|
||||
// exitFreeTransformMode
|
||||
painter.exitFreeTransformModeAsync(function(){
|
||||
// jump to the last pretect step
|
||||
painter.setCurStepAsync(lastPretectedStep);
|
||||
});
|
||||
});
|
||||
```
|
||||
*/
|
||||
addProtectedStep(index: number): boolean;
|
||||
@ -770,8 +773,7 @@ declare class KPainter {
|
||||
*/
|
||||
getEditHeight(): number;
|
||||
|
||||
// Crop
|
||||
|
||||
// # Crop
|
||||
/**
|
||||
* Whether show`Crop Rect` UI when enter`Editing` mode
|
||||
|
||||
@ -828,11 +830,11 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
painter.onCropRectChange = function(){
|
||||
var cropArea = painter.getCropRectArea(true);
|
||||
document.getElementById('cropWidth').innerText = cropArea[2] - cropArea[0];
|
||||
document.getElementById('cropHeight').innerText = cropArea[3] - cropArea[1];
|
||||
};
|
||||
painter.onCropRectChange = function(){
|
||||
var cropArea = painter.getCropRectArea(true);
|
||||
document.getElementById('cropWidth').innerText = cropArea[2] - cropArea[0];
|
||||
document.getElementById('cropHeight').innerText = cropArea[3] - cropArea[1];
|
||||
};
|
||||
```
|
||||
*/
|
||||
onCropRectChange: () => void;
|
||||
@ -876,12 +878,10 @@ declare class KPainter {
|
||||
*/
|
||||
cropAsync(callback?: () => void, array?: rectangle[]): void;
|
||||
|
||||
// Free Transform
|
||||
|
||||
// # Free Transform
|
||||
/**
|
||||
* You should call`KPainter.loadCvScriptAsync()` first before use`FreeTransform` mode.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Detect a document.Would auto call`setFreeTransformCornerPos()` after detected.Can only process in `FreeTransform` mode.
|
||||
|
||||
@ -925,9 +925,9 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
painter.onFreeTransformCornerPosChange = function(){
|
||||
console.log(painter.getFreeTransformCornerPos());
|
||||
};
|
||||
painter.onFreeTransformCornerPosChange = function(){
|
||||
console.log(painter.getFreeTransformCornerPos());
|
||||
};
|
||||
```
|
||||
*/
|
||||
onFreeTransformCornerPosChange: () => void;
|
||||
@ -977,11 +977,10 @@ declare class KPainter {
|
||||
*/
|
||||
exitFreeTransformModeAsync(callback?: () => void): any;
|
||||
|
||||
// Video
|
||||
|
||||
// # Video
|
||||
videoSettings: MediaStreamConstraints;
|
||||
|
||||
// `MediaStreamConstraints`.videoSettings
|
||||
// ## `MediaStreamConstraints`.videoSettings
|
||||
/**
|
||||
A[MediaStreamConstraints](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints).
|
||||
|
||||
@ -1024,11 +1023,11 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
painter.beforeAddImgFromGrabVideoBtn = function(canvas, callback){
|
||||
doSomeWorkToGetNewSrc(canvas, function(srcValidForAddImage){
|
||||
callback(srcValidForAddImage);
|
||||
});
|
||||
};
|
||||
painter.beforeAddImgFromGrabVideoBtn = function(canvas, callback){
|
||||
doSomeWorkToGetNewSrc(canvas, function(srcValidForAddImage){
|
||||
callback(srcValidForAddImage);
|
||||
});
|
||||
};
|
||||
```
|
||||
*/
|
||||
beforeAddImgFromGrabVideoBtn: () => void;
|
||||
@ -1038,9 +1037,9 @@ declare class KPainter {
|
||||
|
||||
@example
|
||||
```javascript
|
||||
painter.afterAddImgFromGrabVideoBtn = function(bSuccess){
|
||||
if(bSuccess){console.log('The new image(s) has been added from video.');}
|
||||
};
|
||||
painter.afterAddImgFromGrabVideoBtn = function(bSuccess){
|
||||
if(bSuccess){console.log('The new image(s) has been added from video.');}
|
||||
};
|
||||
```
|
||||
*/
|
||||
afterAddImgFromGrabVideoBtn: () => void;
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
@ -18,15 +18,14 @@
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"addon.ocr.d.ts",
|
||||
"dwt-tests.ts",
|
||||
"index.d.ts",
|
||||
"Dynamsoft.d.ts",
|
||||
"addon.ocr.d.ts",
|
||||
"addon.ocrp.d.ts",
|
||||
"addon.pdf.d.ts",
|
||||
"addon.webcam.d.ts",
|
||||
"dbr.d.ts",
|
||||
"dwt-tests.ts",
|
||||
"dwt.d.ts",
|
||||
"index.d.ts",
|
||||
"Dynamsoft.d.ts",
|
||||
"mbc.d.ts"
|
||||
"mbc.d.ts"
|
||||
]
|
||||
}
|
||||
|
||||
101
types/dwt/v12/dwt-tests.ts
Normal file
101
types/dwt/v12/dwt-tests.ts
Normal file
@ -0,0 +1,101 @@
|
||||
function dwtOnReady() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
|
||||
if (DWObject) {
|
||||
let count = DWObject.SourceCount;
|
||||
if (count === 0) {
|
||||
DWObject.CloseSourceManager();
|
||||
DWObject.ImageCaptureDriverType = 0;
|
||||
DWObject.OpenSourceManager();
|
||||
count = DWObject.SourceCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function acquireImage() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
DWObject.SelectSourceByIndex(0); // Use method SelectSourceByIndex to avoid the 'Select Source' dialog
|
||||
DWObject.OpenSource();
|
||||
DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
|
||||
DWObject.AcquireImage({}, () => {}, (errorCode: number, errorString: string) => {DWObject.CloseSource(); });
|
||||
}
|
||||
}
|
||||
|
||||
function registerEvent() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
// The event OnPostTransfer fires after each image is scanned and transferred
|
||||
DWObject.RegisterEvent("OnPostTransfer", function () {});
|
||||
|
||||
// The event OnPostLoad fires after the images from a local directory have been loaded into the control
|
||||
DWObject.RegisterEvent("OnPostLoad", function () {});
|
||||
|
||||
// The event OnMouseClick fires when the mouse clicks on an image on Dynamic Web TWAIN viewer
|
||||
DWObject.RegisterEvent("OnMouseClick", function () {});
|
||||
|
||||
// The event OnTopImageInTheViewChanged fires when the top image currently displayed in the viewer changes
|
||||
DWObject.RegisterEvent("OnTopImageInTheViewChanged", function (index: number) {
|
||||
DWObject.CurrentImageIndexInBuffer = index;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function editImage() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
if (DWObject.HowManyImagesInBuffer > 0)
|
||||
DWObject.RotateLeft(DWObject.CurrentImageIndexInBuffer);
|
||||
|
||||
if (DWObject.HowManyImagesInBuffer > 0)
|
||||
DWObject.RotateRight(DWObject.CurrentImageIndexInBuffer);
|
||||
|
||||
if (DWObject.HowManyImagesInBuffer > 0)
|
||||
DWObject.Mirror(DWObject.CurrentImageIndexInBuffer);
|
||||
|
||||
if (DWObject.HowManyImagesInBuffer > 0)
|
||||
DWObject.Flip(DWObject.CurrentImageIndexInBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
function showImageEditor() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
DWObject.ShowImageEditor();
|
||||
}
|
||||
}
|
||||
|
||||
function saveImage() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
DWObject.ConvertToGrayScale(DWObject.CurrentImageIndexInBuffer);
|
||||
DWObject.SaveAsJPEG("DynamicWebTWAIN.jpg", DWObject.CurrentImageIndexInBuffer);
|
||||
DWObject.SaveAllAsMultiPageTIFF("DynamicWebTWAIN.tiff", () => {}, (errorCode: number, errorString: string) => {});
|
||||
DWObject.SaveAllAsPDF("DynamicWebTWAIN.pdf", () => {}, (errorCode: number, errorString: string) => {});
|
||||
}
|
||||
}
|
||||
|
||||
function updateLargeViewer() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
const DWObjectLargeViewer = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainerLargeViewer');
|
||||
if (DWObject) {
|
||||
DWObject.CopyToClipboard(DWObject.CurrentImageIndexInBuffer); // Copy the current image in the thumbnail to clipboard in DIB format.
|
||||
DWObjectLargeViewer.LoadDibFromClipboard(); // Load the image from Clipboard into the large viewer.
|
||||
}
|
||||
}
|
||||
|
||||
function uploadImage() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
DWObject.HTTPPort = 80;
|
||||
DWObject.IfSSL = false;
|
||||
DWObject.HTTPUploadThroughPost("www.dynamsoft.com", DWObject.CurrentImageIndexInBuffer, "upload", "tmp.jpg", () => {}, (errorCode: number, errorString: string) => {});
|
||||
}
|
||||
}
|
||||
|
||||
function downloadImage() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
DWObject.HTTPPort = 80;
|
||||
DWObject.HTTPDownload("www.dynamsoft.com", "img.png", () => {}, (errorCode: number, errorString: string) => {});
|
||||
}
|
||||
}
|
||||
3459
types/dwt/v12/index.d.ts
vendored
Normal file
3459
types/dwt/v12/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
28
types/dwt/v12/tsconfig.json
Normal file
28
types/dwt/v12/tsconfig.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"dwt": [
|
||||
"dwt/v12"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"dwt-tests.ts"
|
||||
]
|
||||
}
|
||||
12
types/dwt/v12/tslint.json
Normal file
12
types/dwt/v12/tslint.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": [false],
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"space-before-function-paren": false,
|
||||
"only-arrow-functions": [false]
|
||||
}
|
||||
}
|
||||
16
types/dwt/v13/README.md
Normal file
16
types/dwt/v13/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Installation
|
||||
> `npm install --save @types/dwt`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for DWT and its add-ons(http://www.dynamsoft.com/Products/WebTWAIN_Overview.aspx).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dwt
|
||||
|
||||
Additional Details
|
||||
* Last updated: 15 Jan 2019 17:34:42 GMT
|
||||
* Dependencies: none
|
||||
* Global values: dynamsoft, Dynamsoft, EnumDWT_BorderStyle, EnumDWT_Cap, EnumDWT_CapBitOrder, EnumDWT_CapBitdepthReduction, EnumDWT_CapFeederAlignment, EnumDWT_CapFeederOrder, EnumDWT_CapFilterType, EnumDWT_CapFlash, EnumDWT_CapFlipRotation, EnumDWT_CapImageFilter, EnumDWT_CapLanguage, EnumDWT_CapLightPath, EnumDWT_CapLightSource, EnumDWT_CapNoiseFilter, EnumDWT_CapORientation, EnumDWT_CapOverscan, EnumDWT_CapPixelFlavor, EnumDWT_CapPlanarChunky, EnumDWT_CapPrinter, EnumDWT_CapPrinterMode, EnumDWT_CapSupportedSizes, EnumDWT_CapType, EnumDWT_CapValueType, EnumDWT_ConverMode, EnumDWT_ConvertMode, EnumDWT_DUPLEX, EnumDWT_DataSourceStatus, EnumDWT_Error, EnumDWT_FileFormat, EnumDWT_FitWindowType, EnumDWT_ImageType, EnumDWT_InitMsg, EnumDWT_InterpolationMethod, EnumDWT_Language, EnumDWT_MagType, EnumDWT_MessageType, EnumDWT_MouseShape, EnumDWT_PDFCompressionType, EnumDWT_PixelType, EnumDWT_PlatformType, EnumDWT_ShowMode, EnumDWT_TIFFCompressionType, EnumDWT_TransferMode, EnumDWT_UnitType, EnumDWT_UploadDataFormat, etc.
|
||||
|
||||
# Credits
|
||||
These definitions were written 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>.
|
||||
204
types/dwt/v13/addon.ocr.d.ts
vendored
Normal file
204
types/dwt/v13/addon.ocr.d.ts
vendored
Normal file
@ -0,0 +1,204 @@
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
/*!
|
||||
* Product: Dynamsoft Web Twain
|
||||
* Web Site: http://www.dynamsoft.com
|
||||
*
|
||||
* Copyright 2019, Dynamsoft Corporation
|
||||
* Author: Dynamsoft Support Team
|
||||
*/
|
||||
|
||||
declare enum EnumDWT_OCRLanguage {
|
||||
OCRL_ENG = "eng",
|
||||
OCRL_ARA = "ara",
|
||||
OCRL_CHI_SIM = "chi_sim",
|
||||
OCRL_CHI_TRA = "chi_tra",
|
||||
OCRL_HIN = "hin",
|
||||
OCRL_URD = "urd",
|
||||
OCRL_SPA = "spa",
|
||||
OCRL_FRA = "fra",
|
||||
OCRL_MSA = "msa",
|
||||
OCRL_IND = "ind",
|
||||
OCRL_RUS = "rus",
|
||||
OCRL_BEN = "ben",
|
||||
OCRL_POR = "por",
|
||||
OCRL_PAN = "pan",
|
||||
OCRL_DEU = "deu",
|
||||
OCRL_JPN = "jpn",
|
||||
OCRL_FAS = "fas",
|
||||
OCRL_SWA = "swa",
|
||||
OCRL_JAV = "jav",
|
||||
OCRL_TEL = "tel",
|
||||
OCRL_TUR = "tur",
|
||||
OCRL_KOR = "kor",
|
||||
OCRL_MAR = "mar",
|
||||
OCRL_TAM = "tam",
|
||||
OCRL_VIE = "vie",
|
||||
OCRL_ITA = "ita",
|
||||
OCRL_THA = "tha"
|
||||
}
|
||||
|
||||
declare enum EnumDWT_OCRPageSetMode {
|
||||
OCRPSM_OSD_ONLY = 0,
|
||||
PSM_AUTO_OSD = 1,
|
||||
PSM_AUTO_ONLY = 2,
|
||||
PSM_AUTO = 3,
|
||||
PSM_SINGLE_COLUMN = 4,
|
||||
PSM_SINGLE_BLOCK_VERT_TEXT = 5,
|
||||
PSM_SINGLE_BLOCK = 6,
|
||||
PSM_SINGLE_LINE = 7,
|
||||
PSM_SINGLE_WORD = 8,
|
||||
PSM_CIRCLE_WORD = 9,
|
||||
PSM_SINGLE_CHAR = 10
|
||||
}
|
||||
|
||||
declare enum EnumDWT_OCROutputFormat {
|
||||
OCROF_TEXT = 0,
|
||||
OCROF_PDFPLAINTEXT = 1,
|
||||
OCROF_PDFIMAGEOVERTEXT = 2,
|
||||
OCROF_PDFPLAINTEXT_PDFX = 3,
|
||||
OCROF_PDFIMAGEOVERTEXT_PDFX = 4
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
interface OCR {
|
||||
/**
|
||||
* Downloads and installs the ocr 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 {boolean}
|
||||
*/
|
||||
Download(remoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
|
||||
|
||||
/**
|
||||
* Downloads and deploys the OCR language package on the local system.
|
||||
* @method Dynamsoft.WebTwain#DownloadLangData
|
||||
* @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 {boolean}
|
||||
*/
|
||||
DownloadLangData(remoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
|
||||
|
||||
/**
|
||||
* Performs OCR on a given image.
|
||||
* @method Dynamsoft.WebTwain#Read
|
||||
* @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 {boolean}
|
||||
*/
|
||||
Recognize(sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
|
||||
|
||||
/**
|
||||
* Peforms OCR on the given rectangle on a specified image.
|
||||
* @method Dynamsoft.WebTwain#ReadRect
|
||||
* @param {number} sImageIndex Specifies the index of the image.
|
||||
* @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
|
||||
* @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
|
||||
* @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
|
||||
* @param {number} bottom specifies the y-coordinate of the lower-right corner 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 {boolean}
|
||||
*/
|
||||
RecognizeRect(sImageIndex: number, left: number, top: number, right: number, bottom: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
|
||||
|
||||
/**
|
||||
* Performs OCR on one or multiple specified local file(s) directly.
|
||||
* @method Dynamsoft.WebTwain#Read
|
||||
* @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 {boolean}
|
||||
*/
|
||||
RecognizeFile(fileNames: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
|
||||
|
||||
/**
|
||||
* Performs OCR on the currently selected images in the buffer.
|
||||
* @method Dynamsoft.WebTwain#Read
|
||||
* @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 {boolean}
|
||||
*/
|
||||
RecognizeSelectedImages(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
|
||||
|
||||
/**
|
||||
* Specifies a font to be used by OCR when Addon.OCR.SetIfUseDetectedFont is set to false.
|
||||
* @method Dynamsoft.WebTwain#SetUnicodeFontName
|
||||
* @param {string} name Specifies a font to be used by
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetUnicodeFontName(name: string): void;
|
||||
|
||||
/**
|
||||
* Returns the detected OCR font name.
|
||||
* @method Dynamsoft.WebTwain#GetUnicodeFontName
|
||||
* @return {string} Returns the detected OCR font name.
|
||||
*/
|
||||
GetUnicodeFontName(): void;
|
||||
|
||||
/**
|
||||
* Determines whether PDF output should use the fonts detected by the OCR system, or the default/provided fonts instead.
|
||||
* @method Dynamsoft.WebTwain#SetIfUseDetectedFont
|
||||
* @param {boolean} bValue By default this is true, indicating detected fonts should be used. The detected fonts must exist on the user's system for this to be successful.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetIfUseDetectedFont(bValue: boolean): void;
|
||||
|
||||
/**
|
||||
* Returns whether PDF output should use the fonts detected by the OCR system, or the default/provided fonts instead.
|
||||
* @method Dynamsoft.WebTwain#GetIfUseDetectedFont
|
||||
* @return {boolean} Returns whether PDF output should use the fonts detected by the OCR system, or the default/provided fonts instead.
|
||||
*/
|
||||
GetIfUseDetectedFont(): void;
|
||||
|
||||
/**
|
||||
* Applies higher-level accuracy of OCR to the area of the image where the font size is bigger than the value set here.
|
||||
* @method Dynamsoft.WebTwain#SetIfUseDetectedFont
|
||||
* @param {number} nValue Specifies the font size base to apply the higher-level accracy OCR. The default value is 0 which means no regional accurate OCR is performed.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetMinFontSizeforMoreAccurateResult(nValue: number): void;
|
||||
|
||||
/**
|
||||
* Returns the font size base to apply higher-level regional accarate OCR which is set through Addon.OCR.SetMinFontSizeforMoreAccurateResult.
|
||||
* @method Dynamsoft.WebTwain#GetMinFontSizeforMoreAccurateResult
|
||||
* @return {boolean} Returns the font size base to apply higher-level regional accarate OCR. If the return value is 0, it indicates no regional accurate OCR is performed.
|
||||
*/
|
||||
GetMinFontSizeforMoreAccurateResult(): void;
|
||||
|
||||
/**
|
||||
* Sets the target language for OCR operations.
|
||||
* @method Dynamsoft.WebTwain#SetLanguage
|
||||
* @param {string} value Specifies the target language for OCR operation.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetLanguage(value: string): void;
|
||||
|
||||
/**
|
||||
* Sets the mode for OCR page layout analysis. Determines how pages are determined when processing OCR.
|
||||
* @method Dynamsoft.WebTwain#SetPageSetMode
|
||||
* @param {EnumDWT_OCRPageSetMode} value Specifies the OCR Page layout analysis mode.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetPageSetMode(value: EnumDWT_OCRPageSetMode): void;
|
||||
|
||||
/**
|
||||
* Sets the OCR result format. Determines whether the OCR output is in text or PDF format.
|
||||
* @method Dynamsoft.WebTwain#SetOutputFormat
|
||||
* @param {EnumDWT_OCROutputFormat} value Specifies the OCR result format.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetOutputFormat(value: EnumDWT_OCROutputFormat): void;
|
||||
}
|
||||
|
||||
interface WebTwainAddon {
|
||||
OCR: OCR;
|
||||
}
|
||||
174
types/dwt/v13/addon.ocrp.d.ts
vendored
Normal file
174
types/dwt/v13/addon.ocrp.d.ts
vendored
Normal file
@ -0,0 +1,174 @@
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
/*!
|
||||
* 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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
NewOCRError(): OCRError;
|
||||
NewOCRReadPara(): OCRReadPara;
|
||||
NewOCRZone(): OCRZone;
|
||||
NewSettings(): Settings;
|
||||
}
|
||||
|
||||
interface DynamsoftWebTwainAddon {
|
||||
OCRPro: OCRPro;
|
||||
}
|
||||
80
types/dwt/v13/addon.pdf.d.ts
vendored
Normal file
80
types/dwt/v13/addon.pdf.d.ts
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
/*!
|
||||
* Product: Dynamsoft Web Twain
|
||||
* Web Site: http://www.dynamsoft.com
|
||||
*
|
||||
* Copyright 2019, Dynamsoft Corporation
|
||||
* Author: Dynamsoft Support Team
|
||||
*/
|
||||
|
||||
declare enum EnumDWT_ConvertMode {
|
||||
CM_DEFAULT = 0,
|
||||
CM_RENDERALL = 1
|
||||
}
|
||||
|
||||
declare enum EnumDWT_ConverMode {
|
||||
CM_DEFAULT = 0,
|
||||
CM_RENDERALL = 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 {boolean}
|
||||
*/
|
||||
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 {boolean}
|
||||
*/
|
||||
SetPassword(password: string): boolean;
|
||||
|
||||
/**
|
||||
* Set the image convert mode for PDF Rasterizer in Dynamic Web TWAIN.
|
||||
* @method Dynamsoft.WebTwain#SetConvertMode
|
||||
* @param {EnumDWT_ConvertMode | EnumDWT_ConverMode} convertMode Specifies the image convert mode.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetConvertMode(convertMode: EnumDWT_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 {boolean}
|
||||
*/
|
||||
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 {boolean}
|
||||
*/
|
||||
IsTextBasedPDF(localFile: string): boolean;
|
||||
}
|
||||
|
||||
interface WebTwainAddon {
|
||||
PDF: PDF;
|
||||
}
|
||||
|
||||
interface WebTwain {
|
||||
Addon: WebTwainAddon;
|
||||
}
|
||||
346
types/dwt/v13/addon.webcam.d.ts
vendored
Normal file
346
types/dwt/v13/addon.webcam.d.ts
vendored
Normal file
@ -0,0 +1,346 @@
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
/*!
|
||||
* Product: Dynamsoft Web Twain
|
||||
* Web Site: http://www.dynamsoft.com
|
||||
*
|
||||
* Copyright 2019, Dynamsoft Corporation
|
||||
* Author: Dynamsoft Support Team
|
||||
*/
|
||||
|
||||
/** -2400 to -2499 is webcam error code */
|
||||
declare enum EnumDWT_ErrorCode {
|
||||
/** All error from directshow sdk */
|
||||
WCERR_SYSTEM = -2400,
|
||||
/** Create ICreateDevEnum interface failed. */
|
||||
WCERR_FAIL_ICREATEDEVENUM = -2401,
|
||||
/** Create IEnumMoniker interface failed. */
|
||||
WCERR_FAIL_IENUMMONIKER = -2402,
|
||||
/** The camera doesn't support IAMVideoProcAmp interface. */
|
||||
WCERR_NOT_IAMVIDEOPROPERTY = -2403,
|
||||
/** The camera doesn't support IAMCameraControl interface. */
|
||||
WCERR_NOT_IAMCAMERACONTROL = -2404,
|
||||
/** The property doesn't support auto capability. */
|
||||
WCERR_NOT_AUTOPROPERTY = -2405,
|
||||
/** No webcam device is found. */
|
||||
WCERR_NO_DEVICE = -2406,
|
||||
/** Could not get video window interface */
|
||||
WCERR_FAIL_VIDEOWINDOW = -2407,
|
||||
/** Could not create filter graph. */
|
||||
WCERR_FAIL_FILTERGRAPH = -2408,
|
||||
/** Could not create SampleGrabber (isqedit.all registered?). */
|
||||
WCERR_FAIL_SAMPLEGRABBER = -2409,
|
||||
/** Unable to make NULL renderer */
|
||||
WCERR_NULLRENDER = -2410,
|
||||
/** Can't add the filter to graph */
|
||||
WCERR_FAIL_ADDFILTER = -2411,
|
||||
/** Can't build the graph */
|
||||
WCERR_FAIL_BUILDGRAPH = -2412,
|
||||
/** Failed to register filter graph with ROT. */
|
||||
WCERR_FAIL_REGFILTERGRAPH = -2413,
|
||||
/** Time out */
|
||||
WCERR_GRAB_TIMEOUT = -2414
|
||||
}
|
||||
|
||||
/** Specifies the video rotate mode on a video capture device. */
|
||||
declare enum EnumDWT_VideoRotateMode {
|
||||
/** Don't rotate */
|
||||
VRM_NONE = 0,
|
||||
/** 90 deg Clockwise */
|
||||
VRM_90_DEGREES_CLOCKWISE = 1,
|
||||
/** 180 deg Clockwise */
|
||||
VRM_180_DEGREES_CLOCKWISE = 2,
|
||||
/** 270 deg Clockwise */
|
||||
VRM_270_DEGREES_CLOCKWISE = 3,
|
||||
/** Flip */
|
||||
VRM_FLIP_VERTICAL = 4,
|
||||
/** Mirror */
|
||||
VRM_FLIP_HORIZONTAL = 5
|
||||
}
|
||||
|
||||
/** Specifies video properties on a video capture device. */
|
||||
declare enum EnumDWT_VideoProperty {
|
||||
/** Specifies the brightness, also called the black level. For NTSC, the value is expressed in IRE units * 100.
|
||||
* For non-NTSC sources, the units are arbitrary, with zero representing blanking and 10,000 representing pure white.
|
||||
* Values range from -10,000 to 10,000.
|
||||
*/
|
||||
VP_BRIGHTNESS = 0,
|
||||
/** Specifies the contrast, expressed as gain factor * 100. Values range from zero to 10,000. */
|
||||
VP_CONTRAST = 1,
|
||||
/** Specifies the hue, in degrees * 100. Values range from -180,000 to 180,000 (-180 to +180 degrees). */
|
||||
VP_HUE = 2,
|
||||
/** Specifies the saturation. Values range from 0 to 10,000. */
|
||||
VP_SATURATION = 3,
|
||||
/** Specifies the sharpness. Values range from 0 to 100. */
|
||||
VP_SHARPNESS = 4,
|
||||
/** Specifies the gamma, as gamma * 100. Values range from 1 to 500. */
|
||||
VP_GAMMA = 5,
|
||||
/** Specifies the color enable setting. The possible values are 0 (off) and 1 (on). */
|
||||
VP_COLORENABLE = 6,
|
||||
/** Specifies the white balance, as a color temperature in degrees Kelvin. The range of values depends on the device. */
|
||||
VP_WHITEBALANCE = 7,
|
||||
/** Specifies the backlight compensation setting. Possible values are 0 (off) and 1 (on). */
|
||||
VP_BACKLIGHTCOMPENSATION = 8,
|
||||
/** Specifies the gain adjustment. Zero is normal. Positive values are brighter and negative values are darker.
|
||||
* The range of values depends on the device.
|
||||
*/
|
||||
VP_GAIN = 9
|
||||
}
|
||||
|
||||
/** Specifies a setting on a camera. */
|
||||
declare enum EnumDWT_CameraControlProperty {
|
||||
/** Specifies the camera's pan setting, in degrees. Values range from -180 to +180, with the default set to zero.
|
||||
* Positive values are clockwise from the origin (the camera rotates clockwise when viewed from above),
|
||||
* and negative values are counterclockwise from the origin.
|
||||
*/
|
||||
CCP_PAN = 0,
|
||||
/** Specifies the camera's tilt setting, in degrees. Values range from -180 to +180, with the default set to zero.
|
||||
* Positive values point the imaging plane up, and negative values point the imaging plane down.
|
||||
*/
|
||||
CCP_TILT = 1,
|
||||
/** Specifies the camera's roll setting, in degrees. Values range from -180 to +180, with the default set to zero.
|
||||
* Positive values cause a clockwise rotation of the camera along the image-viewing axis, and negative values cause a counterclockwise rotation of the camera.
|
||||
*/
|
||||
CCP_ROLL = 2,
|
||||
/** Specifies the camera's zoom setting, in millimeters. Values range from 10 to 600, and the default is specific to the device. */
|
||||
CCP_ZOOM = 3,
|
||||
/** Specifies the exposure setting, in log base 2 seconds. In other words, for values less than zero, the exposure time is 1/2^n seconds,
|
||||
* and for values zero or above, the exposure time is 2^n seconds. For example:
|
||||
* Value Seconds
|
||||
* -3 1/8
|
||||
* -2 1/4
|
||||
* -1 1/2
|
||||
* 0 1
|
||||
* 1 2
|
||||
* 2 4
|
||||
*/
|
||||
CCP_EXPOSURE = 4,
|
||||
/** Specifies the camera's iris setting, in units of fstop* 10. */
|
||||
CCP_IRIS = 5,
|
||||
/** Specifies the camera's focus setting, as the distance to the optimally focused target, in millimeters.
|
||||
* The range and default value are specific to the device.
|
||||
*/
|
||||
CCP_FOCUS = 6
|
||||
}
|
||||
|
||||
interface WebcamMediaType {
|
||||
GetCount(): number;
|
||||
Get(index: number): string;
|
||||
GetCurrent(): string;
|
||||
}
|
||||
|
||||
interface WebcamResolution {
|
||||
GetCount(): number;
|
||||
Get(index: number): string;
|
||||
GetCurrent(): string;
|
||||
}
|
||||
|
||||
interface WebcamFrameRate {
|
||||
GetCount(): number;
|
||||
Get(index: number): string;
|
||||
GetCurrent(): string;
|
||||
}
|
||||
|
||||
interface CameraControlMoreSetting {
|
||||
GetMinValue(): number;
|
||||
GetMaxValue(): number;
|
||||
GetSteppingDelta(): number;
|
||||
GetDefaultValue(): number;
|
||||
GetIfAuto(): boolean;
|
||||
}
|
||||
|
||||
interface CameraControlSetting {
|
||||
GetValue(): number;
|
||||
GetIfAuto(): boolean;
|
||||
}
|
||||
|
||||
interface VideoPropertyMoreSetting {
|
||||
GetMinValue(): number;
|
||||
GetMaxValue(): number;
|
||||
GetSteppingDelta(): number;
|
||||
GetDefaultValue(): number;
|
||||
GetIfAuto(): boolean;
|
||||
}
|
||||
|
||||
interface VideoPropertySetting {
|
||||
GetValue(): number;
|
||||
GetIfAuto(): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
interface Webcam {
|
||||
IsModuleInstalled(): boolean;
|
||||
GetFramePartURL(): string;
|
||||
GetFrameURL(): string;
|
||||
|
||||
/**
|
||||
* Download and install webcam add-on on the local system.
|
||||
* @method Dynamsoft.WebTwain#Download
|
||||
* @param {string} remoteFile:string 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 {boolean}
|
||||
*/
|
||||
Download(remoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): void;
|
||||
|
||||
/**
|
||||
* Return supported webcam source names.
|
||||
* @method Dynamsoft.WebTwain#GetSourceList
|
||||
* @return {string array}
|
||||
*/
|
||||
GetSourceList(): string[];
|
||||
|
||||
/**
|
||||
* Select the source with the specified name.
|
||||
* @method Dynamsoft.WebTwain#SelectSource
|
||||
* @param {string} strSourceName The source name.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SelectSource(strSourceName: string): boolean;
|
||||
|
||||
/**
|
||||
* Close the selected source and release the webcam.
|
||||
* @method Dynamsoft.WebTwain#CloseSource
|
||||
* @return {boolean}
|
||||
*/
|
||||
CloseSource(): boolean;
|
||||
|
||||
/**
|
||||
* Show video stream in a specified container
|
||||
* @method Dynamsoft.WebTwain#StopVideo
|
||||
* @param {WebTwain} DWObject Specifies the WebTwain Object.
|
||||
* @param {number} quality Specifies the quality of each frame in the video stream. Only valid for the HTML5 edition.
|
||||
* @param {function} onFrameCaptured callback of the operation to capture
|
||||
* @return {void}
|
||||
*/
|
||||
PlayVideo(DWObject: WebTwain, quality: number, onFrameCaptured: () => void): void;
|
||||
|
||||
/**
|
||||
* Stop the video stream in the specified container
|
||||
* @method Dynamsoft.WebTwain#StopVideo
|
||||
* @return {boolean}
|
||||
*/
|
||||
StopVideo(): boolean;
|
||||
|
||||
/**
|
||||
* Capture image from the specified webcam.
|
||||
* @method Dynamsoft.WebTwain#CaptureImage
|
||||
* @param {function} OnCaptureSuccess he function to call when the capture succeeds. Please refer to the function prototype OnCaptureSuccess.
|
||||
* @param {function} OnCaptureError The function to call when the capture fails. Please refer to the function prototype OnCaptureError.
|
||||
* @return {void}
|
||||
*/
|
||||
CaptureImage(OnCaptureSuccess: () => void, OnCaptureError: () => void): void;
|
||||
|
||||
/**
|
||||
* Returns the media type for a camera.
|
||||
* @method Dynamsoft.WebTwain#GetMediaType
|
||||
* @return {class MediaType}
|
||||
*/
|
||||
GetMediaType(): WebcamMediaType;
|
||||
|
||||
/**
|
||||
* Returns the count in the media type list.
|
||||
* @method Dynamsoft.WebTwain#GetResolution
|
||||
* @return {class Resolution}
|
||||
*/
|
||||
GetResolution(): WebcamResolution;
|
||||
|
||||
/**
|
||||
* Returns the frame rate for a camera.
|
||||
* @method Dynamsoft.WebTwain#GetFrameRate
|
||||
* @return {class FrameRate}
|
||||
*/
|
||||
GetFrameRate(): WebcamFrameRate;
|
||||
|
||||
/**
|
||||
* Set the media type of the current selected source by the value.
|
||||
* @method Dynamsoft.WebTwain#SetMediaType
|
||||
* @param {string} value The new media type value.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetMediaType(value: string): boolean;
|
||||
|
||||
/**
|
||||
* Set the resolution of the current camera source.
|
||||
* @method Dynamsoft.WebTwain#SetResolution
|
||||
* @param {string} value The new resolution value.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetResolution(value: string): boolean;
|
||||
|
||||
/**
|
||||
* Set current frame rate.
|
||||
* @method Dynamsoft.WebTwain#SetFrameRate
|
||||
* @param {number} value The new frame rate value.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetFrameRate(value: number): boolean;
|
||||
|
||||
/**
|
||||
* Gets the current setting of a video property.
|
||||
* @method Dynamsoft.WebTwain#GetVideoPropertySetting
|
||||
* @param {EnumDWT_VideoProperty} property The property.
|
||||
* @return {class VideoPropertySetting}
|
||||
*/
|
||||
GetVideoPropertySetting(property: EnumDWT_VideoProperty): VideoPropertySetting;
|
||||
|
||||
/**
|
||||
* Gets the range and default value of a specified video property.
|
||||
* @method Dynamsoft.WebTwain#GetVideoPropertyMoreSetting
|
||||
* @param {EnumDWT_VideoProperty} property The property.
|
||||
* @return {class VideoPropertyMoreSetting}
|
||||
*/
|
||||
GetVideoPropertyMoreSetting(property: EnumDWT_VideoProperty): VideoPropertyMoreSetting;
|
||||
|
||||
/**
|
||||
* Gets the current setting of a camera property.
|
||||
* @method Dynamsoft.WebTwain#GetCameraControlPropertySetting
|
||||
* @param {EnumDWT_CameraControlProperty} property The property.
|
||||
* @return {class CameraControlPropertySetting}
|
||||
*/
|
||||
GetCameraControlPropertySetting(property: EnumDWT_CameraControlProperty): CameraControlSetting;
|
||||
|
||||
/**
|
||||
* Gets the range and default value of a specified camera property.
|
||||
* @method Dynamsoft.WebTwain#GetVideoPropertyMoreSetting
|
||||
* @param {EnumDWT_CameraControlProperty} property The property.
|
||||
* @return {class CameraControlPropertyMoreSetting}
|
||||
*/
|
||||
GetCameraControlPropertyMoreSetting(property: EnumDWT_CameraControlProperty): CameraControlMoreSetting;
|
||||
|
||||
/**
|
||||
* Sets video quality for a specified property.
|
||||
* @method Dynamsoft.WebTwain#SetVideoPropertySetting
|
||||
* @param {EnumDWT_VideoProperty} property The property.
|
||||
* @param {number} value The new value of the property.
|
||||
* @param {boolean} auto The desired control setting, whether the setting is controlled manually or automatically.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetVideoPropertySetting(property: EnumDWT_VideoProperty, value: number, auto: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Sets video rotate mode.
|
||||
* @method Dynamsoft.WebTwain#SetVideoRotateMode
|
||||
* @param {EnumDWT_VideoRotateMode} enumAngle The rotate angle.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetVideoRotateMode(enumAngle: EnumDWT_VideoRotateMode): boolean;
|
||||
|
||||
/**
|
||||
* Sets a specified property on the camera.
|
||||
* @method Dynamsoft.WebTwain#SetCameraControlPropertySetting
|
||||
* @param {EnumDWT_CameraControlProperty} property The property.
|
||||
* @param {number} value The new value of the property.
|
||||
* @param {boolean} auto The desired control setting, whether the setting is controlled manually or automatically.
|
||||
* @return {boolean}
|
||||
*/
|
||||
SetCameraControlPropertySetting(property: EnumDWT_CameraControlProperty, value: number, auto: boolean): boolean;
|
||||
}
|
||||
|
||||
interface WebTwainAddon {
|
||||
Webcam: Webcam;
|
||||
}
|
||||
111
types/dwt/v13/dwt-tests.ts
Normal file
111
types/dwt/v13/dwt-tests.ts
Normal file
@ -0,0 +1,111 @@
|
||||
function dwtOnReady() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
|
||||
if (DWObject) {
|
||||
let count = DWObject.SourceCount;
|
||||
if (count === 0) {
|
||||
DWObject.CloseSourceManager();
|
||||
DWObject.ImageCaptureDriverType = 0;
|
||||
DWObject.OpenSourceManager();
|
||||
count = DWObject.SourceCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function acquireImage() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
DWObject.SelectSourceByIndex(0); // Use method SelectSourceByIndex to avoid the 'Select Source' dialog
|
||||
DWObject.OpenSource();
|
||||
DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
|
||||
DWObject.AcquireImage({}, () => {}, (errorCode: number, errorString: string) => {DWObject.CloseSource(); });
|
||||
}
|
||||
}
|
||||
|
||||
function registerEvent() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
// The event OnPostTransfer fires after each image is scanned and transferred
|
||||
DWObject.RegisterEvent("OnPostTransfer", function () {});
|
||||
|
||||
// The event OnPostLoad fires after the images from a local directory have been loaded into the control
|
||||
DWObject.RegisterEvent("OnPostLoad", function () {});
|
||||
|
||||
// The event OnMouseClick fires when the mouse clicks on an image on Dynamic Web TWAIN viewer
|
||||
DWObject.RegisterEvent("OnMouseClick", function () {});
|
||||
|
||||
// The event OnTopImageInTheViewChanged fires when the top image currently displayed in the viewer changes
|
||||
DWObject.RegisterEvent("OnTopImageInTheViewChanged", function (index: number) {
|
||||
DWObject.CurrentImageIndexInBuffer = index;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function editImage() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
if (DWObject.HowManyImagesInBuffer > 0)
|
||||
DWObject.RotateLeft(DWObject.CurrentImageIndexInBuffer);
|
||||
|
||||
if (DWObject.HowManyImagesInBuffer > 0)
|
||||
DWObject.RotateRight(DWObject.CurrentImageIndexInBuffer);
|
||||
|
||||
if (DWObject.HowManyImagesInBuffer > 0)
|
||||
DWObject.Mirror(DWObject.CurrentImageIndexInBuffer);
|
||||
|
||||
if (DWObject.HowManyImagesInBuffer > 0)
|
||||
DWObject.Flip(DWObject.CurrentImageIndexInBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
function showImageEditor() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
DWObject.ShowImageEditor();
|
||||
}
|
||||
}
|
||||
|
||||
function saveImage() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
DWObject.ConvertToGrayScale(DWObject.CurrentImageIndexInBuffer);
|
||||
DWObject.SaveAsJPEG("DynamicWebTWAIN.jpg", DWObject.CurrentImageIndexInBuffer);
|
||||
DWObject.SaveAllAsMultiPageTIFF("DynamicWebTWAIN.tiff", () => {}, (errorCode: number, errorString: string) => {});
|
||||
DWObject.SaveAllAsPDF("DynamicWebTWAIN.pdf", () => {}, (errorCode: number, errorString: string) => {});
|
||||
}
|
||||
}
|
||||
|
||||
function updateLargeViewer() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
const DWObjectLargeViewer = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainerLargeViewer');
|
||||
if (DWObject) {
|
||||
DWObject.CopyToClipboard(DWObject.CurrentImageIndexInBuffer); // Copy the current image in the thumbnail to clipboard in DIB format.
|
||||
DWObjectLargeViewer.LoadDibFromClipboard(); // Load the image from Clipboard into the large viewer.
|
||||
}
|
||||
}
|
||||
|
||||
function uploadImage() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
DWObject.HTTPPort = 80;
|
||||
DWObject.IfSSL = false;
|
||||
DWObject.HTTPUploadThroughPost("www.dynamsoft.com", DWObject.CurrentImageIndexInBuffer, "upload", "tmp.jpg", () => {}, (errorCode: number, errorString: string) => {});
|
||||
}
|
||||
}
|
||||
|
||||
function downloadImage() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
DWObject.HTTPPort = 80;
|
||||
DWObject.HTTPDownload("www.dynamsoft.com", "img.png", () => {}, (errorCode: number, errorString: string) => {});
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
4877
types/dwt/dwt.d.ts → types/dwt/v13/index.d.ts
vendored
4877
types/dwt/dwt.d.ts → types/dwt/v13/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
33
types/dwt/v13/tsconfig.json
Normal file
33
types/dwt/v13/tsconfig.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"dwt": [
|
||||
"dwt/v13"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"addon.ocr.d.ts",
|
||||
"addon.ocrp.d.ts",
|
||||
"addon.pdf.d.ts",
|
||||
"addon.webcam.d.ts",
|
||||
"dwt-tests.ts"
|
||||
]
|
||||
}
|
||||
12
types/dwt/v13/tslint.json
Normal file
12
types/dwt/v13/tslint.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": [false],
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"space-before-function-paren": false,
|
||||
"only-arrow-functions": [false]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user