diff --git a/types/dwt/Addon.BarcodeReader.d.ts b/types/dwt/Addon.BarcodeReader.d.ts new file mode 100644 index 0000000000..5562ead2cf --- /dev/null +++ b/types/dwt/Addon.BarcodeReader.d.ts @@ -0,0 +1,168 @@ +import { DynamsoftEnums as Dynamsoft } from "./Dynamsoft.Enum"; + +export interface BarcodeReader { + /** + * Read an image in the buffer and try to locate and decode barcode(s) on it. + * @param index Specify the image to decode. + */ + decode(index: number): Promise; + /** + * Return the current runtime settings or the settings of the specified built-in template. + * @param template Specify a built-in template. + */ + getRuntimeSettings(template?: string): Promise; + /** + * Set up the barcode reader with advanced settings. + * @param settings The runtime setting in the form of a string. + */ + initRuntimeSettingsWithString(settings: string): Promise; + /** + * Update the runtime settings with a given object or use the string "speed", "balance", or "coverage" to use our preset settings. The default setting is "coverage". + * @param settings Specify the runtime settings. + */ + updateRuntimeSettings(settings: RuntimeSettings): Promise; + /** + * Reset all runtime settings to default values. + */ + resetRuntimeSettings(): Promise; +} +export interface TextResults extends Array { + [index: number]: TextResult; + description?: string; + exception?: number; + imageid?: number; +} +export interface TextResult { + /** + * Barcode result content in a byte array. + */ + barcodeBytes: number[]; + /** + * The barcode format. + */ + barcodeFormat: Dynamsoft.EnumBarcodeFormat | number; + /** + * Extra barcde formats. + */ + barcodeFormat_2: Dynamsoft.EnumBarcodeFormat_2 | number; + /** + * Barcode formats as a string. + */ + barcodeFormatString: string; + /** + * Extra barcode formats as a string. + */ + barcodeFormatString_2: string; + /** + * The barcode result text. + */ + barcodeText: string; + /** + * Detailed result information. + */ + detailedResult: any; + /** + * The corresponding localization result. + */ + localizationResult: LocalizationResult; + /** + * Other information + */ + results: Result[]; +} +export interface LocalizationResult { + /** + * The angle of a barcode. Values range from 0 to 360. + */ + angle: number; + /** + * The X coordinate of the left-most point. + */ + x1: number; + /** + * The X coordinate of the second point in a clockwise direction. + */ + x2: number; + /** + * The X coordinate of the third point in a clockwise direction. + */ + x3: number; + /** + * The X coordinate of the fourth point in a clockwise direction. + */ + x4: number; + /** + * The Y coordinate of the left-most point. + */ + y1: number; + /** + * The Y coordinate of the second point in a clockwise direction. + */ + y2: number; + /** + * The Y coordinate of the third point in a clockwise direction. + */ + y3: number; + /** + * The Y coordinate of the fourth point in a clockwise direction. + */ + y4: number; + moduleSize: number; + pageNumber: number; + regionName: number; + resultCoordinateType: number; + terminatePhase: number; +} +export interface Result { + accompanyingTextBytes: number[]; + clarity: number; + confidence: number; + deformation: number; + resultType: number; +} +export interface RuntimeSettings { + barcodeFormatIds: number; + barcodeFormatIds_2: number; + binarizationModes: number[]; + deblurLevel: number; + expectedBarcodesCount: number; + furtherModes: FurtherModes; + intermediateResultSavingMode: number; + intermediateResultTypes: number; + localizationModes: number[]; + maxAlgorithmThreadCount: number; + minBarcodeTextLength: number; + minResultConfidence: number; + pdfRasterDPI: number; + pdfReadingMode: number; + region: Region; + resultCoordinateType: number; + returnBarcodeZoneClarity: number; + scaleDownThreshold: number; + scaleUpModes: number[]; + terminatePhase: number; + textResultOrderModes: number[]; + timeout: number; +} +export interface FurtherModes { + accompanyingTextRecognitionModes: number[]; + barcodeColourModes: number[]; + barcodeComplementModes: number[]; + colourClusteringModes: number[]; + colourConversionModes: number[]; + deformationResistingModes: number[]; + dpmCodeReadingModes: number[]; + grayscaleTransformationModes: number[]; + imagePreprocessingModes: number[]; + regionPredetectionModes: number[]; + textAssistedCorrectionMode: number; + textFilterModes: number[]; + textureDetectionModes: number[]; +} +export interface Region { + regionBottom: number; + regionLeft: number; + regionMeasuredByPercentage: number; + regionRight: number; + regionTop: number; +} diff --git a/types/dwt/Addon.OCR.d.ts b/types/dwt/Addon.OCR.d.ts new file mode 100644 index 0000000000..54a29194b6 --- /dev/null +++ b/types/dwt/Addon.OCR.d.ts @@ -0,0 +1,264 @@ +import { DynamsoftEnums as Dynamsoft } from "./Dynamsoft.Enum"; + +export interface OCR { + /** + * Download and install the OCR add-on on the local system. + * @param path The URL to download the add-on (typically a ZIP file). + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + Download( + path: string, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Return whether the OCR engine has been installed. + */ + IsModuleInstalled(): boolean; + /** + * Download and install an OCR language package. + * @param path The URL to download the package (typically a ZIP file). + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + DownloadLangData( + path: string, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Return whether the output uses the fonts detected by the OCR system or the default/provided ones. Only valid when the result format is PDF. + */ + GetIfUseDetectedFont(): boolean; + /** + * Set whether the output uses the fonts detected by the OCR system or the default/provided ones. Only valid when the result format is PDF. + * @param value Whether to use or not the detected font. + */ + SetIfUseDetectedFont(value: boolean): boolean; + /** + * Return the font size base to apply higher-level regional accurate OCR. + */ + GetMinFontSizeforMoreAccurateResult(): number; + /** + * Set the font size base to apply higher-level regional accurate OCR. + * @param size Specify the size. + */ + SetMinFontSizeforMoreAccurateResult(size: number): number; + /** + * Return the font name for OCR. Only valid when the output format is PDF. + */ + GetUnicodeFontName(): string; + /** + * Set the font name for OCR. Only valid when the output format is PDF. + * @param name Specify a font to be used for the OCR. + */ + SetUnicodeFontName(name: string): boolean; + /** + * Configure the OCR operation. + * @param language Specify the target language. + */ + SetLanguage(language: Dynamsoft.EnumDWT_OCRLanguage | string): boolean; + /** + * Configure the OCR operation. + * @param format Specify the output format. + */ + SetOutputFormat(format: Dynamsoft.EnumDWT_OCROutputFormat | number): boolean; + /** + * Configure the OCR operation. + * @param mode Specify the OCR page layout analysis mode. + */ + SetPageSetMode(mode: Dynamsoft.EnumDWT_OCRPageSetMode | number): boolean; + /** + * Perform OCR on the specified image in the buffer. + * @param index Specify the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument imageId The imageId of the image which can be used to find the index. + * @argument result The OCR result. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + Recognize( + index: number, + successCallback: ( + imageId: number, + result: OCRResult + ) => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Perform OCR on the specified local file. + * @param path Specify a local file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument path The file path. + * @argument result The OCR result. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + RecognizeFile(path: string, + successCallback: ( + path: string, + result: OCRResult + ) => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Perform OCR on the specified rectangular area on the image. + * @param index Specify the image. + * @param left Specify the rectangle (leftmost coordinate). + * @param top Specify the rectangle (topmost coordinate). + * @param right Specify the rectangle (rightmost coordinate). + * @param bottom Specify the rectangle (bottommost coordinate). + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument imageId The imageId of the image which can be used to find the index. + * @argument result The OCR result. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + RecognizeRect( + index: number, + left: number, + top: number, + right: number, + bottom: number, + successCallback: ( + imageId: number, + left: number, + top: number, + right: number, + bottom: number, + result: OCRResult + ) => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Perform OCR on the selected images in the buffer. + * @param index Specify the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument result The OCR result. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + RecognizeSelectedImages( + successCallback: ( + result: OCRResult + ) => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; +} +export interface OCRResult { + /** + * Return a base64 string that contains the result of the OCR. + * Newlines are represented by the newline character: '\n'. + */ + Get(): string; + /** + * Return the error code. + */ + GetErrorCode(): number; + /** + * Return the error string. + */ + GetErrorString(): string; + /** + * Return the output format. + */ + GetFormat(): number; + /** + * Return the source information. It could be the index of the OCR'd image or the path of the OCR'd file. + */ + GetInput(): number | string; + /** + * Save the OCR result as a file. + * @param path The path to save the file. + */ + Save(path: string): boolean; + /** + * Return the number of pagesets in the OCR result. + */ + GetPageSetCount(): number; + /** + * Return the content of a pageset. + * @param index Specify the pageset + */ + GetPageSetContent(index: number): PageSet; +} +export interface PageSet { + /** + * Return the number of pages in the pageset. + */ + GetPageCount(): number; + /** + * Return the content of the specified page. + * @index Specify the page. + */ + GetPageContent(index: number): Page; +} +export interface Page { + /** + * Return the number of lines in the page. + */ + GetLineCount(): number; + /** + * Return the content of the specified line. + * @index Specify the line. + */ + GetLineContent(index: number): Line; +} +export interface Line { + /** + * Return the number of words in the line. + */ + GetWordCount(): number; + /** + * Return the coordinates for the rectangle that contains the specified line. The coordinates are in the sequence of "left,top,right,bottom" like "121,125,892,143". + */ + GetLineRect(): string; + /** + * Return the content of the specified word. + * @index Specify the word. + */ + GetWordContent(index: number): Word; +} +export interface Word { + /** + * Return the font name/size of the word. + */ + GetFontName(): string; + GetFontSize(): number; + /** + * Return the text of the word. + */ + GetText(): string; + /** + * Return the coordinates for the rectangle that contains the specified word. The coordinates are in the sequence of "left,top,right,bottom" like "121,126,157,139". + * @index Specify the word. + */ + GetWordRect(index: number): string; +} diff --git a/types/dwt/Addon.OCRPro.d.ts b/types/dwt/Addon.OCRPro.d.ts new file mode 100644 index 0000000000..e25934084c --- /dev/null +++ b/types/dwt/Addon.OCRPro.d.ts @@ -0,0 +1,251 @@ +import { DynamsoftEnums as Dynamsoft } from "./Dynamsoft.Enum"; + +export interface OCRPro { + /** + * Download and install the OCR Professional add-on on the local system. + * @param path The URL to download the add-on (typically a ZIP file). + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + Download( + path: string, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Return whether the OCR Professional engine has been installed. + */ + IsModuleInstalled(): boolean; + /** + * Perform OCR on the specified image in the buffer. + * @param index Specify the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument imageId The imageId of the image which can be used to find the index. + * @argument result The OCR result. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + Recognize( + index: number, + successCallback: ( + imageId: number, + result: OCRProResult + ) => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Perform OCR on the specified local file. + * @param path Specify a local file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument path The file path. + * @argument result The OCR result. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + RecognizeFile(path: string, + successCallback: ( + path: string, + result: OCRProResult + ) => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Perform OCR on the specified rectangular area(s) on the image. + * @param index Specify the image. + * @param aryRects Specify the rectangle(s). + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument imageId The imageId of the image which can be used to find the index. + * @argument result The OCR result. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + RecognizeRect( + index: number, + aryRects: Rect[], + successCallback: ( + imageId: number, + aryRects: Rect[], + result: OCRProResult + ) => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Perform OCR on the selected images in the buffer. + * @param index Specify the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument result The OCR result. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + RecognizeSelectedImages( + successCallback: ( + result: OCRProResult + ) => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Return or set the current settings of the OCR engine. + */ + Settings: Settings | boolean | null; +} +export interface Rect { + left: number; + right: number; + top: number; + bottom: number; +} +export interface OCRProResult { + /** + * Return a base64 string that contains the result of the OCR. + */ + Get(): string; + /** + * Return the error code. + */ + GetErrorCode(): number; + /** + * Return an array which contains detailed error information for each page that was OCR'd + */ + GetErrorDetailList(): Error[]; + /** + * Return the error string. + */ + GetErrorString(): string; + /** + * Return the source information. It could be the index of the OCR'd image or the path of the OCR'd file. + */ + GetInput(): number | string; + /** + * Return the number of pages already OCR'd on the machine. + */ + GetAlreadyOCRCount(): string; + /** + * Return the number of pages allowed by the current license. + */ + GetOCRTotalCount(): string; + /** + * Return the number of pages in the OCR result. + */ + GetPageCount(): string; + /** + * Return the content of a page. + * @param index Specify the page + */ + GetPageContent(index: number): Page; + /** + * Save the OCR result as a file. + * @param path The path to save the file. + */ + Save(path: string): boolean; +} +export interface Error { + /** + * Return the index of the image or path of the file. + */ + GetInput(): number | string; + /** + * Return the error message. + */ + GetMessage(): string; + /** + * Return the number of the page on which the error was thrown. + * If the input is a file, this returns the index of the page in that file. + * If the input is an image in the buffer, this always returns 0. + */ + GetPage(): number; +} +export interface Page { + /** + * Return the number of letters in the page. + */ + GetLetterCount(): number; + /** + * Return the content of the specified letter. + * @index Specify the letter. + */ + GetLetterContent(index: number): Letter; + /** + * Return the number of recognized rectangles in the page. + */ + GetZoneCount(): number; + /** + * Return the base64-encoded content of the specified rectangle. + * @index Specify the line. + */ + GetZoneContent(index: number): string; +} +export interface Letter { + /** + * Return the text of the letter. + */ + GetText(): number; + /** + * Return the coordinates for the rectangle that contains the specified letter. The coordinates are in the sequence of "left,top,right,bottom" like "121,125,123,143". + */ + GetLetterRect(): string; +} +export interface Settings { + /** + * Specify the target language. + */ + Languages: string; + /** + * Specify the URL for the license checker. + */ + LicenseChecker: string; + /** + * Specify the output format. + */ + OutputFormat: Dynamsoft.EnumDWT_OCRProOutputFormat | string; + /** + * Specify the PDF/A version. + */ + PDFAVersion: Dynamsoft.EnumDWT_OCRProPDFAVersion | string; + /** + * Specify the PDF version. + */ + PDFVersion: Dynamsoft.EnumDWT_OCRProPDFVersion | string; + /** + * Specify the recognition module. + */ + RecognitionModule: Dynamsoft.EnumDWT_OCRProRecognitionModule | string; + /** + * Configure the redaction. + */ + Redaction: Redaction; +} +export interface Redaction { + /** + * Specify the text to redact. + */ + FindText: string; + /** + * Specify how the text is found. + */ + FindTextFlags: Dynamsoft.EnumDWT_OCRFindTextFlags | number; + /** + * Specify how redaction is done. + */ + FindTextAction: Dynamsoft.EnumDWT_OCRFindTextAction | number; +} diff --git a/types/dwt/Addon.PDF.d.ts b/types/dwt/Addon.PDF.d.ts new file mode 100644 index 0000000000..19baea08e9 --- /dev/null +++ b/types/dwt/Addon.PDF.d.ts @@ -0,0 +1,110 @@ +import { DynamsoftEnums as Dynamsoft } from "./Dynamsoft.Enum"; + +export interface PDF { + /** + * Convert the specified PDF file to image(s). + * @param path The path of the PDF file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + ConvertToImage( + path: string, + resolution: number, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Return the convert mode. + */ + GetConvertMode(): number; + /** + * Return whether the PDF module has been installed. + */ + IsModuleInstalled(): boolean; + /** + * Detect whether a local PDF file is text based or not. + * @path Specify the path of the PDF file. + */ + IsTextBasedPDF(path: string): boolean; + /** + * Set the convert mode. + * @param mode Specify the mode. + */ + SetConvertMode(mode: Dynamsoft.EnumDWT_ConvertMode | number): boolean; + /** + * Set the password for reading encrypted PDF files. + * @param password Specify the password. + */ + SetPassword(password: string): boolean; + /** + * Set the resolution for rasterizing. + * @param resolution Specify the resolution. + */ + SetResolution(resolution: number): boolean; + /** + * Set up the PDF writing engine. + */ + Write: Write; +} +export interface Write { + /** + * Set up the PDF writing engine. + * @param settings Configures how the PDF is generated. + */ + Setup(settings: PDFWSetting): void; +} +export interface PDFWSetting { + /** + * Specify the author. + */ + author: string; + /** + * Specify the compression type. + */ + compression: Dynamsoft.EnumDWT_PDFCompressionType | number; + /** + * Specify the creator. + */ + creator: string; + /** + * Specify the creation date. + * Note that the argument should start with 'D:' like 'D:20181231'. + */ + creationDate: string; + /** + * Specify the key words. + */ + keyWords: string; + /** + * Specify the modified date. + * Note that the argument should start with 'D:' like 'D:20181231'. + */ + modifiedDate: string; + /** + * Specify the producer. + */ + producer: string; + /** + * Specify the subject. + */ + subject: string; + /** + * Specify the title. + */ + title: string; + /** + * Specify the PDF version. For example, '1.5'. + */ + version: string; + /** + * Specify the quality of the images in the file. + * The value ranges from 0 to 100. + * Only valid when the {compression} is 'JPEG' or 'JPEG2000'. + */ + quality: number; +} diff --git a/types/dwt/Addon.Webcam.d.ts b/types/dwt/Addon.Webcam.d.ts new file mode 100644 index 0000000000..0445574ac7 --- /dev/null +++ b/types/dwt/Addon.Webcam.d.ts @@ -0,0 +1,257 @@ +import { DynamsoftEnums as Dynamsoft } from "./Dynamsoft.Enum"; +import { WebTwain } from "./WebTwain"; + +export interface Webcam { + /** + * Return whether the Webcam module has been installed. + */ + IsModuleInstalled(): boolean; + /** + * Capture an image from the current camera. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error String + */ + CaptureImage( + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Return a list of all available cameras. + */ + GetSourceList(): string[]; + /** + * Select a camera to use. + * @param name Specify the camera. + */ + SelectSource(name: string): boolean; + /** + * Close the current camera. + */ + CloseSource(): boolean; + /** + * Start to play the video stream from the current camera. + * @param DWObject Specify a WebTwain instance to show the video. + * @param quality Specify the quality of the video. + * @param frameDidShow A callback function that is triggered after each video frame is shown. + */ + PlayVideo( + DWObject: WebTwain, + quality: number, + frameDidShow?: () => void + ): boolean; + /** + * Pause the video. + */ + PauseVideo(): boolean; + /** + * Stop the video. + */ + StopVideo(): boolean; + /** + * Return information about the specified camera property. + * @param property Specify the property. + */ + GetCameraControlPropertySetting( + property: Dynamsoft.EnumDWT_CameraControlProperty | number + ): CameraControlProperty; + /** + * Return detailed information about the specified camera property. + * @param property Specify the property. + */ + GetCameraControlPropertyMoreSetting( + property: Dynamsoft.EnumDWT_CameraControlProperty | number + ): CameraControlPropertyExtra; + /** + * Set the specified camera property. + * @param property Specify the property. + * @param value Specify the value. + * @param auto Specify whether the propery should change automatically. + */ + SetCameraControlPropertySetting( + property: Dynamsoft.EnumDWT_CameraControlProperty | number, + value: number, + auto: boolean + ): boolean; + /** + * Return information about the specified video property. + * @param property Specify the property. + */ + GetVideoPropertySetting( + property: Dynamsoft.EnumDWT_VideoProperty | number + ): VideoControlProperty; + /** + * Return detailed information about the specified video property. + * @param property Specify the property. + */ + GetVideoPropertyMoreSetting( + property: Dynamsoft.EnumDWT_VideoProperty | number + ): VideoControlPropertyExtra; + /** + * Set the specified video property. + * @param property Specify the property. + * @param value Specify the value. + * @param auto Specify whether the propery should change automatically. + */ + SetVideoPropertySetting( + property: Dynamsoft.EnumDWT_VideoProperty | number, + value: number, + auto: boolean + ): boolean; + /** + * Return the frame rates supported by the current camera. + */ + GetFrameRate(): FrameRate; + /** + * Return the media types supported by the current camera. + */ + GetMediaType(): MediaType; + /** + * Return the resolutions supported by the current camera. + */ + GetResolution(): Resolution; + /** + * Set the frame rate. + * @param rate Specify the frame rate. + */ + SetFrameRate(rate: number): boolean; + /** + * Set the media type. + * @param type Sepcify the media type. + */ + SetMediaType(type: string): boolean; + /** + * Set the resolution. + * @param resolution Specify the resolution. + */ + SetResolution(resolution: string): boolean; + /** + * Rotate the video. + * @param mode Specify the rotate mode + */ + SetVideoRotateMode( + mode: Dynamsoft.EnumDWT_VideoRotateMode | number + ): boolean; + /** + * Return the URL (http(s)://) for the latest frame. + */ + GetFrameURL(): string; + /** + * Return the internal URL (dwt://) for the latest frame. + */ + GetFramePartURL(): string; +} +export interface FrameRate { + /** + * Return the number of available frame rates. + */ + GetCount(): number; + /** + * Return the specified frame rate. + */ + Get(index: number): number; + /** + * Return the current frame rate. + */ + GetCurrent(): number; +} +export interface MediaType { + /** + * Return the number of available media types. + */ + GetCount(): number; + /** + * Return the specified media type. + */ + Get(index: number): string; + /** + * Return the current media type. + */ + GetCurrent(): string; + /** + * internal use + */ + _resultlist: any; +} +export interface Resolution { + /** + * Return the number of available resolutions. + */ + GetCount(): number; + /** + * Return the specified resolution. + */ + Get(index: number): string; + /** + * Return the current resolution. + */ + GetCurrent(): string; +} +export interface VideoControlProperty { + /** + * Return the value of the property. + */ + GetValue(): number; + /** + * Return whether the property is set autmatically or not. + */ + GetIfAuto(): boolean; +} +export interface VideoControlPropertyExtra { + /** + * Return the minimum value of the property. + */ + GetMinValue(): number; + /** + * Return the maximum value of the property. + */ + GetMaxValue(): number; + /** + * Return the default value of the property. + */ + GetDefaultValue(): number; + /** + * Return the smallest increment by which the property can change. + */ + GetSteppingDelta(): number; + /** + * Return whether the property is set autmatically or not. + */ + GetIfAuto(): boolean; +} +export interface CameraControlProperty { + /** + * Return the value of the property. + */ + GetValue(): number; + /** + * Return whether the property is set autmatically or not. + */ + GetIfAuto(): boolean; +} +export interface CameraControlPropertyExtra { + /** + * Return the minimum value of the property. + */ + GetMinValue(): number; + /** + * Return the maximum value of the property. + */ + GetMaxValue(): number; + /** + * Return the default value of the property. + */ + GetDefaultValue(): number; + /** + * Return the smallest increment by which the property can change. + */ + GetSteppingDelta(): number; + /** + * Return whether the property is set autmatically or not. + */ + GetIfAuto(): boolean; +} diff --git a/types/dwt/Dynamsoft.Enum.d.ts b/types/dwt/Dynamsoft.Enum.d.ts new file mode 100644 index 0000000000..650755177c --- /dev/null +++ b/types/dwt/Dynamsoft.Enum.d.ts @@ -0,0 +1,1630 @@ +export namespace DynamsoftEnums { + /** Barcode Format */ + enum EnumBarcodeFormat { + BF_ALL = -32505857, + BF_AZTEC = 268435456, + BF_CODABAR = 8, + BF_CODE_39 = 1, + BF_CODE_39_EXTENDED = 1024, + BF_CODE_93 = 4, + BF_CODE_128 = 2, + BF_DATAMATRIX = 134217728, + BF_EAN_8 = 64, + BF_EAN_13 = 32, + BF_GS1_COMPOSITE = -2147483648, + BF_GS1_DATABAR = 260096, + BF_GS1_DATABAR_EXPANDED = 32768, + BF_GS1_DATABAR_EXPANDED_STACKED = 65536, + BF_GS1_DATABAR_LIMITED = 131072, + BF_GS1_DATABAR_OMNIDIRECTIONAL = 2048, + BF_GS1_DATABAR_STACKED = 8192, + BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL = 16384, + BF_GS1_DATABAR_TRUNCATED = 4096, + BF_INDUSTRIAL_25 = 512, + BF_ITF = 16, + BF_MAXICODE = 536870912, + BF_MICRO_PDF417 = 524288, + BF_MICRO_QR = 1073741824, + BF_NULL = 0, + BF_ONED = 2047, + BF_PATCHCODE = 262144, + BF_PDF417 = 33554432, + BF_QR_CODE = 67108864, + BF_UPC_A = 128, + BF_UPC_E = 256 + } + /** Barcode Format 2 */ + enum EnumBarcodeFormat_2 { + BF2_AUSTRALIANPOST = 8388608, + BF2_DOTCODE = 2, + BF2_NONSTANDARD_BARCODE = 1, + BF2_NULL = 0, + BF2_PLANET = 4194304, + BF2_POSTALCODE = 32505856, + BF2_POSTNET = 2097152, + BF2_RM4SCC = 16777216, + BF2_USPSINTELLIGENTMAIL = 1048576 + } + /** Barcode Color Mode */ + enum EnumBarcodeColourMode { + BICM_DARK_LIGHT_MIXED = 16, + BICM_DARK_ON_DARK = 4, + BICM_DARK_ON_LIGHT = 1, + BICM_DARK_ON_LIGHT_DARK_SURROUNDING = 32, + BICM_LIGHT_ON_DARK = 2, + BICM_LIGHT_ON, _LIGHT = 8, + BICM_SKIP = 0, + } + /** Barcode Complement Mode */ + enum EnumBarcodeComplementMode { + BCM_AUTO = 1, + BCM_GENERAL = 2, + BCM_SKIP = 0 + } + /** OCR Languages */ + 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" + } + /** OCR PageSet Mode */ + 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 + } + /** OCR Output Format */ + enum EnumDWT_OCROutputFormat { + OCROF_TEXT = 0, + OCROF_PDFPLAINTEXT = 1, + OCROF_PDFIMAGEOVERTEXT = 2, + OCROF_PDFPLAINTEXT_PDFX = 3, + OCROF_PDFIMAGEOVERTEXT_PDFX = 4 + } + /** OCR Download Type */ + enum EnumDWT_OCRDownloadType { + OCRDT_Dll = 0, + OCRDT_LANGUAGE = 1 + } + /** OCRPro Reconnition module */ + enum EnumDWT_OCRProRecognitionModule { + OCRPM_AUTO = "AUTO", + OCRPM_MOSTACCURATE = "MOSTACCURATE", + OCRPM_BALANCED = "BALANCED", + OCRPM_FASTEST = "FASTEST" + } + /** OCRPro Output Format */ + enum EnumDWT_OCRProOutputFormat { + OCRPFT_TXTS = "TXTS", + OCRPFT_TXTCSV = "TXTCSV", + OCRPFT_TXTF = "TXTF", + OCRPFT_XML = "XML", + OCRPFT_IOTPDF = "IOTPDF", + OCRPFT_IOTPDF_MRC = "IOTPDF_MRC" + } + /** OCRPro PDF Version */ + 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" + } + /** OCRPro PDFA Version */ + 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" + } + /** OCRPro Type */ + enum EnumDWT_OCRProType { + OCRDT_File = 0, + OCRDT_Index = 1 + } + /** OCRPro Find Text Flags */ + enum EnumDWT_OCRFindTextFlags { + OCRFT_WHOLEWORD = 1, + OCRFT_MATCHCASE = 2, + OCRFT_FUZZYMATCH = 4 + // OCRFT_BACKWARD= 8 + } + /** OCRPro Find Text Action */ + enum EnumDWT_OCRFindTextAction { + OCRFT_HIGHLIGHT = 0, + OCRFT_STRIKEOUT = 1, + OCRFT_MARKFORREDACT = 2 + } + enum EnumDWT_ConvertMode { + CM_DEFAULT = 0, + CM_RENDERALL = 1 + } + /** -2400 to -2499 is webcam error code */ + 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. */ + 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. */ + 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. */ + 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 + } + /** Border Styles */ + enum EnumDWT_BorderStyle { + /** No border. */ + TWBS_NONE = 0, + /** Flat border. */ + TWBS_SINGLEFLAT = 1, + /** 3D border. */ + TWBS_SINGLE3D = 2 + } + /** Capabilities */ + enum EnumDWT_Cap { + /** Nothing. */ + CAP_NONE = 0, + /** The application is willing to accept this number of images. */ + CAP_XFERCOUNT = 1, + /** + * Allows the application and Source to identify which compression schemes they have in + * common for Buffered Memory and File transfers. + * Note for File transfers: + * Since only certain file formats support compression, this capability must be negotiated after + * setting the desired file format with ICAP_IMAGEFILEFORMAT. + */ + ICAP_COMPRESSION = 256, + /** The type of pixel data that a Source is capable of acquiring (for example, black and white, gray, RGB, etc.). */ + ICAP_PIXELTYPE = 257, + /** + * Unless a quantity is dimensionless or uses a specified unit of measure, ICAP_UNITS determines + * the unit of measure for all quantities. + */ + ICAP_UNITS = 258, + /** Allows the application and Source to identify which transfer mechanisms the source supports. */ + ICAP_XFERMECH = 259, + /** The name or other identifying information about the Author of the image. It may include a copyright string. */ + CAP_AUTHOR = 4096, + /** A general note about the acquired image. */ + CAP_CAPTION = 4097, + /** + * If TRUE, Source must acquire data from the document feeder acquire area and other feeder + * capabilities can be used. If FALSE, Source must acquire data from the non-feeder acquire area + * and no other feeder capabilities can be used. + */ + CAP_FEEDERENABLED = 4098, + /** Reflect whether there are documents loaded in the Source's feeder. */ + CAP_FEEDERLOADED = 4099, + /** + * The date and time the image was acquired. + * Stored in the form "YYYY/MM/DD HH:mm:SS.sss" where YYYY is the year, MM is the + * numerical month, DD is the numerical day, HH is the hour, mm is the minute, SS is the second, + * and sss is the millisecond. + */ + CAP_TIMEDATE = 4100, + /** + * Returns a list of all the capabilities for which the Source will answer inquiries. Does not indicate + * which capabilities the Source will allow to be set by the application. Some capabilities can only + * be set if certain setup work has been done so the Source cannot globally answer which + * capabilities are "set-able." + */ + CAP_SUPPORTEDCAPS = 4101, + /** Allows the application and Source to negotiate capabilities to be used in States 5 and 6. */ + CAP_EXTENDEDCAPS = 4102, + /** + * If TRUE, the Source will automatically feed the next page from the document feeder after the + * number of frames negotiated for capture from each page are acquired. CAP_FEEDERENABLED + * must be TRUE to use this capability. + */ + CAP_AUTOFEED = 4103, + /** + * If TRUE, the Source will eject the current page being acquired from and will leave the feeder + * acquire area empty. + * If CAP_AUTOFEED is TRUE, a fresh page will be advanced. + * CAP_FEEDERENABLED must equal TRUE to use this capability. + * This capability must have been negotiated as an extended capability to be used in States 5 and 6. + */ + CAP_CLEARPAGE = 4104, + /** + * If TRUE, the Source will eject the current page and advance the next page in the document feeder + * into the feeder acquire area. + * If CAP_AUTOFEED is TRUE, the same action just described will occur and CAP_AUTOFEED will + * remain active. + * CAP_FEEDERENABLED must equal TRUE to use this capability. + * This capability must have been negotiated as an extended capability to be used in States 5 and 6. + */ + CAP_FEEDPAGE = 4105, + /** + * If TRUE, the Source will return the current page to the input side of the document feeder and + * feed the last page from the output side of the feeder back into the acquisition area. + * If CAP_AUTOFEED is TRUE, automatic feeding will continue after all negotiated frames from this + * page are acquired. + * CAP_FEEDERENABLED must equal TRUE to use this capability. + * This capability must have been negotiated as an extended capability to be used in States 5 and 6. + */ + CAP_REWINDPAGE = 4106, + /** + * If TRUE, the Source will display a progress indicator during acquisition and transfer, regardless + * of whether the Source's user interface is active. If FALSE, the progress indicator will be + * suppressed if the Source's user interface is inactive. + * The Source will continue to display device-specific instructions and error messages even with + * the Source user interface and progress indicators turned off. + */ + CAP_INDICATORS = 4107, + /** + * Returns a list of all the capabilities for which the Source will answer inquiries. Does not indicate + * which capabilities the Source will allow to be set by the application. Some capabilities can only + * be set if certain setup work has been done so the Source cannot globally answer which + * capabilities are "set-able." + */ + CAP_SUPPORTEDCAPSEXT = 4108, + /** This capability determines whether the device has a paper sensor that can detect documents on the ADF or Flatbed. */ + CAP_PAPERDETECTABLE = 4109, + /** + * If TRUE, indicates that this Source supports acquisition with the UI disabled; i.e., + * TW_USERINTERFACE's ShowUI field can be set to FALSE. If FALSE, indicates that this Source + * can only support acquisition with the UI enabled. + */ + CAP_UICONTROLLABLE = 4110, + /** + * If TRUE, the physical hardware (e.g., scanner, digital camera, image database, etc.) that + * represents the image source is attached, powered on, and communicating. + */ + CAP_DEVICEONLINE = 4111, + /** + * This capability is intended to boost the performance of a Source. The fundamental assumption + * behind AutoScan is that the device is able to capture the number of images indicated by the + * value of CAP_XFERCOUNT without waiting for the Application to request the image transfers. + * This is only possible if the device has internal buffers capable of caching the images it captures. + * The default behavior is undefined, because some high volume devices are incapable of anything + * but CAP_AUTOSCAN being equal to TRUE. However, if a Source supports FALSE, it should use it + * as the mandatory default, since this best describes the behavior of pre-1.8 TWAIN Applications. + */ + CAP_AUTOSCAN = 4112, + /** + * Allows an application to request the delivery of thumbnail representations for the set of images + * that are to be delivered. + * Setting CAP_THUMBNAILSENABLED to TRUE turns on thumbnail mode. Images transferred + * thereafter will be sent at thumbnail size (exact thumbnail size is determined by the Data Source). + * Setting this capability to FALSE turns thumbnail mode off and returns full size images. + */ + CAP_THUMBNAILSENABLED = 4113, + /** + * This indicates whether the scanner supports duplex. If so, it further indicates whether one-path + * or two-path duplex is supported. + */ + CAP_DUPLEX = 4114, + /** + * The user can set the duplex option to be TRUE or FALSE. If TRUE, the scanner scans both sides + * of a paper; otherwise, the scanner will scan only one side of the image. + */ + CAP_DUPLEXENABLED = 4115, + /** Allows an application to query a source to see if it implements the new user interface settings dialog. */ + CAP_ENABLEDSUIONLY = 4116, + CAP_CUSTOMDSDATA = 4117, + /** + * Allows the application to specify the starting endorser / imprinter number. All other endorser/ + * imprinter properties should be handled through the data source's user interface. + * The user can set the starting number for the endorser. + */ + CAP_ENDORSER = 4118, + /** Turns specific audible alarms on and off. */ + CAP_ALARMS = 4120, + /** + * The volume of a device's audible alarm. Note that this control affects the volume of all alarms; + * no specific volume control for individual types of alarms is provided. + */ + CAP_ALARMVOLUME = 4121, + /** + * The number of images to automatically capture. This does not refer to the number of images to + * be sent to the Application, use CAP_XFERCOUNT for that. + */ + CAP_AUTOMATICCAPTURE = 4122, + /** + * For automatic capture, this value selects the number of milliseconds before the first picture is to + * be taken, or the first image is to be scanned. + */ + CAP_TIMEBEFOREFIRSTCAPTURE = 4123, + /** For automatic capture, this value selects the milliseconds to wait between pictures taken, or images scanned. */ + CAP_TIMEBETWEENCAPTURES = 4124, + /** CapGet() reports the presence of data in the scanner's buffers. CapSet() with a value of TWCB_CLEAR immediately clears the buffers. */ + CAP_CLEARBUFFERS = 4125, + /** Describes the number of pages that the scanner can buffer when CAP_AUTOSCAN is enabled. */ + CAP_MAXBATCHBUFFERS = 4126, + /** + * The date and time of the device's clock. + * Managed in the form "YYYY/MM/DD HH:mm:SS:sss" where YYYY is the year, MM is the + * numerical month, DD is the numerical day, HH is the hour, mm is the minute, SS is the second, + * and sss is the millisecond. + */ + CAP_DEVICETIMEDATE = 4127, + /** CapGet() reports the kinds of power available to the device. CapGetCurrent() reports the current power supply in use. */ + CAP_POWERSUPPLY = 4128, + /** This capability queries the Source for UI support for preview mode. If TRUE, the Source supports preview UI. */ + CAP_CAMERAPREVIEWUI = 4129, + /** + * A string containing the serial number of the currently selected device in the Source. Multiple + * devices may all report the same serial number. + */ + CAP_SERIALNUMBER = 4132, + /** + * CapGet() returns the current list of available printer devices, along with the one currently being used for negotiation. + * CapSet() selects the current device for negotiation, and optionally constrains the list. + * Top/Bottom refers to duplex devices, and indicates if the printer is writing on the top or the bottom of the sheet of paper. + * Simplex devices use the top settings. Before/After indicates whether printing occurs before or after the sheet of paper has been scanned. + */ + CAP_PRINTER = 4134, + /** Turns the current CAP_PRINTER device on or off. */ + CAP_PRINTERENABLED = 4135, + /** The User can set the starting number for the current CAP_PRINTER device. */ + CAP_PRINTERINDEX = 4136, + /** + * Specifies the appropriate current CAP_PRINTER device mode. + * Note: + * O TWPM_SINGLESTRING specifies that the printed text will consist of a single string. + * O TWPM _MULTISTRING specifies that the printed text will consist of an enumerated list of + * strings to be printed in order. + * O TWPM _COMPOUNDSTRING specifies that the printed string will consist of a compound of a + * String followed by a value followed by a suffix string. + */ + CAP_PRINTERMODE = 4137, + /** + * Specifies the string(s) that are to be used in the string component when the current + * CAP_PRINTER device is enabled. + */ + CAP_PRINTERSTRING = 4138, + /** Specifies the string that shall be used as the current CAP_PRINTER device's suffix. */ + CAP_PRINTERSUFFIX = 4139, + /** + * Allows Application and Source to identify which languages they have in common for the exchange of string data, + * and to select the language of the internal UI. Since the TWLG_xxxx codes include language and country data, there is no separate + * capability for selecting the country. + */ + CAP_LANGUAGE = 4140, + /** + * Helps the Application determine any special actions it may need to take when negotiating + * frames with the Source. Allowed values are listed in . + * TWFA_NONE: The alignment is free-floating. Applications should assume + * that the origin for frames is on the left. + * TWFA_LEFT: The alignment is to the left. + * TWFA_CENTER: The alignment is centered. This means that the paper will + * be fed in the middle of the ICAP_PHYSICALWIDTH of the + * device. If this is set, then the Application should calculate + * any frames with a left offset of zero. + * TWFA_RIGHT: The alignment is to the right. + */ + CAP_FEEDERALIGNMENT = 4141, + /** + * TWFO_FIRSTPAGEFIRST if the feeder starts with the top of the first page. + * TWFO_LASTPAGEFIRST is the feeder starts with the top of the last page. + */ + CAP_FEEDERORDER = 4142, + /** + * Indicates whether the physical hardware (e.g. scanner, digital camera) is capable of acquiring + * multiple images of the same page without changes to the physical registration of that page. + */ + CAP_REACQUIREALLOWED = 4144, + /** The minutes of battery power remaining to the device. */ + CAP_BATTERYMINUTES = 4146, + /** When used with CapGet(), return the percentage of battery power level on camera. If -1 is returned, it indicates that the battery is not present. */ + CAP_BATTERYPERCENTAGE = 4147, + /** Added 1.91 */ + CAP_CAMERASIDE = 4148, + /** Added 1.91 */ + CAP_SEGMENTED = 4149, + /** Added 2.0 */ + CAP_CAMERAENABLED = 4150, + /** Added 2.0 */ + CAP_CAMERAORDER = 4151, + /** Added 2.0 */ + CAP_MICRENABLED = 4152, + /** Added 2.0 */ + CAP_FEEDERPREP = 4153, + /** Added 2.0 */ + CAP_FEEDERPOCKET = 4154, + /** Added 2.1 */ + CAP_AUTOMATICSENSEMEDIUM = 4155, + /** Added 2.1 */ + CAP_CUSTOMINTERFACEGUID = 4156, + /** TRUE enables and FALSE disables the Source's Auto-brightness function (if any). */ + ICAP_AUTOBRIGHT = 4352, + /** The brightness values available within the Source. */ + ICAP_BRIGHTNESS = 4353, + /** The contrast values available within the Source. */ + ICAP_CONTRAST = 4355, + /** Specifies the square-cell halftone (dithering) matrix the Source should use to halftone the image. */ + ICAP_CUSTHALFTONE = 4356, + /** Specifies the exposure time used to capture the image, in seconds. */ + ICAP_EXPOSURETIME = 4357, + /** + * Describes the color characteristic of the subtractive filter applied to the image data. + * Multiple filters may be applied to a single acquisition. + */ + ICAP_FILTER = 4358, + /** Specifies whether or not the image was acquired using a flash. */ + ICAP_FLASHUSED = 4359, + /** Gamma correction value for the image data. */ + ICAP_GAMMA = 4360, + /** A list of names of the halftone patterns available within the Source. */ + ICAP_HALFTONES = 4361, + /** + * Specifies which value in an image should be interpreted as the lightest "highlight." All values + * "lighter" than this value will be clipped to this value. Whether lighter values are smaller or + * larger can be determined by examining the Current value of ICAP_PIXELFLAVOR. + */ + ICAP_HIGHLIGHT = 4362, + /** + * Informs the application which file formats the Source can generate (CapGet()). Tells the Source which file formats the application can handle (CapSet()). + * TWFF_TIFF Used for document + * TWFF_PICT Native Macintosh + * TWFF_BMP Native Microsoft + * TWFF_XBM Used for document + * TWFF_JFIF Wrapper for JPEG + * TWFF_FPX FlashPix, used with digital + * TWFF_TIFFMULTI Multi-page TIFF files + * TWFF_PNG An image format standard intended for use on the web, replaces GIF + * TWFF_SPIFF A standard from JPEG, intended to replace JFIF, also supports JBIG + * TWFF_EXIF File format for use with digital cameras. + */ + ICAP_IMAGEFILEFORMAT = 4364, + /** TRUE means the lamp is currently, or should be set to ON. Sources may not support CapSet() operations. */ + ICAP_LAMPSTATE = 4365, + /** Describes the general color characteristic of the light source used to acquire the image. */ + ICAP_LIGHTSOURCE = 4366, + /** + * Defines which edge of the "paper" the image's "top" is aligned with. This information is used to adjust the frames to match the + * scanning orientation of the paper. For instance, if an ICAP_SUPPORTEDSIZE of TWSS_ISOA4 has been negotiated, + * and ICAP_ORIENTATION is set to TWOR_LANDSCAPE, then the Source must rotate the frame it downloads to the scanner to reflect the + * orientation of the paper. Please note that setting ICAP_ORIENTATION does not affect the values reported by ICAP_FRAMES; + * it just causes the Source to use them in a different way. The upper-left of the image is defined as the location where both the primary and + * secondary scans originate. (The X axis is the primary scan direction and the Y axis is the secondary scan direction.) + * For a flatbed scanner, the light bar moves in the secondary scan direction. For a handheld scanner, the scanner is drug in the + * secondary scan direction. For a digital camera, the secondary direction is the vertical axis when the viewed image is considered upright. + */ + ICAP_ORIENTATION = 4368, + /** The maximum physical width (X-axis) the Source can acquire (measured in units of ICAP_UNITS). */ + ICAP_PHYSICALWIDTH = 4369, + /** The maximum physical height (Y-axis) the Source can acquire (measured in units of ICAP_UNITS). */ + ICAP_PHYSICALHEIGHT = 4370, + /** + * Specifies which value in an image should be interpreted as the darkest "shadow." All values + * "darker" than this value will be clipped to this value. + */ + ICAP_SHADOW = 4371, + /** The list of frames the Source will acquire on each page. */ + ICAP_FRAMES = 4372, + /** + * The native optical resolution along the X-axis of the device being controlled by the Source. Most + * devices will respond with a single value (TW_ONEVALUE). + * This is NOT a list of all resolutions that can be generated by the device. Rather, this is the + * resolution of the device's optics. Measured in units of pixels per unit as defined by + * ICAP_UNITS (pixels per TWUN_PIXELS yields dimensionless data). + */ + ICAP_XNATIVERESOLUTION = 4374, + /** + * The native optical resolution along the Y-axis of the device being controlled by the Source. + * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS + * yields dimensionless data). + */ + ICAP_YNATIVERESOLUTION = 4375, + /** + * All the X-axis resolutions the Source can provide. + * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS + * yields dimensionless data). That is, when the units are TWUN_PIXELS, both + * ICAP_XRESOLUTION and ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources + * like to report the actual number of pixels that the device reports, but that response is more + * appropriate in ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. + */ + ICAP_XRESOLUTION = 4376, + /** + * All the Y-axis resolutions the Source can provide. + * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS + * yields dimensionless data). That is, when the units are TWUN_PIXELS, both + * ICAP_XRESOLUTION and ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources + * like to report the actual number of pixels that the device reports, but that response is more + * appropriate in ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. + */ + ICAP_YRESOLUTION = 4377, + /** + * The maximum number of frames the Source can provide or the application can accept per page. + * This is a bounding capability only. It does not establish current or future behavior. + */ + ICAP_MAXFRAMES = 4378, + /** This is used with buffered memory transfers. If TRUE, Source can provide application with tiled image data. */ + ICAP_TILES = 4379, + /** + * Specifies how the bytes in an image are filled by the Source. TWBO_MSBFIRST indicates that the leftmost bit in the byte (usually bit 7) is + * the byte's Most Significant Bit. + */ + ICAP_BITORDER = 4380, + /** + * Used for CCITT Group 3 2-dimensional compression. The 'K' factor indicates how often the + * new compression baseline should be re-established. A value of 2 or 4 is common in facsimile + * communication. A value of zero in this field will indicate an infinite K factor—the baseline is + * only calculated at the beginning of the transfer. + */ + ICAP_CCITTKFACTOR = 4381, + /** Describes whether the image was captured transmissively or reflectively. */ + ICAP_LIGHTPATH = 4382, + /** Sense of the pixel whose numeric value is zero (minimum data value). */ + ICAP_PIXELFLAVOR = 4383, + /** + * Allows the application and Source to identify which color data formats are available. There are + * two options, "planar" and "chunky." + */ + ICAP_PLANARCHUNKY = 4384, + /** + * How the Source can/should rotate the scanned image data prior to transfer. This doesn't use + * ICAP_UNITS. It is always measured in degrees. Any applied value is additive with any + * rotation specified in ICAP_ORIENTATION. + */ + ICAP_ROTATION = 4385, + /** + * For devices that support fixed frame sizes. + * Defined sizes match typical page sizes. This specifies the size(s) the Source can/should use to acquire image data. + */ + ICAP_SUPPORTEDSIZES = 4386, + /** + * Specifies the dividing line between black and white. This is the value the Source will use to + * threshold, if needed, when ICAP_PIXELTYPE:TWPT_BW. + * The value is normalized so there are no units of measure associated with this ICAP. + */ + ICAP_THRESHOLD = 4387, + /** + * All the X-axis scaling values available. A value of '1.0' is equivalent to 100% scaling. + * Do not use values less than or equal to zero. + */ + ICAP_XSCALING = 4388, + /** + * All the Y-axis scaling values available. A value of '1.0' is equivalent to 100% scaling. Do not use values less than or equal to zero. + * There are no units inherent with this data as it is normalized to 1.0 being "unscaled." + */ + ICAP_YSCALING = 4389, + /** Used for CCITT data compression only. Indicates the bit order representation of the stored compressed codes. */ + ICAP_BITORDERCODES = 4390, + /** + * Used only for CCITT data compression. Specifies whether the compressed codes' pixel "sense" + * will be inverted from the Current value of ICAP_PIXELFLAVOR prior to transfer. + */ + ICAP_PIXELFLAVORCODES = 4391, + /** + * Allows the application and Source to agree upon a common set of color descriptors that are + * made available by the Source. This ICAP is only useful for JPEG-compressed buffered memory image transfers. + */ + ICAP_JPEGPIXELTYPE = 4392, + /** Used only with CCITT data compression. Specifies the minimum number of words of compressed codes (compressed data) to be transmitted per line. */ + ICAP_TIMEFILL = 4394, + /** + * Specifies the pixel bit depths for the Current value of ICAP_PIXELTYPE. For example, when + * using ICAP_PIXELTYPE:TWPT_GRAY, this capability specifies whether this is 8-bit gray or 4-bit gray. + * This depth applies to all the data channels (for instance, the R, G, and B channels will all have + * this same bit depth for RGB data). + */ + ICAP_BITDEPTH = 4395, + /** + * Specifies the Reduction Method the Source should use to reduce the bit depth of the data. Most + * commonly used with ICAP_PIXELTYPE:TWPT_BW to reduce gray data to black and white. + */ + ICAP_BITDEPTHREDUCTION = 4396, + /** + * If TRUE the Source will issue a MSG_XFERREADY before starting the scan. + * Note: The Source may need to scan the image before initiating the transfer. + * This is the case if the scanned image is rotated or merged with another scanned image. + */ + ICAP_UNDEFINEDIMAGESIZE = 4397, + /** + * Allows the application to query the data source to see if it supports extended image attribute capabilities, + * such as Barcode Recognition, Shaded Area Detection and Removal, Skew detection and Removal, and so on. + */ + ICAP_EXTIMAGEINFO = 4399, + /** Allows the source to define the minimum height (Y-axis) that the source can acquire. */ + ICAP_MINIMUMHEIGHT = 4400, + /** Allows the source to define theminimum width (X-axis) that the source can acquire. */ + ICAP_MINIMUMWIDTH = 4401, + /** + * Use this capability to have the Source discard blank images. The Application never sees these + * images during the scanning session. + * TWBP_DISABLE – this must be the default state for the Source. It indicates that all images will + * be delivered to the Application, none of them will be discarded. + * TWBP_AUTO – if this is used, then the Source will decide if an image is blank or not and discard + * as appropriate. + * If the specified value is a positive number in the range 0 to 231–1, then this capability will use it + * as the byte size cutoff point to identify which images are to be discarded. If the size of the image + * is less than or equal to this value, then it will be discarded. If the size of the image is greater + * than this value, then it will be kept so that it can be transferred to the Application. + */ + ICAP_AUTODISCARDBLANKPAGES = 4404, + /** + * Flip rotation is used to properly orient images that flip orientation every other image. + * TWFR_BOOK The images to be scanned are viewed in book form, flipping each page from left to right or right to left. + * TWFR_FANFOLD The images to be scanned are viewed in fanfold paper style, flipping each page up or down. + */ + ICAP_FLIPROTATION = 4406, + /** Turns bar code detection on and off. */ + ICAP_BARCODEDETECTIONENABLED = 4407, + /** Provides a list of bar code types that can be detected by the current Data Source. */ + ICAP_SUPPORTEDBARCODETYPES = 4408, + /** The maximum number of supported search priorities. */ + ICAP_BARCODEMAXSEARCHPRIORITIES = 4409, + /** A prioritized list of bar code types dictating the order in which bar codes will be sought. */ + ICAP_BARCODESEARCHPRIORITIES = 4410, + /** Restricts bar code searching to certain orientations, or prioritizes one orientation over the other. */ + ICAP_BARCODESEARCHMODE = 4411, + /** Restricts the number of times a search will be retried if none are found on each page. */ + ICAP_BARCODEMAXRETRIES = 4412, + /** Restricts the total time spent on searching for a bar code on each page. */ + ICAP_BARCODETIMEOUT = 4413, + /** When used with CapGet(), returns all camera supported lens zooming range. */ + ICAP_ZOOMFACTOR = 4414, + /** Turns patch code detection on and off. */ + ICAP_PATCHCODEDETECTIONENABLED = 4415, + /** A list of patch code types that may be detected by the current Data Source. */ + ICAP_SUPPORTEDPATCHCODETYPES = 4416, + /** The maximum number of supported search priorities. */ + ICAP_PATCHCODEMAXSEARCHPRIORITIES = 4417, + /** A prioritized list of patch code types dictating the order in which patch codes will be sought. */ + ICAP_PATCHCODESEARCHPRIORITIES = 4418, + /** Restricts patch code searching to certain orientations, or prioritizes one orientation over the other. */ + ICAP_PATCHCODESEARCHMODE = 4419, + /** Restricts the number of times a search will be retried if none are found on each page. */ + ICAP_PATCHCODEMAXRETRIES = 4420, + /** Restricts the total time spent on searching for a patch code on each page. */ + ICAP_PATCHCODETIMEOUT = 4421, + /** + * For devices that support flash. CapSet() selects the flash to be used (if any). CapGet() reports the current setting. + * This capability replaces ICAP_FLASHUSED, which is only able to negotiate the flash being on or off. + */ + ICAP_FLASHUSED2 = 4422, + /** For devices that support image enhancement filtering. This capability selects the algorithm used to improve the quality of the image. */ + ICAP_IMAGEFILTER = 4423, + /** For devices that support noise filtering. This capability selects the algorithm used to remove noise. */ + ICAP_NOISEFILTER = 4424, + /** + * Overscan is used to scan outside of the boundaries described by ICAP_FRAMES, and is used to help acquire image data that + * may be lost because of skewing. + * This is primarily of use for transport scanners which rely on edge detection to begin scanning. + * If overscan is supported, then the device is capable of scanning in the inter-document gap to get the skewed image information. + */ + ICAP_OVERSCAN = 4425, + /** Turns automatic border detection on and off. */ + ICAP_AUTOMATICBORDERDETECTION = 4432, + /** Turns automatic deskew correction on and off. */ + ICAP_AUTOMATICDESKEW = 4433, + /** + * When TRUE this capability depends on intelligent features within the Source to automatically + * rotate the image to the correct position. + */ + ICAP_AUTOMATICROTATE = 4434, + /** Added 1.9 */ + ICAP_JPEGQUALITY = 4435, + /** Added 1.91 */ + ICAP_FEEDERTYPE = 4436, + /** Added 1.91 */ + ICAP_ICCPROFILE = 4437, + /** Added 2.0 */ + ICAP_AUTOSIZE = 4438, + /** Added 2.1 */ + ICAP_AUTOMATICCROPUSESFRAME = 4439, + /** Added 2.1 */ + ICAP_AUTOMATICLENGTHDETECTION = 4440, + /** Added 2.1 */ + ICAP_AUTOMATICCOLORENABLED = 4441, + /** Added 2.1 */ + ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE = 4442, + /** Added 2.1 */ + ICAP_COLORMANAGEMENTENABLED = 4443, + /** Added 2.1 */ + ICAP_IMAGEMERGE = 4444, + /** Added 2.1 */ + ICAP_IMAGEMERGEHEIGHTTHRESHOLD = 4445, + /** Added 2.1 */ + ICAP_SUPPORTEDEXTIMAGEINFO = 4446 + } + /** ICAP_BITORDER values. */ + enum EnumDWT_CapBitOrder { + TWBO_LSBFIRST = 0, + /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */ + TWBO_MSBFIRST = 1 + } + /** ICAP_BITDEPTHREDUCTION values. */ + enum EnumDWT_CapBitdepthReduction { + TWBR_THRESHOLD = 0, + TWBR_HALFTONE = 1, + TWBR_CUSTHALFTONE = 2, + TWBR_DIFFUSION = 3 + } + /** CAP_FEEDERALIGNMENT values. */ + enum EnumDWT_CapFeederAlignment { + /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */ + TWFA_NONE = 0, + /** The alignment is to the left. */ + TWFA_LEFT = 1, + /** + * The alignment is centered. This means that the paper will be fed in the middle of + * the ICAP_PHYSICALWIDTH of the device. If this is set, then the Application should + * calculate any frames with a left offset of zero. + */ + TWFA_CENTER = 2, + /** The alignment is to the right. */ + TWFA_RIGHT = 3 + } + /** CAP_FEEDERORDER values. */ + enum EnumDWT_CapFeederOrder { + /** The feeder starts with the top of the first page. */ + TWFO_FIRSTPAGEFIRST = 0, + /** The feeder starts with the top of the last page. */ + TWFO_LASTPAGEFIRST = 1 + } + /** ICAP_FILTER values. */ + enum EnumDWT_CapFilterType { + TWFT_RED = 0, + TWFT_GREEN = 1, + TWFT_BLUE = 2, + TWFT_NONE = 3, + TWFT_WHITE = 4, + TWFT_CYAN = 5, + TWFT_MAGENTA = 6, + TWFT_YELLOW = 7, + TWFT_BLACK = 8 + } + /** ICAP_FLASHUSED2 values. */ + enum EnumDWT_CapFlash { + TWFL_NONE = 0, + TWFL_OFF = 1, + TWFL_ON = 2, + TWFL_AUTO = 3, + TWFL_REDEYE = 4 + } + /** ICAP_FLIPROTATION values. */ + enum EnumDWT_CapFlipRotation { + /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */ + TWFR_BOOK = 0, + /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */ + TWFR_FANFOLD = 1 + } + /** ICAP_IMAGEFILTER values. */ + enum EnumDWT_CapImageFilter { + TWIF_NONE = 0, + TWIF_AUTO = 1, + /** Good for halftone images. */ + TWIF_LOWPASS = 2, + /** Good for improving text. */ + TWIF_BANDPASS = 3, + /** Good for improving fine lines. */ + TWIF_HIGHPASS = 4, + TWIF_TEXT = 3, + TWIF_FINELINE = 4 + } + /** CAP_LANGUAGE values. */ + enum EnumDWT_CapLanguage { + /** Danish */ + TWLG_DAN = 0, + /** Dutch */ + TWLG_DUT = 1, + /** International English */ + TWLG_ENG = 2, + /** French Canadian */ + TWLG_FCF = 3, + /** Finnish */ + TWLG_FIN = 4, + /** French */ + TWLG_FRN = 5, + /** German */ + TWLG_GER = 6, + /** Icelandic */ + TWLG_ICE = 7, + /** Italian */ + TWLG_ITN = 8, + /** Norwegian */ + TWLG_NOR = 9, + /** Portuguese */ + TWLG_POR = 10, + /** Spanish */ + TWLG_SPA = 11, + /** Swedish */ + TWLG_SWE = 12, + /** U.S. English */ + TWLG_USA = 13, + /** Added for 1.8 */ + TWLG_USERLOCALE = -1, + TWLG_AFRIKAANS = 14, + TWLG_ALBANIA = 15, + TWLG_ARABIC = 16, + TWLG_ARABIC_ALGERIA = 17, + TWLG_ARABIC_BAHRAIN = 18, + TWLG_ARABIC_EGYPT = 19, + TWLG_ARABIC_IRAQ = 20, + TWLG_ARABIC_JORDAN = 21, + TWLG_ARABIC_KUWAIT = 22, + TWLG_ARABIC_LEBANON = 23, + TWLG_ARABIC_LIBYA = 24, + TWLG_ARABIC_MOROCCO = 25, + TWLG_ARABIC_OMAN = 26, + TWLG_ARABIC_QATAR = 27, + TWLG_ARABIC_SAUDIARABIA = 28, + TWLG_ARABIC_SYRIA = 29, + TWLG_ARABIC_TUNISIA = 30, + /** United Arabic Emirates */ + TWLG_ARABIC_UAE = 31, + TWLG_ARABIC_YEMEN = 32, + TWLG_BASQUE = 33, + TWLG_BYELORUSSIAN = 34, + TWLG_BULGARIAN = 35, + TWLG_CATALAN = 36, + TWLG_CHINESE = 37, + TWLG_CHINESE_HONGKONG = 38, + /** People's Republic of China */ + TWLG_CHINESE_PRC = 39, + TWLG_CHINESE_SINGAPORE = 40, + TWLG_CHINESE_SIMPLIFIED = 41, + TWLG_CHINESE_TAIWAN = 42, + TWLG_CHINESE_TRADITIONAL = 43, + TWLG_CROATIA = 44, + TWLG_CZECH = 45, + TWLG_DANISH = 0, + TWLG_DUTCH = 1, + TWLG_DUTCH_BELGIAN = 46, + TWLG_ENGLISH = 2, + TWLG_ENGLISH_AUSTRALIAN = 47, + TWLG_ENGLISH_CANADIAN = 48, + TWLG_ENGLISH_IRELAND = 49, + TWLG_ENGLISH_NEWZEALAND = 50, + TWLG_ENGLISH_SOUTHAFRICA = 51, + TWLG_ENGLISH_UK = 52, + TWLG_ENGLISH_USA = 13, + TWLG_ESTONIAN = 53, + TWLG_FAEROESE = 54, + TWLG_FARSI = 55, + TWLG_FINNISH = 4, + TWLG_FRENCH = 5, + TWLG_FRENCH_BELGIAN = 56, + TWLG_FRENCH_CANADIAN = 3, + TWLG_FRENCH_LUXEMBOURG = 57, + TWLG_FRENCH_SWISS = 58, + TWLG_GERMAN = 6, + TWLG_GERMAN_AUSTRIAN = 59, + TWLG_GERMAN_LUXEMBOURG = 60, + TWLG_GERMAN_LIECHTENSTEIN = 61, + TWLG_GERMAN_SWISS = 62, + TWLG_GREEK = 63, + TWLG_HEBREW = 64, + TWLG_HUNGARIAN = 65, + TWLG_ICELANDIC = 7, + TWLG_INDONESIAN = 66, + TWLG_ITALIAN = 8, + TWLG_ITALIAN_SWISS = 67, + TWLG_JAPANESE = 68, + TWLG_KOREAN = 69, + TWLG_KOREAN_JOHAB = 70, + TWLG_LATVIAN = 71, + TWLG_LITHUANIAN = 72, + TWLG_NORWEGIAN = 9, + TWLG_NORWEGIAN_BOKMAL = 73, + TWLG_NORWEGIAN_NYNORSK = 74, + TWLG_POLISH = 75, + TWLG_PORTUGUESE = 10, + TWLG_PORTUGUESE_BRAZIL = 76, + TWLG_ROMANIAN = 77, + TWLG_RUSSIAN = 78, + TWLG_SERBIAN_LATIN = 79, + TWLG_SLOVAK = 80, + TWLG_SLOVENIAN = 81, + TWLG_SPANISH = 11, + TWLG_SPANISH_MEXICAN = 82, + TWLG_SPANISH_MODERN = 83, + TWLG_SWEDISH = 12, + TWLG_THAI = 84, + TWLG_TURKISH = 85, + TWLG_UKRANIAN = 86, + /** More stuff added for 1.8 */ + TWLG_ASSAMESE = 87, + TWLG_BENGALI = 88, + TWLG_BIHARI = 89, + TWLG_BODO = 90, + TWLG_DOGRI = 91, + TWLG_GUJARATI = 92, + TWLG_HARYANVI = 93, + TWLG_HINDI = 94, + TWLG_KANNADA = 95, + TWLG_KASHMIRI = 96, + TWLG_MALAYALAM = 97, + TWLG_MARATHI = 98, + TWLG_MARWARI = 99, + TWLG_MEGHALAYAN = 100, + TWLG_MIZO = 101, + TWLG_NAGA = 102, + TWLG_ORISSI = 103, + TWLG_PUNJABI = 104, + TWLG_PUSHTU = 105, + TWLG_SERBIAN_CYRILLIC = 106, + TWLG_SIKKIMI = 107, + TWLG_SWEDISH_FINLAND = 108, + TWLG_TAMIL = 109, + TWLG_TELUGU = 110, + TWLG_TRIPURI = 111, + TWLG_URDU = 112, + TWLG_VIETNAMESE = 113 + } + /** ICAP_LIGHTPATH values. */ + enum EnumDWT_CapLightPath { + TWLP_REFLECTIVE = 0, + TWLP_TRANSMISSIVE = 1 + } + /** ICAP_LIGHTSOURCE values. */ + enum EnumDWT_CapLightSource { + TWLS_RED = 0, + TWLS_GREEN = 1, + TWLS_BLUE = 2, + TWLS_NONE = 3, + TWLS_WHITE = 4, + TWLS_UV = 5, + TWLS_IR = 6 + } + /** ICAP_NOISEFILTER values. */ + enum EnumDWT_CapNoiseFilter { + TWNF_NONE = 0, + TWNF_AUTO = 1, + TWNF_LONEPIXEL = 2, + TWNF_MAJORITYRULE = 3 + } + /** ICAP_ORIENTATION values. */ + enum EnumDWT_CapORientation { + TWOR_ROT0 = 0, + TWOR_ROT90 = 1, + TWOR_ROT180 = 2, + TWOR_ROT270 = 3, + TWOR_PORTRAIT = 0, + TWOR_LANDSCAPE = 3, + /** 2.0 */ + TWOR_AUTO = 4, + /** 2.0 */ + TWOR_AUTOTEXT = 5, + /** 2.0 */ + TWOR_AUTOPICTURE = 6 + } + /** ICAP_OVERSCAN values. */ + enum EnumDWT_CapOverscan { + TWOV_NONE = 0, + TWOV_AUTO = 1, + TWOV_TOPBOTTOM = 2, + TWOV_LEFTRIGHT = 3, + TWOV_ALL = 4 + } + /** ICAP_PIXELFLAVOR values. */ + enum EnumDWT_CapPixelFlavor { + /** Zero pixel represents darkest shade. zero pixel represents darkest shade */ + TWPF_CHOCOLATE = 0, + /** Zero pixel represents lightest shade. zero pixel represents lightest shade */ + TWPF_VANILLA = 1 + } + /** ICAP_PLANARCHUNKY values. */ + enum EnumDWT_CapPlanarChunky { + TWPC_CHUNKY = 0, + TWPC_PLANAR = 1 + } + /** CAP_PRINTER values. */ + enum EnumDWT_CapPrinter { + TWPR_IMPRINTERTOPBEFORE = 0, + TWPR_IMPRINTERTOPAFTER = 1, + TWPR_IMPRINTERBOTTOMBEFORE = 2, + TWPR_IMPRINTERBOTTOMAFTER = 3, + TWPR_ENDORSERTOPBEFORE = 4, + TWPR_ENDORSERTOPAFTER = 5, + TWPR_ENDORSERBOTTOMBEFORE = 6, + TWPR_ENDORSERBOTTOMAFTER = 7 + } + /** CAP_PRINTERMODE values. */ + enum EnumDWT_CapPrinterMode { + /** Specifies that the printed text will consist of a single string. */ + TWPM_SINGLESTRING = 0, + /** Specifies that the printed text will consist of an enumerated list of strings to be printed in order. */ + TWPM_MULTISTRING = 1, + /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */ + TWPM_COMPOUNDSTRING = 2 + } + /** TWAIN Supported sizes. */ + enum EnumDWT_CapSupportedSizes { + /** 0 */ + TWSS_NONE = 0, + /** 1 */ + TWSS_A4LETTER = 1, + /** 2 */ + TWSS_B5LETTER = 2, + /** 3 */ + TWSS_USLETTER = 3, + /** 4 */ + TWSS_USLEGAL = 4, + /** + * Added 1.5 + * 5 + */ + TWSS_A5 = 5, + /** 6 */ + TWSS_B4 = 6, + /** 7 */ + TWSS_B6 = 7, + /** + * Added 1.7 + * 9 + */ + TWSS_USLEDGER = 9, + /** 10 */ + TWSS_USEXECUTIVE = 10, + /** 11 */ + TWSS_A3 = 11, + /** 12 */ + TWSS_B3 = 12, + /** 13 */ + TWSS_A6 = 13, + /** 14 */ + TWSS_C4 = 14, + /** 15 */ + TWSS_C5 = 15, + /** 16 */ + TWSS_C6 = 16, + /** + * Added 1.8 + * 17 + */ + TWSS_4A0 = 17, + /** 18 */ + TWSS_2A0 = 18, + /** 19 */ + TWSS_A0 = 19, + /** 20 */ + TWSS_A1 = 20, + /** 21 */ + TWSS_A2 = 21, + /** 1 */ + TWSS_A4 = 1, + /** 22 */ + TWSS_A7 = 22, + /** 23 */ + TWSS_A8 = 23, + /** 24 */ + TWSS_A9 = 24, + /** 25 */ + TWSS_A10 = 25, + /** 26 */ + TWSS_ISOB0 = 26, + /** 27 */ + TWSS_ISOB1 = 27, + /** 28 */ + TWSS_ISOB2 = 28, + /** 12 */ + TWSS_ISOB3 = 12, + /** 6 */ + TWSS_ISOB4 = 6, + /** 29 */ + TWSS_ISOB5 = 29, + /** 7 */ + TWSS_ISOB6 = 7, + /** 30 */ + TWSS_ISOB7 = 30, + /** 31 */ + TWSS_ISOB8 = 31, + /** 32 */ + TWSS_ISOB9 = 32, + /** 33 */ + TWSS_ISOB10 = 33, + /** 34 */ + TWSS_JISB0 = 34, + /** 35 */ + TWSS_JISB1 = 35, + /** 36 */ + TWSS_JISB2 = 36, + /** 37 */ + TWSS_JISB3 = 37, + /** 38 */ + TWSS_JISB4 = 38, + /** 2 */ + TWSS_JISB5 = 2, + /** 39 */ + TWSS_JISB6 = 39, + /** 40 */ + TWSS_JISB7 = 40, + /** 41 */ + TWSS_JISB8 = 41, + /** 41 */ + TWSS_JISB9 = 42, + /** 43 */ + TWSS_JISB10 = 43, + /** 44 */ + TWSS_C0 = 44, + /** 45 */ + TWSS_C1 = 45, + /** 46 */ + TWSS_C2 = 46, + /** 47 */ + TWSS_C3 = 47, + /** 48 */ + TWSS_C7 = 48, + /** 49 */ + TWSS_C8 = 49, + /** 50 */ + TWSS_C9 = 50, + /** 51 */ + TWSS_C10 = 51, + /** 52 */ + TWSS_USSTATEMENT = 52, + /** 53 */ + TWSS_BUSINESSCARD = 53, + /** 54. Added 2.1 */ + TWSS_MAXSIZE = 54 + } + /** + * Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected. + * To help categorize the supported values into clear structures, TWAIN defines four types of containers for capabilities = + * TW_ONEVALUE, TW_ARRAY, TW_RANGE and TW_ENUMERATION. + */ + enum EnumDWT_CapType { + /** Nothing. */ + TWON_NONE = 0, + /** + * A rectangular array of values that describe a logical item. It is similar to the TW_ONEVALUE because the current and default values are the same and + * there are no other values to select from. For example, a list of the names, such as the supported capabilities list returned by the CAP_SUPPORTEDCAPS + * capability, would use this type of container. + */ + TWON_ARRAY = 3, + /** + * This is the most general type because it defines a list of values from which the Current Value can be chosen. + * The values do not progress uniformly through a range and there is not a consistent step size between the values. + * For example, if a Source's resolution options do not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600). + */ + TWON_ENUMERATION = 4, + /** + * A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value. + * For example, a capability that indicates the presence of a document feeder could be of this type. + */ + TWON_ONEVALUE = 5, + /** + * Many capabilities allow users to select their current value from a range of regularly spaced values. + * The capability can specify the minimum and maximum acceptable values and the incremental step size between the values. + * For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600). + */ + TWON_RANGE = 6 + } + /** The kind of data stored in the container. */ + enum EnumDWT_CapValueType { + TWTY_INT8 = 0, + /** Means Item is a TW_INT16 */ + TWTY_INT16 = 1, + /** Means Item is a TW_INT32 */ + TWTY_INT32 = 2, + /** Means Item is a TW_UINT8 */ + TWTY_UINT8 = 3, + /** Means Item is a TW_UINT16 */ + TWTY_UINT16 = 4, + /** Means Item is a TW_int */ + TWTY_int = 5, + /** Means Item is a TW_BOOL */ + TWTY_BOOL = 6, + /** Means Item is a TW_FIX32 */ + TWTY_FIX32 = 7, + /** Means Item is a TW_FRAME */ + TWTY_FRAME = 8, + /** Means Item is a TW_STR32 */ + TWTY_STR32 = 9, + /** Means Item is a TW_STR64 */ + TWTY_STR64 = 10, + /** Means Item is a TW_STR128 */ + TWTY_STR128 = 11, + /** Means Item is a TW_STR255 */ + TWTY_STR255 = 12 + } + /** + * TWAIN compression types. + */ + enum EnumDWT_CompressionType { + TWCP_BITFIELDS = 12, + TWCP_GROUP4 = 5, + TWCP_GROUP31D = 2, + TWCP_GROUP31DEOL = 3, + TWCP_GROUP32D = 4, + TWCP_JBIG = 8, + TWCP_JPEG = 6, + TWCP_JPEG2000 = 14, + TWCP_LZW = 7, + TWCP_NONE = 0, + TWCP_PACKBITS = 1, + TWCP_PNG = 9, + TWCP_RLE4 = 10, + TWCP_RLE8 = 11, + TWCP_ZIP = 13 + } + /** ICAP_DUPLEX values. */ + enum EnumDWT_DUPLEX { + TWDX_NONE = 0, + TWDX_1PASSDUPLEX = 1, + TWDX_2PASSDUPLEX = 2 + } + /** Data source status. */ + enum EnumDWT_DataSourceStatus { + /** Indicate the data source is closed. */ + TWDSS_CLOSED = 0, + /** Indicate the data source is opened. */ + TWDSS_OPENED = 1, + /** Indicate the data source is enabled. */ + TWDSS_ENABLED = 2, + /** Indicate the data source is acquiring image. */ + TWDSS_ACQUIRING = 3 + } + /** + * Driver Type + */ + enum EnumDWT_Driver { + ICA = 3, + SANE = 3, + TWAIN = 0, + TWAIN_AND_ICA = 4 + } + /** ICAP_IMAGEFILEFORMAT values. */ + enum EnumDWT_FileFormat { + /** Used for document imaging. Tagged Image File Format */ + TWFF_TIFF = 0, + /** Native Macintosh format. Macintosh PICT */ + TWFF_PICT = 1, + /** Native Microsoft format. Windows Bitmap */ + TWFF_BMP = 2, + /** Used for document imaging. X-Windows Bitmap */ + TWFF_XBM = 3, + /** Wrapper for JPEG images. JPEG File Interchange Format */ + TWFF_JFIF = 4, + /** FlashPix, used with digital cameras. Flash Pix */ + TWFF_FPX = 5, + /** Multi-page TIFF files. Multi-page tiff file */ + TWFF_TIFFMULTI = 6, + /** An image format standard intended for use on the web, replaces GIF. */ + TWFF_PNG = 7, + /** A standard from JPEG, intended to replace JFIF, also supports JBIG. */ + TWFF_SPIFF = 8, + /** File format for use with digital cameras. */ + TWFF_EXIF = 9, + /** A file format from Adobe. 1.91 NB: this is not PDF/A */ + TWFF_PDF = 10, + /** A file format from the Joint Photographic Experts Group. 1.91 */ + TWFF_JP2 = 11, + /** 1.91 */ + TWFF_JPN = 12, + /** 1.91 */ + TWFF_JPX = 13, + /** A file format from LizardTech. 1.91 */ + TWFF_DEJAVU = 14, + /** A file format from Adobe. 2.0 */ + TWFF_PDFA = 15, + /** 2.1 Adobe PDF/A, Version 2 */ + TWFF_PDFA2 = 16 + } + /** Fit window type */ + enum EnumDWT_FitWindowType { + /** Fit the image to the width and height of the window */ + enumFitWindow = 0, + /** Fit the image to the height of the window */ + enumFitWindowHeight = 1, + /** Fit the image to the width of the window */ + enumFitWindowWidth = 2 + } + /** Image type */ + enum EnumDWT_ImageType { + /** Native Microsoft format. */ + IT_BMP = 0, + /** JPEG format. */ + IT_JPG = 1, + /** Tagged Image File Format. */ + IT_TIF = 2, + /** An image format standard intended for use on the web, replaces GIF. */ + IT_PNG = 3, + /** A file format from Adobe. */ + IT_PDF = 4, + /** All supported formats which are bmp, jpg, tif, png and pdf */ + IT_ALL = 5, + IT_MULTIPAGE_PDF = 7, + IT_MULTIPAGE_TIF = 8 + } + enum EnumDWT_InitMsg { + Info = 1, + Error = 2, + NotInstalledError = 3, + DownloadError = 4, + DownloadNotRestartError = 5 + } + /** The method to do interpolation. */ + enum EnumDWT_InterpolationMethod { + IM_NEARESTNEIGHBOUR = 1, + IM_BILINEAR = 2, + IM_BICUBIC = 3, + IM_BESTQUALITY = 5 + } + enum EnumDWT_Language { + English = 0, + French = 1, + Arabic = 2, + Spanish = 3, + Portuguese = 4, + German = 5, + Italian = 6, + Russian = 7, + Chinese = 8 + } + /** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */ + enum EnumDWT_MagType { + /** Added 2.0 */ + TWMD_MICR = 0, + /** added 2.1 */ + TWMD_RAW = 1, + /** added 2.1 */ + TWMD_INVALID = 2 + } + /** + * For query the operation that are supported by the data source on a capability . + * Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT + */ + enum EnumDWT_MessageType { + TWQC_GET = 1, + TWQC_SET = 2, + TWQC_GETDEFAULT = 4, + TWQC_GETCURRENT = 8, + TWQC_RESET = 16 + } + /** + * Mouse cursor shape. + */ + enum EnumDWT_MouseShape { + Default = 0, + Hand = 1, + Crosshair = 2, + Zoom = 3 + } + /** PDF file compression type. */ + enum EnumDWT_PDFCompressionType { + /** Auto mode. */ + PDF_AUTO = 0, + /** CCITT Group 3 fax encoding. */ + PDF_FAX3 = 1, + /** CCITT Group 4 fax encoding */ + PDF_FAX4 = 2, + /** Lempel Ziv and Welch */ + PDF_LZW = 3, + /** CCITT modified Huffman RLE. */ + PDF_RLE = 4, + /** JPEG compression. */ + PDF_JPEG = 5 + } + /** ICAP_PIXELTYPE values (PT_ means Pixel Type) */ + enum EnumDWT_PixelType { + TWPT_BW = 0, + TWPT_GRAY = 1, + TWPT_RGB = 2, + TWPT_PALLETE = 3, + TWPT_CMY = 4, + TWPT_CMYK = 5, + TWPT_YUV = 6, + TWPT_YUVK = 7, + TWPT_CIEXYZ = 8, + TWPT_LAB = 9, + TWPT_SRGB = 10, + TWPT_SCRGB = 11, + TWPT_INFRARED = 16 + } + enum EnumDWT_PlatformType { + /// Fit the image to the width and height of the window + enumWindow = 0, + /// Fit the image to the height of the window + enumMac = 1, + /// Fit the image to the width of the window + enumLinux = 2 + } + enum EnumDWT_ShowMode { + /** Activates the window and displays it in its current size and position. */ + SW_ACTIVE = 0, + /** Maximizes the window */ + SW_MAX = 1, + /** Minimize the window */ + SW_MIN = 2, + /** Close the latest opened editor window */ + SW_CLOSE = 3, + /** Check whether a window exists */ + SW_IFLIVE = 4 + } + /** TIFF file compression type. */ + enum EnumDWT_TIFFCompressionType { + /** Auto mode. */ + TIFF_AUTO = 0, + /** Dump mode. */ + TIFF_NONE = 1, + /** CCITT modified Huffman RLE. */ + TIFF_RLE = 2, + /** CCITT Group 3 fax encoding. */ + TIFF_FAX3 = 3, + /** CCITT T.4 (TIFF 6 name). */ + TIFF_T4 = 3, + /** CCITT Group 4 fax encoding */ + TIFF_FAX4 = 4, + /** CCITT T.6 (TIFF 6 name). */ + TIFF_T6 = 4, + /** Lempel Ziv and Welch */ + TIFF_LZW = 5, + TIFF_JPEG = 7, + TIFF_PACKBITS = 32773 + } + /** ICAP_XFERMECH values. */ + enum EnumDWT_TransferMode { + /** + * Native transfers require the data to be transferred to a single large block of RAM. Therefore, + * they always face the risk of having an inadequate amount of RAM available to perform the transfer successfully. + */ + TWSX_NATIVE = 0, + /** Disk File Mode Transfers. */ + TWSX_FILE = 1, + /** Buffered Memory Mode Transfers. */ + TWSX_MEMORY = 2/*,*/ + /** + * added 1.91 , not supported in DWT yet + */ + // TWSX_MEMFILE = 4 + } + /** ICAP_UNITS values. */ + enum EnumDWT_UnitType { + TWUN_INCHES = 0, + TWUN_CENTIMETERS = 1, + TWUN_PICAS = 2, + TWUN_POINTS = 3, + TWUN_TWIPS = 4, + TWUN_PIXELS = 5, + TWUN_MILLIMETERS = 6 + } + enum EnumDWT_UploadDataFormat { + Binary = 0, + Base64 = 1 + } +} diff --git a/types/dwt/Dynamsoft.FileUploader.d.ts b/types/dwt/Dynamsoft.FileUploader.d.ts new file mode 100644 index 0000000000..1a050fff30 --- /dev/null +++ b/types/dwt/Dynamsoft.FileUploader.d.ts @@ -0,0 +1,130 @@ +export interface FileUploader { + /** + * Initialize and create a FileUploader instance. + * @param URL Specify a path to retrieve the FileUploader library. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument uploadManager A FileUploader instance. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + Init( + URL: string, + successCallback: ( + uploadManager: UploadManager + ) => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; +} +export interface UploadManager { + /** + * Create an upload job. + */ + CreateJob(): Job; + /** + * Start uploading (processing the specified job). + * @param job Specify the job. + */ + Run(job: Job): boolean; + /** + * Cancel a job. + * @param job Specify the job. + */ + Cancel(job: Job): boolean; + /** + * Cancel all jobs. + */ + CancelAllUpload(): boolean; +} +export interface Job { + /** + * Specify the block size (in bytes). By default, it's 10240. + */ + BlockSize: number; + /** + * Specify the file name. + */ + FileName: string; + /** + * Specify the fields in the HTTP Post Form. + */ + FormField: FormField; + /** + * Specify custom HTTP Post request headers. + * Example: job.HttpHeader["Content-Type"] = "text/plain"; + */ + HttpHeader: object; + /** + * Return the Http version. + */ + readonly HttpVersion: string; + /** + * A callback triggered when the job succeeds. + * @argument job Specify the job. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + OnRunFailure: ( + job: Job, + errorCode: number, + errorString: string + ) => void; + /** + * A callback triggered when the job succeeds. + * @argument job Specify the job. + */ + OnRunSuccess: (job: Job) => void; + /** + * A callback triggered multiple times during the upload. + * @argument job Specify the job. + * @argument percentage Return the percentage. + */ + OnUploadTransferPercentage: ( + job: Job, + percentage: number + ) => void; + /** + * Specify the URL of the script to receive the upload. + */ + ServerUrl: string; + /** + * Specify the main content of the job, i.e. the file(s). + */ + SourceValue: SourceValue; + /** + * Specify the number of threads (<=4) for the upload. + */ + ThreadNum: number; + /** + * Return the version of the job. + */ + readonly Version: number; +} +export interface SourceValue { + /** + * Specify the block size. By default, it's 10240. + * @param source A URL to specify the content of the file. + * Normally it's generated by {GenerateURLForUploadData()} + * @param name Specify the name of the file. + * @param key Specify the key of the file in the request. This key can be used to retrieve the file content in server-side scripts. + */ + Add: ( + source: string, + name: string, + key?: string + ) => void; +} +export interface FormField { + /** + * Specify the block size. By default, it's 10240. + * @param key Specify the key of the field. + * @param value Sepcify the value of the field. + */ + Add: ( + key: string, + value: string + ) => void; +} diff --git a/types/dwt/Dynamsoft.d.ts b/types/dwt/Dynamsoft.d.ts index 08576690db..c1dac2416e 100644 --- a/types/dwt/Dynamsoft.d.ts +++ b/types/dwt/Dynamsoft.d.ts @@ -1,3869 +1,473 @@ -// tslint:disable:jsdoc-format -// tslint:disable:max-line-length -// tslint:disable:no-irregular-whitespace +import { DynamsoftEnums } from "./Dynamsoft.Enum"; +import { WebTwain } from "./WebTwain"; +import { Settings } from "./Addon.OCRPro"; +import { FileUploader } from "./Dynamsoft.FileUploader"; -/*! -* Product: Dynamsoft Web Twain -* Web Site: http://www.dynamsoft.com -* -* Copyright 2020, Dynamsoft Corporation -* Author: Dynamsoft Support Team -*/ - -interface DynamsoftStatic { - Lib: DynamsoftLib; - WebTwainEnv: dwtEnv; +export namespace DynamsoftStatic { + let Lib: DynamsoftLib; + let MSG: Messages; + let WebTwainEnv: WebTwainEnv; + let managerEnv: ManagerEnv; + let FileUploader: FileUploader; + namespace WebTwain { + namespace Addon { + namespace OCRPro { + function NewSettings(): Settings; + } + } + } } +export interface DWTInitialConfig { + WebTwainId: string; + Host?: string; + Port?: string; + SSLPort?: string; +} +export interface DynamsoftLib { + /** + * A built-in method to set up a listener for the specified event type on the target element. + * @param target Specify the HTML element. + * @param type Specify the event + * @param listener Specify the callback + */ + addEventListener(target: HTMLElement, type: string, listener: EventListenerOrEventListenerObject): void; + /** + * Whether to enable debugging. Once enabled, debugging inforamtion is printed out in the browser console. + */ + debug: boolean; + detect: DSLibDetect; + env: DSLibEnv; + /** + * Hide the built-in page mask + */ + hideMask(): void; + /** + * Show the built-in page mask + */ + showMask(): void; + /** + * Load the specified script. + * @param url Specify the URL of the script. + * @param bAsync Whether to load the script asynchronously. + * @param callback Callback function triggered when the script is loaded. + */ + getScript(url: string, bAsync: boolean, callback: () => void): void; + /** + * Load the specified scripts. + * @param urls Specify the URLs of the scripts. + * @param bAsync Whether to load the script asynchronously. + * @param callback Callback function triggered when the scripts are all loaded. + */ + getScripts(urls: string[], bAsync: boolean, callback: () => void): void; -interface dwtEnv { + dlgLoadingShowStatus: boolean; + product: Product; + /** + * The following Functions & Options are internal & ignored + * + * Addon_Events, Addon_Sendback_Events, Attributes, BGR2RGB, BIO, DOM, + * DynamicLoadAddonFuns, DynamicWebTwain, EnumMouseButton, Errors, + * Events, File, Index, IntToColorStr, LS, License, MobileFuns, Path, + * ProgressBar, RGB2BGR, ShowLicenseDialog, UI, Uri + * ajax, all, appendMessage, appendRichMessage, asyncQueue, atob, + * attachAddon, attachProperty, attachPropertyUI, base64, bio, btoa, + * cancelFrome, checkDomReady, checkNavInfoReady, clearMessage, clone, + * closeAll, closeLoadingMsg, closeProgress, colorStrToInt, config,css, + * currentStyle, detectButton, dialog, dialogShowStatus, dlgLoading, + * dlgLoadingShowStatus, dlgProgress, dlgRef, doc, domReady, + * each, empty, endsWith, error, escapeHtml, escapeRegExp, extend, + * filter, fireEvent, fromUnicode, get, getAllCss, getColor, getCss, + * getElDimensions, getHex, getHttpUrl, getLogger, getNavInfo, + * getNavInfoByUAData, getNavInfoByUserAgent, getNavInfoSync, getRandom, + * getRealPath, getWS, getWSUrl, getWheelDelta, globalEval, guid, hide, + * html5, indexOf, initProgress, install,io, isArray, isBoolean, isDef, + * isFunction, isLocalIP, isNaN, isNodeList, isNull, isNumber, isObject, + * isPlainObject, isString, isUndef, isUndefined, isWindow, keys, makeArray, + * mask, mix, needShowTwiceShowDialog, nil, noop, now, obj, one, openLoadingMsg, + * page, param, parse, parseHTML, progressMessage, ready, + * removeEventListener, replaceAll, replaceControl, setBtnCancelVisibleForProgress, + * show, showLoadingMsg, showProgress, showProgressMsg, sizzle, sprintf, startWS, + * startWSByIP, startsWith, stopPropagation, stringify, style, support, switchEvent, + * tmp, toggle, trim, type, unEscapeHtml, uniq, unparam, upperCaseFirst, uriQuery, + * urlDecode, urlEncode, utf8, vsprintf, win + */ +} +export interface DSLibDetect { + /** + * Whether or not the site is secure (Https://). + */ + readonly ssl: boolean; + readonly scriptLoaded: boolean; + /** + * The following Functions & Options are internal & ignored + * OnCreatWS, OnDetectNext, StartWSByIPTimeoutId, StartWSTimeoutId, + * aryReconnectSTwains, arySTwains, arySTwainsByIP, bFirst, + * bNeedUpgradeEvent, bNoControlEvent, bOK, bPromptJSOrServerOutdated, + * cUrlIndex, cssLoaded, dcpCallbackType, dcpStatus, detectType, getVersionArray, + * isDWTVersionLatest, needUpgrade, onNoControl, onNotAllowedForChrome, ports, + * starting, tryTimes, urls, viewerScriptLoaded, wasmScriptLoaded, + * OnWebTwainPostExecute, OnWebTwainPreExecute, hideMask, showMask, + * win64Ports, __WebTwainMain, __dialog + */ +} +export interface DSLibEnv { + /** + * Whether the browser is Chrome. + */ + readonly bChrome: boolean; + /** + * Whether the browser is Edge. + */ + readonly bEdge: boolean; + /** + * Whether the page is opening from the disk. + */ + readonly bFileSystem: boolean; + /** + * Whether the browser is Firefox. + */ + readonly bFirefox: boolean; + /** + * Whether the browser is IE. + */ + readonly bIE: boolean; + /** + * Whether the browser is Safari. + */ + readonly bSafari: boolean; + /** + * Whether the operating system is Linux. + */ + readonly bLinux: boolean; + /** + * Whether the operating system is macOS. + */ + readonly bMac: boolean; + /** + * Whether the operating system is mobile (Android & iOS & iPadOS). + */ + readonly bMobile: boolean; + /** + * Whether the operating system is Windows. + */ + readonly bWin: boolean; + /** + * Whether the operating system is 64bit Windows. + */ + readonly bWin64: boolean; + /** + * The base path. + */ + readonly basePath: string; + /** + * The WebSocket session id. + */ + readonly WSSession: number; + /** + * The WebSocket version. + */ + readonly WSVersion: string; + /** + * The plugin lenghth. + */ + readonly iPluginLength: number; + /** + * Whether it is a desktop viewer. + */ + isDesktopViewer(): boolean; + /** + * Whether it is a mobile viewer. + */ + isMobileViewer(): boolean; + /** + * Whether it is a pad viewer. + */ + isPadViewer(): boolean; + /** + * Whether the platform is 64bit. + */ + readonly isX64: boolean; + /** + * Information about macOSX. + */ + readonly macOSX: string; + /** + * OS version. + */ + readonly osVersion: string; + /** + * The path type used to calculate the real path. + */ + readonly pathType: number; + /** + * The version of Chrome. + */ + readonly strChromeVersion: number | string; + /** + * The version of Firefox. + */ + readonly strFirefoxVersion: number | string; + /** + * The version of IE. + */ + readonly strIEVersion: number | string; +} +export interface WebTwainEnv { + /** + * Whether to install the ActiveX with CAB. + */ + ActiveXInstallWithCAB: boolean; + /** + * The version of the ActiveX; + */ + readonly ActiveXVersion: string; + /** + * Whether to create a WebTwain instance automatically upon page load. + */ AutoLoad: boolean; - ProductKey: string; - Trial: boolean; + /** + * Close a dialog opened by the method ShowDialog. + */ + CloseDialog(): void; + /** + * A map of all WebTwain instances. + */ + ContainerMap: any; + /** + * Define the Id and UI of the WebTwain instances. + */ Containers: Container[]; + /** + * Create a WebTwain instance with UI. + * @param ContainerId Specify the HTML element (typically of the type HTMLDivElement) to hold the UI. + * @param host Specify the host. + * @param port Specify the port. + * @param portSSL Specify the SSL port. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + */ + CreateDWTObject( + ContainerId: string, + host: string, + port: string | number, + portSSL: string | number, + successCallBack: (DWObject: WebTwain) => void, + failureCallBack: (errorString: string) => void): void; + /** + * Create a WebTwain instance with UI. + * @param ContainerId Specify the HTML element (typically of the type HTMLDivElement) to hold the UI. + * @param host Specify the host. + * @param port Specify the port. + * @param portSSL Specify the SSL port. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + */ + CreateDWTObject(ContainerId: string, successCallBack: (DWObject: WebTwain) => void, failureCallBack: (errorString: string) => void): void; + /** + * Create a WebTwain instance without UI. + * @param WebTwainId Specify the Id of the instance. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + */ + CreateDWTObjectEx(dwtInitialConfig: DWTInitialConfig, successCallBack: (DWObject: WebTwain) => void, failureCallBack: (errorString: string) => void): void; + /** + * Define the display info. + */ + CustomizableDisplayInfo: DisplayInfo; + /** + * Remove and destroy a WebTwain instance. + * @param Id Specify the instance with its ContainerId or WebTwainId. + */ + DeleteDWTObject(Id: string): boolean; + /** + * Return the WebTwain instance specified by its ContainerId. If no parameter is provided, the first valid WebTwain instance is returnd. + * @param ContainerId The ContainerId. + */ + GetWebTwain(ContainerId?: string): WebTwain; + /** + * Return the WebTwain instance specified by its WebTwainId. If no parameter is provided, the first valid WebTwain instance is returnd. + * @param WebTwainId The WebTwainId. + */ + GetWebTwainEx(WebTwainId?: string): WebTwain; + /** + * Whether or not an md5 header `dwt-md5` should be included in HTTP upload requests. + */ + IfAddMD5InUploadHeader: boolean; + /** + * Whether to confine the mask within the viewer element. + */ + IfConfineMaskWithinTheViewer: boolean; + /** + * Whether to use ActiveX for IE 10 & 11. + */ IfUseActiveXForIE10Plus: boolean; + /** + * The version of the JavaScript script. + */ + readonly JSVersion: string; + /** + * Create a WebTwain instance(s). + */ + Load(): void; + /** + * A callback function that is executed when the WebTwain related files are not found. + */ + OnWebTwainNotFound: () => {}; + /** + * A callback function that is executed after a time-consuming operation. + */ + OnWebTwainPostExecute: () => {}; + /** + * A callback function that is executed before a time-consuming operation. + */ + OnWebTwainPreExecute: () => {}; + /** + * A callback function that is executed when a WebTwain instance is created. + */ + OnWebTwainReady: () => {}; + /** + * A callback function that is executed right before the creation of a WebTwain instance. + */ + OnWebTwainWillInit: () => {}; + /** + * The version of the PDF module (not the rasterizer). + */ + PdfVersion: string; + /** + * The version of the plug-in edition. + */ + PluginVersion: string; + /** + * Set or return the product key for the library. A product key is required to enables certain modules of the library. + */ + ProductKey: string; + /** + * The product name. + */ + readonly ProductName: string; + /** + * Attach the callback function to the specified event. + * @param event Specify the event. + * @param callback Specify the callback. + */ + RegisterEvent(event: string, callback: (...args: any[]) => void): void; + /** + * Remove all authorizations for accessing local resources. + */ + RemoveAllAuthorizations(): void; + /** + * Set or return where the library looks for resources files including service installers, CSS, etc. + */ ResourcesPath: string; /** - * Whether or not the scanned images show up in the built-in image viewer + * The version of the Linux edition (the service, not wasm). + */ + ServerLinuxVersionInfo: string; + /** + * The version of the macOS edition (the service, not wasm). + */ + ServerMacVersionInfo: string; + /** + * The version of the Windows edition (the service, not wasm). */ - ScanDirectly: boolean; - - RegisterEvent(event: string, fn: (...args: any[]) => void): void; - GetWebTwain(cid: string): WebTwain; - Load(): void; - Unload(): void; - - Debug: boolean; - ActiveXInstallWithCAB: boolean; - ActiveXVersion: string; - ContainerMap: {}; - CreateDWTObject(newObjID: string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void; - DeleteDWTObject(objID: string): void; - DynamicContainers: string[]; - DynamicDWTMap: {}; - IfInstallDWTModuleWithZIP: boolean; - /*ignored - OnWebTwainInitMessage OnWebTwainNeedUpgrade OnWebTwainNeedUpgradeWebJavascript OnWebTwainNotFound OnWebTwainOldPluginNotAllowed - */ - - OnWebTwainPostExecute(): void; - OnWebTwainPreExecute(): void; - - /*ignored - OnWebTwainReady - */ - JSVersion: string; - PluginVersion: string; ServerVersionInfo: string; - - RemoveAllAuthorizations(): void; - ShowDialog(_dialogWidth: number, _dialogHeight: number, _strDialogMessageWithHtmlFormat: string, _bChangeImage: boolean, bHideCloseButton: boolean): void; - CloseDialog(): void; - UseDefaultInstallUI: boolean; + /** + * Built-in method to show a modal dialog. + * @param width Width of the dialog. + * @param height Height of the dialog. + * @param content Content of the dialog. + * @param simple Whether to show a simple dialog with no header. + * @param hideCloseButton Whether to hide the close button. + */ + ShowDialog(width: number, height: number, content: string, simple: boolean, hideCloseButton: boolean): void; + /** + * Remove and destroy all WebTwain instances. + */ + Unload(): void; + /** + * Whether to use the library in Local-Service mode or WASM mode. + */ + UseLocalService: boolean; + ConnectToTheService: () => void; initQueue: any[]; - inited: boolean; - - IfAddMD5InUploadHeader: boolean; - IfConfineMaskWithinTheViewer: boolean; - CustomizableDisplayInfo: any; + /** + * The following Functions & Options are internal & ignored + * ActiveXIntegerited, CheckConnectToTheService, + * ContainerMap, Debug, DynamicContainers, + * DynamicDWTMap, GetLocalServiceStatus,IfCheck64bitServiceFirst, + * IfCheckDCP, IfCheckDWT, + * IfDisableDefaultSettings, IfDownload64bitService, + * IfInstallDWTModuleWithZIP, IfUpdateService, + * IfUseEmbeddedDownloadNoticeForActiveX, IfUseViewer, + * OnWebTwainInitMessage, OnWebTwainNeedUpgrade, + * OnWebTwainNeedUpgradeWebJavascript, OnWebTwainInitMessage + * OnWebTwainOldPluginNotAllowed, OnWebTwainOldPluginNotAllowed + * Trial, UseDefaultInstallUI, ViewerJSIntegerited, + * inited, _srcUseLocalService + */ } - -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; - getScript(url: string, bAsync: boolean, callback: () => void): void; +export interface DisplayInfo { + buttons: any; + customProgressText: any; + dialogText: any; + errorMessages: any; + generalMessages: any; } - /** - * interface for a DWT container which basically defines a DIV on the page + * Define default messages. */ -interface Container { - ContainerId: string; - Width: string | number; - Height: string | number; +export interface Messages { + ConvertingToBase64: string; + ConvertingToBlob: string; + Downloading: string; + Encoding: string; + Err_BrowserNotSupportWasm: string; + Init_AllJsLoaded: string; + Init_CheckDWT: string; + Init_CheckDWTVersion: string; + Init_CheckingLicense: string; + Init_CompilingWasm: string; + Init_ConfiguringDWT: string; + Init_CreatingDWT: string; + Init_DownloadingWasm: string; + Init_FireBeforeInitEvt: string; + Init_GetLicenseInfoForDWT: string; + Init_InitActiveX: string; + Init_InitDynamsoftService: string; + Init_InitH5: string; + Init_InitWasm: string; + Init_LoadingViewerJs: string; + Init_LookingLicense: string; + Init_SetLicenseForDWT: string; + Loading: string; + LoadingPdf: string; + LoadingTiff: string; + SavingPdf: string; + SavingTiff: string; + Uploading: string; } - -/** Border Styles */ -declare enum EnumDWT_BorderStyle { - /** No border. */ - TWBS_NONE = 0, - /** Flat border. */ - TWBS_SINGLEFLAT = 1, - /** 3D border. */ - TWBS_SINGLE3D = 2 +export interface ManagerEnv { + IfUpdateService: boolean; + resourcesPath: string; } - -/** Capabilities */ -declare enum EnumDWT_Cap { - /** Nothing. */ - CAP_NONE = 0, - /** The application is willing to accept this number of images. */ - CAP_XFERCOUNT = 1, - /** Allows the application and Source to identify which compression schemes they have in - * common for Buffered Memory and File transfers. - * Note for File transfers: - * Since only certain file formats support compression, this capability must be negotiated after - * setting the desired file format with ICAP_IMAGEFILEFORMAT. - */ - ICAP_COMPRESSION = 256, - /** The type of pixel data that a Source is capable of acquiring (for example, black and white, gray, RGB, etc.). */ - ICAP_PIXELTYPE = 257, - /** Unless a quantity is dimensionless or uses a specified unit of measure, ICAP_UNITS determines - * the unit of measure for all quantities. - */ - ICAP_UNITS = 258, - /** Allows the application and Source to identify which transfer mechanisms the source supports. */ - ICAP_XFERMECH = 259, - /** The name or other identifying information about the Author of the image. It may include a copyright string. */ - CAP_AUTHOR = 4096, - /** A general note about the acquired image. */ - CAP_CAPTION = 4097, - /** If TRUE, Source must acquire data from the document feeder acquire area and other feeder - * capabilities can be used. If FALSE, Source must acquire data from the non-feeder acquire area - * and no other feeder capabilities can be used. - */ - CAP_FEEDERENABLED = 4098, - /** Reflect whether there are documents loaded in the Source's feeder. */ - CAP_FEEDERLOADED = 4099, - /** The date and time the image was acquired. - * Stored in the form "YYYY/MM/DD HH:mm:SS.sss" where YYYY is the year, MM is the - * numerical month, DD is the numerical day, HH is the hour, mm is the minute, SS is the second, - * and sss is the millisecond. - */ - CAP_TIMEDATE = 4100, - /** Returns a list of all the capabilities for which the Source will answer inquiries. Does not indicate - * which capabilities the Source will allow to be set by the application. Some capabilities can only - * be set if certain setup work has been done so the Source cannot globally answer which - * capabilities are "set-able." - */ - CAP_SUPPORTEDCAPS = 4101, - /** Allows the application and Source to negotiate capabilities to be used in States 5 and 6. */ - CAP_EXTENDEDCAPS = 4102, - /** If TRUE, the Source will automatically feed the next page from the document feeder after the - * number of frames negotiated for capture from each page are acquired. CAP_FEEDERENABLED - * must be TRUE to use this capability. - */ - CAP_AUTOFEED = 4103, - /** If TRUE, the Source will eject the current page being acquired from and will leave the feeder - * acquire area empty. - * If CAP_AUTOFEED is TRUE, a fresh page will be advanced. - * CAP_FEEDERENABLED must equal TRUE to use this capability. - * This capability must have been negotiated as an extended capability to be used in States 5 and 6. - */ - CAP_CLEARPAGE = 4104, - /** If TRUE, the Source will eject the current page and advance the next page in the document feeder - * into the feeder acquire area. - * If CAP_AUTOFEED is TRUE, the same action just described will occur and CAP_AUTOFEED will - * remain active. - * CAP_FEEDERENABLED must equal TRUE to use this capability. - * This capability must have been negotiated as an extended capability to be used in States 5 and 6. - */ - CAP_FEEDPAGE = 4105, - /** If TRUE, the Source will return the current page to the input side of the document feeder and - * feed the last page from the output side of the feeder back into the acquisition area. - * If CAP_AUTOFEED is TRUE, automatic feeding will continue after all negotiated frames from this - * page are acquired. - * CAP_FEEDERENABLED must equal TRUE to use this capability. - * This capability must have been negotiated as an extended capability to be used in States 5 and 6. - */ - CAP_REWINDPAGE = 4106, - /** If TRUE, the Source will display a progress indicator during acquisition and transfer, regardless - * of whether the Source's user interface is active. If FALSE, the progress indicator will be - * suppressed if the Source's user interface is inactive. - * The Source will continue to display device-specific instructions and error messages even with - * the Source user interface and progress indicators turned off. - */ - CAP_INDICATORS = 4107, - /** Returns a list of all the capabilities for which the Source will answer inquiries. Does not indicate - * which capabilities the Source will allow to be set by the application. Some capabilities can only - * be set if certain setup work has been done so the Source cannot globally answer which - * capabilities are "set-able." - */ - CAP_SUPPORTEDCAPSEXT = 4108, - /** This capability determines whether the device has a paper sensor that can detect documents on the ADF or Flatbed. */ - CAP_PAPERDETECTABLE = 4109, - /** If TRUE, indicates that this Source supports acquisition with the UI disabled; i.e., - * TW_USERINTERFACE's ShowUI field can be set to FALSE. If FALSE, indicates that this Source - * can only support acquisition with the UI enabled. - */ - CAP_UICONTROLLABLE = 4110, - /** If TRUE, the physical hardware (e.g., scanner, digital camera, image database, etc.) that - * represents the image source is attached, powered on, and communicating. - */ - CAP_DEVICEONLINE = 4111, - /** This capability is intended to boost the performance of a Source. The fundamental assumption - * behind AutoScan is that the device is able to capture the number of images indicated by the - * value of CAP_XFERCOUNT without waiting for the Application to request the image transfers. - * This is only possible if the device has internal buffers capable of caching the images it captures. - * The default behavior is undefined, because some high volume devices are incapable of anything - * but CAP_AUTOSCAN being equal to TRUE. However, if a Source supports FALSE, it should use it - * as the mandatory default, since this best describes the behavior of pre-1.8 TWAIN Applications. - */ - CAP_AUTOSCAN = 4112, - /** Allows an application to request the delivery of thumbnail representations for the set of images - * that are to be delivered. - * Setting CAP_THUMBNAILSENABLED to TRUE turns on thumbnail mode. Images transferred - * thereafter will be sent at thumbnail size (exact thumbnail size is determined by the Data Source). - * Setting this capability to FALSE turns thumbnail mode off and returns full size images. - */ - CAP_THUMBNAILSENABLED = 4113, - /** This indicates whether the scanner supports duplex. If so, it further indicates whether one-path - * or two-path duplex is supported. - */ - CAP_DUPLEX = 4114, - /** The user can set the duplex option to be TRUE or FALSE. If TRUE, the scanner scans both sides - * of a paper; otherwise, the scanner will scan only one side of the image. - */ - CAP_DUPLEXENABLED = 4115, - /** Allows an application to query a source to see if it implements the new user interface settings dialog. */ - CAP_ENABLEDSUIONLY = 4116, - CAP_CUSTOMDSDATA = 4117, - /** Allows the application to specify the starting endorser / imprinter number. All other endorser/ - * imprinter properties should be handled through the data source's user interface. - * The user can set the starting number for the endorser. - */ - CAP_ENDORSER = 4118, - /** Turns specific audible alarms on and off. */ - CAP_ALARMS = 4120, - /** The volume of a device's audible alarm. Note that this control affects the volume of all alarms; - * no specific volume control for individual types of alarms is provided. - */ - CAP_ALARMVOLUME = 4121, - /** The number of images to automatically capture. This does not refer to the number of images to - * be sent to the Application, use CAP_XFERCOUNT for that. - */ - CAP_AUTOMATICCAPTURE = 4122, - /** For automatic capture, this value selects the number of milliseconds before the first picture is to - * be taken, or the first image is to be scanned. - */ - CAP_TIMEBEFOREFIRSTCAPTURE = 4123, - /** For automatic capture, this value selects the milliseconds to wait between pictures taken, or images scanned. */ - CAP_TIMEBETWEENCAPTURES = 4124, - /** CapGet() reports the presence of data in the scanner's buffers. CapSet() with a value of TWCB_CLEAR immediately clears the buffers. */ - CAP_CLEARBUFFERS = 4125, - /** Describes the number of pages that the scanner can buffer when CAP_AUTOSCAN is enabled. */ - CAP_MAXBATCHBUFFERS = 4126, - /** The date and time of the device's clock. - * Managed in the form "YYYY/MM/DD HH:mm:SS:sss" where YYYY is the year, MM is the - * numerical month, DD is the numerical day, HH is the hour, mm is the minute, SS is the second, - * and sss is the millisecond. - */ - CAP_DEVICETIMEDATE = 4127, - /** CapGet() reports the kinds of power available to the device. CapGetCurrent() reports the current power supply in use. */ - CAP_POWERSUPPLY = 4128, - /** This capability queries the Source for UI support for preview mode. If TRUE, the Source supports preview UI. */ - CAP_CAMERAPREVIEWUI = 4129, - /** A string containing the serial number of the currently selected device in the Source. Multiple - * devices may all report the same serial number. - */ - CAP_SERIALNUMBER = 4132, - /** CapGet() returns the current list of available printer devices, along with the one currently being used for negotiation. - * CapSet() selects the current device for negotiation, and optionally constrains the list. - * Top/Bottom refers to duplex devices, and indicates if the printer is writing on the top or the bottom of the sheet of paper. - * Simplex devices use the top settings. Before/After indicates whether printing occurs before or after the sheet of paper has been scanned. - */ - CAP_PRINTER = 4134, - /** Turns the current CAP_PRINTER device on or off. */ - CAP_PRINTERENABLED = 4135, - /** The User can set the starting number for the current CAP_PRINTER device. */ - CAP_PRINTERINDEX = 4136, - /** Specifies the appropriate current CAP_PRINTER device mode. - * Note: - * O TWPM_SINGLESTRING specifies that the printed text will consist of a single string. - * O TWPM _MULTISTRING specifies that the printed text will consist of an enumerated list of - * strings to be printed in order. - * O TWPM _COMPOUNDSTRING specifies that the printed string will consist of a compound of a - * String followed by a value followed by a suffix string. - */ - CAP_PRINTERMODE = 4137, - /** Specifies the string(s) that are to be used in the string component when the current - * CAP_PRINTER device is enabled. - */ - CAP_PRINTERSTRING = 4138, - /** Specifies the string that shall be used as the current CAP_PRINTER device's suffix. */ - CAP_PRINTERSUFFIX = 4139, - /** Allows Application and Source to identify which languages they have in common for the exchange of string data, - * and to select the language of the internal UI. Since the TWLG_xxxx codes include language and country data, there is no separate - * capability for selecting the country. - */ - CAP_LANGUAGE = 4140, - /** Helps the Application determine any special actions it may need to take when negotiating - * frames with the Source. Allowed values are listed in . - * TWFA_NONE: The alignment is free-floating. Applications should assume - * that the origin for frames is on the left. - * TWFA_LEFT: The alignment is to the left. - * TWFA_CENTER: The alignment is centered. This means that the paper will - * be fed in the middle of the ICAP_PHYSICALWIDTH of the - * device. If this is set, then the Application should calculate - * any frames with a left offset of zero. - * TWFA_RIGHT: The alignment is to the right. - */ - CAP_FEEDERALIGNMENT = 4141, - /** TWFO_FIRSTPAGEFIRST if the feeder starts with the top of the first page. - * TWFO_LASTPAGEFIRST is the feeder starts with the top of the last page. - */ - CAP_FEEDERORDER = 4142, - /** Indicates whether the physical hardware (e.g. scanner, digital camera) is capable of acquiring - * multiple images of the same page without changes to the physical registration of that page. - */ - CAP_REACQUIREALLOWED = 4144, - /** The minutes of battery power remaining to the device. */ - CAP_BATTERYMINUTES = 4146, - /** When used with CapGet(), return the percentage of battery power level on camera. If -1 is returned, it indicates that the battery is not present. */ - CAP_BATTERYPERCENTAGE = 4147, - /** Added 1.91 */ - CAP_CAMERASIDE = 4148, - /** Added 1.91 */ - CAP_SEGMENTED = 4149, - /** Added 2.0 */ - CAP_CAMERAENABLED = 4150, - /** Added 2.0 */ - CAP_CAMERAORDER = 4151, - /** Added 2.0 */ - CAP_MICRENABLED = 4152, - /** Added 2.0 */ - CAP_FEEDERPREP = 4153, - /** Added 2.0 */ - CAP_FEEDERPOCKET = 4154, - /** Added 2.1 */ - CAP_AUTOMATICSENSEMEDIUM = 4155, - /** Added 2.1 */ - CAP_CUSTOMINTERFACEGUID = 4156, - /** TRUE enables and FALSE disables the Source's Auto-brightness function (if any). */ - ICAP_AUTOBRIGHT = 4352, - /** The brightness values available within the Source. */ - ICAP_BRIGHTNESS = 4353, - /** The contrast values available within the Source. */ - ICAP_CONTRAST = 4355, - /** Specifies the square-cell halftone (dithering) matrix the Source should use to halftone the image. */ - ICAP_CUSTHALFTONE = 4356, - /** Specifies the exposure time used to capture the image, in seconds. */ - ICAP_EXPOSURETIME = 4357, - /** Describes the color characteristic of the subtractive filter applied to the image data. Multiple - * filters may be applied to a single acquisition. - */ - ICAP_FILTER = 4358, - /** Specifies whether or not the image was acquired using a flash. */ - ICAP_FLASHUSED = 4359, - /** Gamma correction value for the image data. */ - ICAP_GAMMA = 4360, - /** A list of names of the halftone patterns available within the Source. */ - ICAP_HALFTONES = 4361, - /** Specifies which value in an image should be interpreted as the lightest "highlight." All values - * "lighter" than this value will be clipped to this value. Whether lighter values are smaller or - * larger can be determined by examining the Current value of ICAP_PIXELFLAVOR. - */ - ICAP_HIGHLIGHT = 4362, - /** Informs the application which file formats the Source can generate (CapGet()). Tells the Source which file formats the application can handle (CapSet()). - * TWFF_TIFF Used for document - * TWFF_PICT Native Macintosh - * TWFF_BMP Native Microsoft - * TWFF_XBM Used for document - * TWFF_JFIF Wrapper for JPEG - * TWFF_FPX FlashPix, used with digital - * TWFF_TIFFMULTI Multi-page TIFF files - * TWFF_PNG An image format standard intended for use on the web, replaces GIF - * TWFF_SPIFF A standard from JPEG, intended to replace JFIF, also supports JBIG - * TWFF_EXIF File format for use with digital cameras. - */ - ICAP_IMAGEFILEFORMAT = 4364, - /** TRUE means the lamp is currently, or should be set to ON. Sources may not support CapSet() operations. */ - ICAP_LAMPSTATE = 4365, - /** Describes the general color characteristic of the light source used to acquire the image. */ - ICAP_LIGHTSOURCE = 4366, - /** Defines which edge of the "paper" the image's "top" is aligned with. This information is used to adjust the frames to match the - * scanning orientation of the paper. For instance, if an ICAP_SUPPORTEDSIZE of TWSS_ISOA4 has been negotiated, - * and ICAP_ORIENTATION is set to TWOR_LANDSCAPE, then the Source must rotate the frame it downloads to the scanner to reflect the - * orientation of the paper. Please note that setting ICAP_ORIENTATION does not affect the values reported by ICAP_FRAMES; - * it just causes the Source to use them in a different way. The upper-left of the image is defined as the location where both the primary and - * secondary scans originate. (The X axis is the primary scan direction and the Y axis is the secondary scan direction.) - * For a flatbed scanner, the light bar moves in the secondary scan direction. For a handheld scanner, the scanner is drug in the - * secondary scan direction. For a digital camera, the secondary direction is the vertical axis when the viewed image is considered upright. - */ - ICAP_ORIENTATION = 4368, - /** The maximum physical width (X-axis) the Source can acquire (measured in units of ICAP_UNITS). */ - ICAP_PHYSICALWIDTH = 4369, - /** The maximum physical height (Y-axis) the Source can acquire (measured in units of ICAP_UNITS). */ - ICAP_PHYSICALHEIGHT = 4370, - /** Specifies which value in an image should be interpreted as the darkest "shadow." All values - * "darker" than this value will be clipped to this value. - */ - ICAP_SHADOW = 4371, - /** The list of frames the Source will acquire on each page. */ - ICAP_FRAMES = 4372, - /** The native optical resolution along the X-axis of the device being controlled by the Source. Most - * devices will respond with a single value (TW_ONEVALUE). - * This is NOT a list of all resolutions that can be generated by the device. Rather, this is the - * resolution of the device's optics. Measured in units of pixels per unit as defined by - * ICAP_UNITS (pixels per TWUN_PIXELS yields dimensionless data). - */ - ICAP_XNATIVERESOLUTION = 4374, - /** The native optical resolution along the Y-axis of the device being controlled by the Source. - * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS - * yields dimensionless data). - */ - ICAP_YNATIVERESOLUTION = 4375, - /** All the X-axis resolutions the Source can provide. - * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS - * yields dimensionless data). That is, when the units are TWUN_PIXELS, both - * ICAP_XRESOLUTION and ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources - * like to report the actual number of pixels that the device reports, but that response is more - * appropriate in ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. - */ - ICAP_XRESOLUTION = 4376, - /** All the Y-axis resolutions the Source can provide. - * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS - * yields dimensionless data). That is, when the units are TWUN_PIXELS, both - * ICAP_XRESOLUTION and ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources - * like to report the actual number of pixels that the device reports, but that response is more - * appropriate in ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. - */ - ICAP_YRESOLUTION = 4377, - /** The maximum number of frames the Source can provide or the application can accept per page. - * This is a bounding capability only. It does not establish current or future behavior. - */ - ICAP_MAXFRAMES = 4378, - /** This is used with buffered memory transfers. If TRUE, Source can provide application with tiled image data. */ - ICAP_TILES = 4379, - /** Specifies how the bytes in an image are filled by the Source. TWBO_MSBFIRST indicates that the leftmost bit in the byte (usually bit 7) is - * the byte's Most Significant Bit. - */ - ICAP_BITORDER = 4380, - /** Used for CCITT Group 3 2-dimensional compression. The 'K' factor indicates how often the - * new compression baseline should be re-established. A value of 2 or 4 is common in facsimile - * communication. A value of zero in this field will indicate an infinite K factor—the baseline is - * only calculated at the beginning of the transfer. - */ - ICAP_CCITTKFACTOR = 4381, - /** Describes whether the image was captured transmissively or reflectively. */ - ICAP_LIGHTPATH = 4382, - /** Sense of the pixel whose numeric value is zero (minimum data value). */ - ICAP_PIXELFLAVOR = 4383, - /** Allows the application and Source to identify which color data formats are available. There are - * two options, "planar" and "chunky." - */ - ICAP_PLANARCHUNKY = 4384, - /** How the Source can/should rotate the scanned image data prior to transfer. This doesn't use - * ICAP_UNITS. It is always measured in degrees. Any applied value is additive with any - * rotation specified in ICAP_ORIENTATION. - */ - ICAP_ROTATION = 4385, - /** For devices that support fixed frame sizes. - * Defined sizes match typical page sizes. This specifies the size(s) the Source can/should use to acquire image data. - */ - ICAP_SUPPORTEDSIZES = 4386, - /** Specifies the dividing line between black and white. This is the value the Source will use to - * threshold, if needed, when ICAP_PIXELTYPE:TWPT_BW. - * The value is normalized so there are no units of measure associated with this ICAP. - */ - ICAP_THRESHOLD = 4387, - /** All the X-axis scaling values available. A value of '1.0' is equivalent to 100% scaling. Do not use values less than or equal to zero. */ - ICAP_XSCALING = 4388, - /** All the Y-axis scaling values available. A value of '1.0' is equivalent to 100% scaling. Do not use values less than or equal to zero. - * There are no units inherent with this data as it is normalized to 1.0 being "unscaled." - */ - ICAP_YSCALING = 4389, - /** Used for CCITT data compression only. Indicates the bit order representation of the stored compressed codes. */ - ICAP_BITORDERCODES = 4390, - /** Used only for CCITT data compression. Specifies whether the compressed codes' pixel "sense" - * will be inverted from the Current value of ICAP_PIXELFLAVOR prior to transfer. - */ - ICAP_PIXELFLAVORCODES = 4391, - /** Allows the application and Source to agree upon a common set of color descriptors that are - * made available by the Source. This ICAP is only useful for JPEG-compressed buffered memory image transfers. - */ - ICAP_JPEGPIXELTYPE = 4392, - /** Used only with CCITT data compression. Specifies the minimum number of words of compressed codes (compressed data) to be transmitted per line. */ - ICAP_TIMEFILL = 4394, - /** Specifies the pixel bit depths for the Current value of ICAP_PIXELTYPE. For example, when - * using ICAP_PIXELTYPE:TWPT_GRAY, this capability specifies whether this is 8-bit gray or 4-bit gray. - * This depth applies to all the data channels (for instance, the R, G, and B channels will all have - * this same bit depth for RGB data). - */ - ICAP_BITDEPTH = 4395, - /** Specifies the Reduction Method the Source should use to reduce the bit depth of the data. Most - * commonly used with ICAP_PIXELTYPE:TWPT_BW to reduce gray data to black and white. - */ - ICAP_BITDEPTHREDUCTION = 4396, - /** If TRUE the Source will issue a MSG_XFERREADY before starting the scan. - * Note: The Source may need to scan the image before initiating the transfer. This is the case if - * the scanned image is rotated or merged with another scanned image. - */ - ICAP_UNDEFINEDIMAGESIZE = 4397, - /** Allows the application to query the data source to see if it supports extended image attribute capabilities, - * such as Barcode Recognition, Shaded Area Detection and Removal, Skew detection and Removal, and so on. - */ - ICAP_EXTIMAGEINFO = 4399, - /** Allows the source to define the minimum height (Y-axis) that the source can acquire. */ - ICAP_MINIMUMHEIGHT = 4400, - /** Allows the source to define theminimum width (X-axis) that the source can acquire. */ - ICAP_MINIMUMWIDTH = 4401, - /** Use this capability to have the Source discard blank images. The Application never sees these - * images during the scanning session. - * TWBP_DISABLE – this must be the default state for the Source. It indicates that all images will - * be delivered to the Application, none of them will be discarded. - * TWBP_AUTO – if this is used, then the Source will decide if an image is blank or not and discard - * as appropriate. - * If the specified value is a positive number in the range 0 to 231–1, then this capability will use it - * as the byte size cutoff point to identify which images are to be discarded. If the size of the image - * is less than or equal to this value, then it will be discarded. If the size of the image is greater - * than this value, then it will be kept so that it can be transferred to the Application. - */ - ICAP_AUTODISCARDBLANKPAGES = 4404, - /** Flip rotation is used to properly orient images that flip orientation every other image. - * TWFR_BOOK The images to be scanned are viewed in book form, flipping each page from left to right or right to left. - * TWFR_FANFOLD The images to be scanned are viewed in fanfold paper style, flipping each page up or down. - */ - ICAP_FLIPROTATION = 4406, - /** Turns bar code detection on and off. */ - ICAP_BARCODEDETECTIONENABLED = 4407, - /** Provides a list of bar code types that can be detected by the current Data Source. */ - ICAP_SUPPORTEDBARCODETYPES = 4408, - /** The maximum number of supported search priorities. */ - ICAP_BARCODEMAXSEARCHPRIORITIES = 4409, - /** A prioritized list of bar code types dictating the order in which bar codes will be sought. */ - ICAP_BARCODESEARCHPRIORITIES = 4410, - /** Restricts bar code searching to certain orientations, or prioritizes one orientation over the other. */ - ICAP_BARCODESEARCHMODE = 4411, - /** Restricts the number of times a search will be retried if none are found on each page. */ - ICAP_BARCODEMAXRETRIES = 4412, - /** Restricts the total time spent on searching for a bar code on each page. */ - ICAP_BARCODETIMEOUT = 4413, - /** When used with CapGet(), returns all camera supported lens zooming range. */ - ICAP_ZOOMFACTOR = 4414, - /** Turns patch code detection on and off. */ - ICAP_PATCHCODEDETECTIONENABLED = 4415, - /** A list of patch code types that may be detected by the current Data Source. */ - ICAP_SUPPORTEDPATCHCODETYPES = 4416, - /** The maximum number of supported search priorities. */ - ICAP_PATCHCODEMAXSEARCHPRIORITIES = 4417, - /** A prioritized list of patch code types dictating the order in which patch codes will be sought. */ - ICAP_PATCHCODESEARCHPRIORITIES = 4418, - /** Restricts patch code searching to certain orientations, or prioritizes one orientation over the other. */ - ICAP_PATCHCODESEARCHMODE = 4419, - /** Restricts the number of times a search will be retried if none are found on each page. */ - ICAP_PATCHCODEMAXRETRIES = 4420, - /** Restricts the total time spent on searching for a patch code on each page. */ - ICAP_PATCHCODETIMEOUT = 4421, - /** For devices that support flash. CapSet() selects the flash to be used (if any). CapGet() reports the current setting. - * This capability replaces ICAP_FLASHUSED, which is only able to negotiate the flash being on or off. - */ - ICAP_FLASHUSED2 = 4422, - /** For devices that support image enhancement filtering. This capability selects the algorithm used to improve the quality of the image. */ - ICAP_IMAGEFILTER = 4423, - /** For devices that support noise filtering. This capability selects the algorithm used to remove noise. */ - ICAP_NOISEFILTER = 4424, - /** Overscan is used to scan outside of the boundaries described by ICAP_FRAMES, and is used to help acquire image data that - * may be lost because of skewing. - * This is primarily of use for transport scanners which rely on edge detection to begin scanning. - * If overscan is supported, then the device is capable of scanning in the inter-document gap to get the skewed image information. - */ - ICAP_OVERSCAN = 4425, - /** Turns automatic border detection on and off. */ - ICAP_AUTOMATICBORDERDETECTION = 4432, - /** Turns automatic deskew correction on and off. */ - ICAP_AUTOMATICDESKEW = 4433, - /** When TRUE this capability depends on intelligent features within the Source to automatically - * rotate the image to the correct position. - */ - ICAP_AUTOMATICROTATE = 4434, - /** Added 1.9 */ - ICAP_JPEGQUALITY = 4435, - /** Added 1.91 */ - ICAP_FEEDERTYPE = 4436, - /** Added 1.91 */ - ICAP_ICCPROFILE = 4437, - /** Added 2.0 */ - ICAP_AUTOSIZE = 4438, - /** Added 2.1 */ - ICAP_AUTOMATICCROPUSESFRAME = 4439, - /** Added 2.1 */ - ICAP_AUTOMATICLENGTHDETECTION = 4440, - /** Added 2.1 */ - ICAP_AUTOMATICCOLORENABLED = 4441, - /** Added 2.1 */ - ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE = 4442, - /** Added 2.1 */ - ICAP_COLORMANAGEMENTENABLED = 4443, - /** Added 2.1 */ - ICAP_IMAGEMERGE = 4444, - /** Added 2.1 */ - ICAP_IMAGEMERGEHEIGHTTHRESHOLD = 4445, - /** Added 2.1 */ - ICAP_SUPPORTEDEXTIMAGEINFO = 4446 -} - -/** ICAP_BITORDER values. */ -declare enum EnumDWT_CapBitOrder { - TWBO_LSBFIRST = 0, - /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */ - TWBO_MSBFIRST = 1 -} - -/** ICAP_BITDEPTHREDUCTION values. */ -declare enum EnumDWT_CapBitdepthReduction { - TWBR_THRESHOLD = 0, - TWBR_HALFTONE = 1, - TWBR_CUSTHALFTONE = 2, - TWBR_DIFFUSION = 3 -} - -/** CAP_FEEDERALIGNMENT values. */ -declare enum EnumDWT_CapFeederAlignment { - /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */ - TWFA_NONE = 0, - /** The alignment is to the left. */ - TWFA_LEFT = 1, - /** The alignment is centered. This means that the paper will be fed in the middle of the ICAP_PHYSICALWIDTH of the - * device. If this is set, then the Application should calculate any frames with a left offset of zero. - */ - TWFA_CENTER = 2, - /** The alignment is to the right. */ - TWFA_RIGHT = 3 -} - -/** CAP_FEEDERORDER values. */ -declare enum EnumDWT_CapFeederOrder { - /** The feeder starts with the top of the first page. */ - TWFO_FIRSTPAGEFIRST = 0, - /** The feeder starts with the top of the last page. */ - TWFO_LASTPAGEFIRST = 1 -} - -/** ICAP_FILTER values. */ -declare enum EnumDWT_CapFilterType { - TWFT_RED = 0, - TWFT_GREEN = 1, - TWFT_BLUE = 2, - TWFT_NONE = 3, - TWFT_WHITE = 4, - TWFT_CYAN = 5, - TWFT_MAGENTA = 6, - TWFT_YELLOW = 7, - TWFT_BLACK = 8 -} - -/** ICAP_FLASHUSED2 values. */ -declare enum EnumDWT_CapFlash { - TWFL_NONE = 0, - TWFL_OFF = 1, - TWFL_ON = 2, - TWFL_AUTO = 3, - TWFL_REDEYE = 4 -} - -/** ICAP_FLIPROTATION values. */ -declare enum EnumDWT_CapFlipRotation { - /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */ - TWFR_BOOK = 0, - /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */ - TWFR_FANFOLD = 1 -} - -/** ICAP_IMAGEFILTER values. */ -declare enum EnumDWT_CapImageFilter { - TWIF_NONE = 0, - TWIF_AUTO = 1, - /** Good for halftone images. */ - TWIF_LOWPASS = 2, - /** Good for improving text. */ - TWIF_BANDPASS = 3, - /** Good for improving fine lines. */ - TWIF_HIGHPASS = 4, - TWIF_TEXT = 3, - TWIF_FINELINE = 4 -} - -/** CAP_LANGUAGE values. */ -declare enum EnumDWT_CapLanguage { - /** Danish */ - TWLG_DAN = 0, - /** Dutch */ - TWLG_DUT = 1, - /** International English */ - TWLG_ENG = 2, - /** French Canadian */ - TWLG_FCF = 3, - /** Finnish */ - TWLG_FIN = 4, - /** French */ - TWLG_FRN = 5, - /** German */ - TWLG_GER = 6, - /** Icelandic */ - TWLG_ICE = 7, - /** Italian */ - TWLG_ITN = 8, - /** Norwegian */ - TWLG_NOR = 9, - /** Portuguese */ - TWLG_POR = 10, - /** Spanish */ - TWLG_SPA = 11, - /** Swedish */ - TWLG_SWE = 12, - /** U.S. English */ - TWLG_USA = 13, - /** Added for 1.8 */ - TWLG_USERLOCALE = -1, - TWLG_AFRIKAANS = 14, - TWLG_ALBANIA = 15, - TWLG_ARABIC = 16, - TWLG_ARABIC_ALGERIA = 17, - TWLG_ARABIC_BAHRAIN = 18, - TWLG_ARABIC_EGYPT = 19, - TWLG_ARABIC_IRAQ = 20, - TWLG_ARABIC_JORDAN = 21, - TWLG_ARABIC_KUWAIT = 22, - TWLG_ARABIC_LEBANON = 23, - TWLG_ARABIC_LIBYA = 24, - TWLG_ARABIC_MOROCCO = 25, - TWLG_ARABIC_OMAN = 26, - TWLG_ARABIC_QATAR = 27, - TWLG_ARABIC_SAUDIARABIA = 28, - TWLG_ARABIC_SYRIA = 29, - TWLG_ARABIC_TUNISIA = 30, - /** United Arabic Emirates */ - TWLG_ARABIC_UAE = 31, - TWLG_ARABIC_YEMEN = 32, - TWLG_BASQUE = 33, - TWLG_BYELORUSSIAN = 34, - TWLG_BULGARIAN = 35, - TWLG_CATALAN = 36, - TWLG_CHINESE = 37, - TWLG_CHINESE_HONGKONG = 38, - /** People's Republic of China */ - TWLG_CHINESE_PRC = 39, - TWLG_CHINESE_SINGAPORE = 40, - TWLG_CHINESE_SIMPLIFIED = 41, - TWLG_CHINESE_TAIWAN = 42, - TWLG_CHINESE_TRADITIONAL = 43, - TWLG_CROATIA = 44, - TWLG_CZECH = 45, - TWLG_DANISH = 0, - TWLG_DUTCH = 1, - TWLG_DUTCH_BELGIAN = 46, - TWLG_ENGLISH = 2, - TWLG_ENGLISH_AUSTRALIAN = 47, - TWLG_ENGLISH_CANADIAN = 48, - TWLG_ENGLISH_IRELAND = 49, - TWLG_ENGLISH_NEWZEALAND = 50, - TWLG_ENGLISH_SOUTHAFRICA = 51, - TWLG_ENGLISH_UK = 52, - TWLG_ENGLISH_USA = 13, - TWLG_ESTONIAN = 53, - TWLG_FAEROESE = 54, - TWLG_FARSI = 55, - TWLG_FINNISH = 4, - TWLG_FRENCH = 5, - TWLG_FRENCH_BELGIAN = 56, - TWLG_FRENCH_CANADIAN = 3, - TWLG_FRENCH_LUXEMBOURG = 57, - TWLG_FRENCH_SWISS = 58, - TWLG_GERMAN = 6, - TWLG_GERMAN_AUSTRIAN = 59, - TWLG_GERMAN_LUXEMBOURG = 60, - TWLG_GERMAN_LIECHTENSTEIN = 61, - TWLG_GERMAN_SWISS = 62, - TWLG_GREEK = 63, - TWLG_HEBREW = 64, - TWLG_HUNGARIAN = 65, - TWLG_ICELANDIC = 7, - TWLG_INDONESIAN = 66, - TWLG_ITALIAN = 8, - TWLG_ITALIAN_SWISS = 67, - TWLG_JAPANESE = 68, - TWLG_KOREAN = 69, - TWLG_KOREAN_JOHAB = 70, - TWLG_LATVIAN = 71, - TWLG_LITHUANIAN = 72, - TWLG_NORWEGIAN = 9, - TWLG_NORWEGIAN_BOKMAL = 73, - TWLG_NORWEGIAN_NYNORSK = 74, - TWLG_POLISH = 75, - TWLG_PORTUGUESE = 10, - TWLG_PORTUGUESE_BRAZIL = 76, - TWLG_ROMANIAN = 77, - TWLG_RUSSIAN = 78, - TWLG_SERBIAN_LATIN = 79, - TWLG_SLOVAK = 80, - TWLG_SLOVENIAN = 81, - TWLG_SPANISH = 11, - TWLG_SPANISH_MEXICAN = 82, - TWLG_SPANISH_MODERN = 83, - TWLG_SWEDISH = 12, - TWLG_THAI = 84, - TWLG_TURKISH = 85, - TWLG_UKRANIAN = 86, - /** More stuff added for 1.8 */ - TWLG_ASSAMESE = 87, - TWLG_BENGALI = 88, - TWLG_BIHARI = 89, - TWLG_BODO = 90, - TWLG_DOGRI = 91, - TWLG_GUJARATI = 92, - TWLG_HARYANVI = 93, - TWLG_HINDI = 94, - TWLG_KANNADA = 95, - TWLG_KASHMIRI = 96, - TWLG_MALAYALAM = 97, - TWLG_MARATHI = 98, - TWLG_MARWARI = 99, - TWLG_MEGHALAYAN = 100, - TWLG_MIZO = 101, - TWLG_NAGA = 102, - TWLG_ORISSI = 103, - TWLG_PUNJABI = 104, - TWLG_PUSHTU = 105, - TWLG_SERBIAN_CYRILLIC = 106, - TWLG_SIKKIMI = 107, - TWLG_SWEDISH_FINLAND = 108, - TWLG_TAMIL = 109, - TWLG_TELUGU = 110, - TWLG_TRIPURI = 111, - TWLG_URDU = 112, - TWLG_VIETNAMESE = 113 -} - -/** ICAP_LIGHTPATH values. */ -declare enum EnumDWT_CapLightPath { - TWLP_REFLECTIVE = 0, - TWLP_TRANSMISSIVE = 1 -} - -/** ICAP_LIGHTSOURCE values. */ -declare enum EnumDWT_CapLightSource { - TWLS_RED = 0, - TWLS_GREEN = 1, - TWLS_BLUE = 2, - TWLS_NONE = 3, - TWLS_WHITE = 4, - TWLS_UV = 5, - TWLS_IR = 6 -} - -/** ICAP_NOISEFILTER values. */ -declare enum EnumDWT_CapNoiseFilter { - TWNF_NONE = 0, - TWNF_AUTO = 1, - TWNF_LONEPIXEL = 2, - TWNF_MAJORITYRULE = 3 -} - -/** ICAP_ORIENTATION values. */ -declare enum EnumDWT_CapORientation { - TWOR_ROT0 = 0, - TWOR_ROT90 = 1, - TWOR_ROT180 = 2, - TWOR_ROT270 = 3, - TWOR_PORTRAIT = 0, - TWOR_LANDSCAPE = 3, - /** 2.0 */ - TWOR_AUTO = 4, - /** 2.0 */ - TWOR_AUTOTEXT = 5, - /** 2.0 */ - TWOR_AUTOPICTURE = 6 -} - -/** ICAP_OVERSCAN values. */ -declare enum EnumDWT_CapOverscan { - TWOV_NONE = 0, - TWOV_AUTO = 1, - TWOV_TOPBOTTOM = 2, - TWOV_LEFTRIGHT = 3, - TWOV_ALL = 4 -} - -/** ICAP_PIXELFLAVOR values. */ -declare enum EnumDWT_CapPixelFlavor { - /** Zero pixel represents darkest shade. zero pixel represents darkest shade */ - TWPF_CHOCOLATE = 0, - /** Zero pixel represents lightest shade. zero pixel represents lightest shade */ - TWPF_VANILLA = 1 -} - -/** ICAP_PLANARCHUNKY values. */ -declare enum EnumDWT_CapPlanarChunky { - TWPC_CHUNKY = 0, - TWPC_PLANAR = 1 -} - -/** CAP_PRINTER values. */ -declare enum EnumDWT_CapPrinter { - TWPR_IMPRINTERTOPBEFORE = 0, - TWPR_IMPRINTERTOPAFTER = 1, - TWPR_IMPRINTERBOTTOMBEFORE = 2, - TWPR_IMPRINTERBOTTOMAFTER = 3, - TWPR_ENDORSERTOPBEFORE = 4, - TWPR_ENDORSERTOPAFTER = 5, - TWPR_ENDORSERBOTTOMBEFORE = 6, - TWPR_ENDORSERBOTTOMAFTER = 7 -} - -/** CAP_PRINTERMODE values. */ -declare enum EnumDWT_CapPrinterMode { - /** Specifies that the printed text will consist of a single string. */ - TWPM_SINGLESTRING = 0, - /** Specifies that the printed text will consist of an enumerated list of strings to be printed in order. */ - TWPM_MULTISTRING = 1, - /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */ - TWPM_COMPOUNDSTRING = 2 -} - -/** TWAIN Supported sizes. */ -declare enum EnumDWT_CapSupportedSizes { - /** 0 */ - TWSS_NONE = 0, - /** 1 */ - TWSS_A4LETTER = 1, - /** 2 */ - TWSS_B5LETTER = 2, - /** 3 */ - TWSS_USLETTER = 3, - /** 4 */ - TWSS_USLEGAL = 4, - /** Added 1.5 - * 5 - */ - TWSS_A5 = 5, - /** 6 */ - TWSS_B4 = 6, - /** 7 */ - TWSS_B6 = 7, - /** Added 1.7 - * 9 - */ - TWSS_USLEDGER = 9, - /** 10 */ - TWSS_USEXECUTIVE = 10, - /** 11 */ - TWSS_A3 = 11, - /** 12 */ - TWSS_B3 = 12, - /** 13 */ - TWSS_A6 = 13, - /** 14 */ - TWSS_C4 = 14, - /** 15 */ - TWSS_C5 = 15, - /** 16 */ - TWSS_C6 = 16, - /** Added 1.8 - * 17 - */ - TWSS_4A0 = 17, - /** 18 */ - TWSS_2A0 = 18, - /** 19 */ - TWSS_A0 = 19, - /** 20 */ - TWSS_A1 = 20, - /** 21 */ - TWSS_A2 = 21, - /** 1 */ - TWSS_A4 = 1, - /** 22 */ - TWSS_A7 = 22, - /** 23 */ - TWSS_A8 = 23, - /** 24 */ - TWSS_A9 = 24, - /** 25 */ - TWSS_A10 = 25, - /** 26 */ - TWSS_ISOB0 = 26, - /** 27 */ - TWSS_ISOB1 = 27, - /** 28 */ - TWSS_ISOB2 = 28, - /** 12 */ - TWSS_ISOB3 = 12, - /** 6 */ - TWSS_ISOB4 = 6, - /** 29 */ - TWSS_ISOB5 = 29, - /** 7 */ - TWSS_ISOB6 = 7, - /** 30 */ - TWSS_ISOB7 = 30, - /** 31 */ - TWSS_ISOB8 = 31, - /** 32 */ - TWSS_ISOB9 = 32, - /** 33 */ - TWSS_ISOB10 = 33, - /** 34 */ - TWSS_JISB0 = 34, - /** 35 */ - TWSS_JISB1 = 35, - /** 36 */ - TWSS_JISB2 = 36, - /** 37 */ - TWSS_JISB3 = 37, - /** 38 */ - TWSS_JISB4 = 38, - /** 2 */ - TWSS_JISB5 = 2, - /** 39 */ - TWSS_JISB6 = 39, - /** 40 */ - TWSS_JISB7 = 40, - /** 41 */ - TWSS_JISB8 = 41, - /** 41 */ - TWSS_JISB9 = 42, - /** 43 */ - TWSS_JISB10 = 43, - /** 44 */ - TWSS_C0 = 44, - /** 45 */ - TWSS_C1 = 45, - /** 46 */ - TWSS_C2 = 46, - /** 47 */ - TWSS_C3 = 47, - /** 48 */ - TWSS_C7 = 48, - /** 49 */ - TWSS_C8 = 49, - /** 50 */ - TWSS_C9 = 50, - /** 51 */ - TWSS_C10 = 51, - /** 52 */ - TWSS_USSTATEMENT = 52, - /** 53 */ - TWSS_BUSINESSCARD = 53, - /** 54. Added 2.1 */ - TWSS_MAXSIZE = 54 -} - -/** Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected. - * To help categorize the supported values into clear structures, TWAIN defines four types of containers for capabilities = - * TW_ONEVALUE, TW_ARRAY, TW_RANGE and TW_ENUMERATION. - */ -declare enum EnumDWT_CapType { - /** Nothing. */ - TWON_NONE = 0, - /** A rectangular array of values that describe a logical item. It is similar to the TW_ONEVALUE because the current and default values are the same and - * there are no other values to select from. For example, a list of the names, such as the supported capabilities list returned by the CAP_SUPPORTEDCAPS - * capability, would use this type of container. - */ - TWON_ARRAY = 3, - /** This is the most general type because it defines a list of values from which the Current Value can be chosen. - * The values do not progress uniformly through a range and there is not a consistent step size between the values. - * For example, if a Source's resolution options do not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600). - */ - TWON_ENUMERATION = 4, - /** A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value. - * For example, a capability that indicates the presence of a document feeder could be of this type. - */ - TWON_ONEVALUE = 5, - /** Many capabilities allow users to select their current value from a range of regularly spaced values. - * The capability can specify the minimum and maximum acceptable values and the incremental step size between the values. - * For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600). - */ - TWON_RANGE = 6 -} - -/** The kind of data stored in the container. */ -declare enum EnumDWT_CapValueType { - TWTY_INT8 = 0, - /** Means Item is a TW_INT16 */ - TWTY_INT16 = 1, - /** Means Item is a TW_INT32 */ - TWTY_INT32 = 2, - /** Means Item is a TW_UINT8 */ - TWTY_UINT8 = 3, - /** Means Item is a TW_UINT16 */ - TWTY_UINT16 = 4, - /** Means Item is a TW_int */ - TWTY_int = 5, - /** Means Item is a TW_BOOL */ - TWTY_BOOL = 6, - /** Means Item is a TW_FIX32 */ - TWTY_FIX32 = 7, - /** Means Item is a TW_FRAME */ - TWTY_FRAME = 8, - /** Means Item is a TW_STR32 */ - TWTY_STR32 = 9, - /** Means Item is a TW_STR64 */ - TWTY_STR64 = 10, - /** Means Item is a TW_STR128 */ - TWTY_STR128 = 11, - /** Means Item is a TW_STR255 */ - TWTY_STR255 = 12 -} - -/** ICAP_DUPLEX values. */ -declare enum EnumDWT_DUPLEX { - TWDX_NONE = 0, - TWDX_1PASSDUPLEX = 1, - TWDX_2PASSDUPLEX = 2 -} - -/** Data source status. */ -declare enum EnumDWT_DataSourceStatus { - /** Indicate the data source is closed. */ - TWDSS_CLOSED = 0, - /** Indicate the data source is opened. */ - TWDSS_OPENED = 1, - /** Indicate the data source is enabled. */ - TWDSS_ENABLED = 2, - /** Indicate the data source is acquiring image. */ - TWDSS_ACQUIRING = 3 -} - -declare enum EnumDWT_Error { - ModuleNotExists = -2371 -} - -/** ICAP_IMAGEFILEFORMAT values. */ -declare enum EnumDWT_FileFormat { - /** Used for document imaging. Tagged Image File Format */ - TWFF_TIFF = 0, - /** Native Macintosh format. Macintosh PICT */ - TWFF_PICT = 1, - /** Native Microsoft format. Windows Bitmap */ - TWFF_BMP = 2, - /** Used for document imaging. X-Windows Bitmap */ - TWFF_XBM = 3, - /** Wrapper for JPEG images. JPEG File Interchange Format */ - TWFF_JFIF = 4, - /** FlashPix, used with digital cameras. Flash Pix */ - TWFF_FPX = 5, - /** Multi-page TIFF files. Multi-page tiff file */ - TWFF_TIFFMULTI = 6, - /** An image format standard intended for use on the web, replaces GIF. */ - TWFF_PNG = 7, - /** A standard from JPEG, intended to replace JFIF, also supports JBIG. */ - TWFF_SPIFF = 8, - /** File format for use with digital cameras. */ - TWFF_EXIF = 9, - /** A file format from Adobe. 1.91 NB: this is not PDF/A */ - TWFF_PDF = 10, - /** A file format from the Joint Photographic Experts Group. 1.91 */ - TWFF_JP2 = 11, - /** 1.91 */ - TWFF_JPN = 12, - /** 1.91 */ - TWFF_JPX = 13, - /** A file format from LizardTech. 1.91 */ - TWFF_DEJAVU = 14, - /** A file format from Adobe. 2.0 */ - TWFF_PDFA = 15, - /** 2.1 Adobe PDF/A, Version 2 */ - TWFF_PDFA2 = 16 -} - -/** Fit window type */ -declare enum EnumDWT_FitWindowType { - /** Fit the image to the width and height of the window */ - enumFitWindow = 0, - /** Fit the image to the height of the window */ - enumFitWindowHeight = 1, - /** Fit the image to the width of the window */ - enumFitWindowWidth = 2 -} - -/** Image type */ -declare enum EnumDWT_ImageType { - /** Native Microsoft format. */ - IT_BMP = 0, - /** JPEG format. */ - IT_JPG = 1, - /** Tagged Image File Format. */ - IT_TIF = 2, - /** An image format standard intended for use on the web, replaces GIF. */ - IT_PNG = 3, - /** A file format from Adobe. */ - IT_PDF = 4, - /** All supported formats which are bmp, jpg, tif, png and pdf */ - IT_ALL = 5 -} - -declare enum EnumDWT_InitMsg { - Info = 1, - Error = 2, - NotInstalledError = 3, - DownloadError = 4, - DownloadNotRestartError = 5 -} - -/** The method to do interpolation. */ -declare enum EnumDWT_InterpolationMethod { - IM_NEARESTNEIGHBOUR = 1, - IM_BILINEAR = 2, - IM_BICUBIC = 3, - IM_BESTQUALITY = 5 -} - -declare enum EnumDWT_Language { - English = 0, - French = 1, - Arabic = 2, - Spanish = 3, - Portuguese = 4, - German = 5, - Italian = 6, - Russian = 7, - Chinese = 8 -} - -/** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */ -declare enum EnumDWT_MagType { - /** Added 2.0 */ - TWMD_MICR = 0, - /** added 2.1 */ - TWMD_RAW = 1, - /** added 2.1 */ - TWMD_INVALID = 2 -} - -/** For query the operation that are supported by the data source on a capability . - * Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT - */ -declare enum EnumDWT_MessageType { - TWQC_GET = 1, - TWQC_SET = 2, - TWQC_GETDEFAULT = 4, - TWQC_GETCURRENT = 8, - TWQC_RESET = 16 -} - -declare enum EnumDWT_MouseShape { - Default = 0, - Hand = 1, - Crosshair = 2, - Zoom = 3 -} - -/** PDF file compression type. */ -declare enum EnumDWT_PDFCompressionType { - /** Auto mode. */ - PDF_AUTO = 0, - /** CCITT Group 3 fax encoding. */ - PDF_FAX3 = 1, - /** CCITT Group 4 fax encoding */ - PDF_FAX4 = 2, - /** Lempel Ziv and Welch */ - PDF_LZW = 3, - /** CCITT modified Huffman RLE. */ - PDF_RLE = 4, - /** JPEG compression. */ - PDF_JPEG = 5 -} - -/** ICAP_PIXELTYPE values (PT_ means Pixel Type) */ -declare enum EnumDWT_PixelType { - TWPT_BW = 0, - TWPT_GRAY = 1, - TWPT_RGB = 2, - TWPT_PALLETE = 3, - TWPT_CMY = 4, - TWPT_CMYK = 5, - TWPT_YUV = 6, - TWPT_YUVK = 7, - TWPT_CIEXYZ = 8, - TWPT_LAB = 9, - TWPT_SRGB = 10, - TWPT_SCRGB = 11, - TWPT_INFRARED = 16 -} - -declare enum EnumDWT_PlatformType { - /// Fit the image to the width and height of the window - enumWindow = 0, - /// Fit the image to the height of the window - enumMac = 1, - /// Fit the image to the width of the window - enumLinux = 2 -} - -declare enum EnumDWT_ShowMode { - /** Activates the window and displays it in its current size and position. */ - SW_ACTIVE = 0, - /** Maximizes the window */ - SW_MAX = 1, - /** Minimize the window */ - SW_MIN = 2, - /** Close the latest opened editor window */ - SW_CLOSE = 3, - /** Check whether a window exists */ - SW_IFLIVE = 4 -} - -/** TIFF file compression type. */ -declare enum EnumDWT_TIFFCompressionType { - /** Auto mode. */ - TIFF_AUTO = 0, - /** Dump mode. */ - TIFF_NONE = 1, - /** CCITT modified Huffman RLE. */ - TIFF_RLE = 2, - /** CCITT Group 3 fax encoding. */ - TIFF_FAX3 = 3, - /** CCITT T.4 (TIFF 6 name). */ - TIFF_T4 = 3, - /** CCITT Group 4 fax encoding */ - TIFF_FAX4 = 4, - /** CCITT T.6 (TIFF 6 name). */ - TIFF_T6 = 4, - /** Lempel Ziv and Welch */ - TIFF_LZW = 5, - TIFF_JPEG = 7, - TIFF_PACKBITS = 32773 -} - -/** ICAP_XFERMECH values. */ -declare enum EnumDWT_TransferMode { - /** Native transfers require the data to be transferred to a single large block of RAM. Therefore, - * they always face the risk of having an inadequate amount of RAM available to perform the transfer successfully. - */ - TWSX_NATIVE = 0, - /** Disk File Mode Transfers. */ - TWSX_FILE = 1, - /** Buffered Memory Mode Transfers. */ - TWSX_MEMORY = 2/*,*/ - /** added 1.91 , not supported in DWT yet*/ - /** TWSX_MEMFILE = 4*/ -} - -/** ICAP_UNITS values. */ -declare enum EnumDWT_UnitType { - TWUN_INCHES = 0, - TWUN_CENTIMETERS = 1, - TWUN_PICAS = 2, - TWUN_POINTS = 3, - TWUN_TWIPS = 4, - TWUN_PIXELS = 5, - TWUN_MILLIMETERS = 6 -} - -declare enum EnumDWT_UploadDataFormat { - Binary = 0, - Base64 = 1 -} - /** - * interface for a DWT container which basically defines a DIV on the page + * Interface for a WebTwain profile. */ -interface Container { - ContainerId: string; - Width: string | number; - Height: string | number; +export interface Container { + WebTwainId: string; + ContainerId?: string; + Width?: string | number; + Height?: string | number; + bNoUI?: boolean; + bLocalService?: boolean; } - -/** - * interface for a base64 result - */ -interface Base64Result { - getLength(): number; - getData(offset: number, length: number): string; - getMD5(): string; -} - -/** - * Copied from lib.d.ts (Typescript) - */ -interface Blob { - readonly size: number; - readonly type: string; - msClose(): void; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; -} - -/** - * Details for each license - */ -interface LicenseDetailItem { - readonly Browser: string; - readonly EnumLicenseType: string; - readonly ExpireDate: string; - readonly LicenseType: string; - readonly OS: string; - readonly Trial: string; - readonly Version: string; -} - -/** - * @class - */ -// properties (get/set) / sync functions -interface WebTwain { - /** - * Returns whether the instance of a DWT is initialized - * @type {boolean} - */ - bReady: boolean; - - /** - * Returns the runtime id of the dwt object - * @type {string} - */ - readonly clientId: string; - - /** - * Returns the runtime class for the dwt container DIV - * @type {string} - */ - containerClass: string; - - /*ignored - httpUrl - objectName - - ...other internal ones - */ - - /* - * Properties - */ - - /** - * Returns or sets whether multi-page selection is supported. - * @type {boolean} - */ - AllowMultiSelect: boolean; - - /** - * [Deprecated.] Returns or sets whether allowing the plugin to send authentication request. The default value of this property is TRUE. - * @type {boolean} - */ - AllowPluginAuthentication: boolean; - - /** - * [Deprecated.] Returns or sets whether the async mode is activated. With this mode, Dynamic Web TWAIN is able to upload/download files via HTTP/FTP asynchronously. The default value is false. - * @type {boolean} - */ - AsyncMode: boolean; - - /** - * Returns or sets the background color of the main control. It is a value specifying the 24-bit RGB value. - * @type {number} - */ - BackgroundColor: number; - - /** - * Returns or sets the fill color of the selected area of an image when it is cut, erased or rotated. It is a value specifying the 24-bit RGB value. - * @type {number} - */ - BackgroundFillColor: number; - - /** - * Returns or sets the pixel bit depths for the current value of PixelType property. This is a runtime property. - * @type {number} - */ - BitDepth: number; - - /** - * Returns the current deviation of the pixels in the image. - * @type {number} - */ - readonly BlankImageCurrentStdDev: number; - - /** - * Returns or sets the standard deviation of the pixels in the image. - * @type {number} - */ - BlankImageMaxStdDev: number; - - /** - * Returns or sets the dividing line between black and white. The default value is 128. - * @type {number} - */ - BlankImageThreshold: number; - - /** - * [Deprecated.] Returns or sets the border style. - * @type {EnumDWT_BorderStyle} - */ - BorderStyle: EnumDWT_BorderStyle; - - /** - * Returns or sets the brightness values available within the Source. This is a runtime property. - * @type {number} - */ - Brightness: number; - - /** - * [Deprecated.] Sets or returns whether brokerprocess is enabled for scanning. - * @type {number} - */ - BrokerProcessType: number; - - /** - * Sets or returns how much physical memory is allowed for storing images currently loaded in Dynamic Web TWAIN. Once the limit is reached, images will be cached on the hard disk. - * @type {number} - */ - BufferMemoryLimit: number; - - /** - * Sets or returns the index (0-based) of a list to indicate the Current Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property. - * @type {number} - */ - CapCurrentIndex: number; - - /** - * Sets or returns the current value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. - * @type {number} - */ - CapCurrentValue: number; - - /** - * Returns the index (0-based) of a list to indicate the Default Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime, read-only property. - * @type {number} - */ - readonly CapDefaultIndex: number; - - /** - * Returns the default value in a range when the value of the CapType property is TWON_RANGE. This is a runtime, read-only property. - * @type {number} - */ - CapDefaultValue: number; - - /** - * Retruns the description for a capability - * @type {string} - */ - CapDescription: string; - - /** - * Sets or returns the maximum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. - * @type {number} - */ - CapMaxValue: number; - - /** - * Sets or returns the minimum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. - * @type {number} - */ - CapMinValue: number; - - /** - * [Deprecated.] Sets or returns how many items are in the list when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. For String data type, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property. - * @type {number} - */ - CapNumItems: number; - - /** - * Sets or returns the step size in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. - * @type {number} - */ - CapStepSize: number; - - /** - * Sets or returns the type of capability container used to exchange capability information between application and source. This is a runtime property. - * @type {EnumDWT_CapType} - */ - CapType: EnumDWT_CapType; - - /** - * Returns or sets the value of the capability specified by Capability property when the value of the CapType property is TWON_ONEVALUE. This is a runtime property. - * @type {number} - */ - CapValue: number; - - /** - * Sets or returns the string value for a capability when the value of the CapType property is TWON_ONEVALUE. This is a runtime property. - * @type {string} - */ - CapValueString: string; - - /** - * Sets or returns the value type for reading the value of a capability. This is a runtime property. - * @type {number} - */ - CapValueType: number; - - /** - * Specifies the capabiltiy to be negotiated. This is a runtime property. - * @type {EnumDWT_Cap} - */ - Capability: EnumDWT_Cap; - - /** - * Returns or sets the contrast values available within the Source. This is a runtime property. - * @type {number} - */ - Contrast: number; - - /** - * Returns or sets current index of image in buffer. This is a runtime property. - * @type {number} - */ - CurrentImageIndexInBuffer: number; - - /** - * Returns the device name of current source. This is a runtime, read-only property. - * @type {string} - */ - readonly CurrentSourceName: string; - - /** - * Returns the value indicating the data source status. This is a runtime, read-only property. - * @type {number} - */ - readonly DataSourceStatus: number; - - /** - * Returns the device name of default source. This is a runtime, read-only property. - * @type {string} - */ - readonly DefaultSourceName: string; - - /** - * Returns whether the source supports duplex. If so, it further returns the level of duplex the Source supports (one pass or two pass duplex). This is a runtime, read-only property. - * @type {EnumDWT_DUPLEX} - */ - readonly Duplex: EnumDWT_DUPLEX; - - /** - * [Deprecated.] Returns or sets whether the user can zoom image using hot key. - * @type {boolean} - */ - EnableInteractiveZoom: boolean; - - /** - * Returns the error code. This is a runtime, read-only property. - * @type {number} - */ - readonly ErrorCode: number; - - /** - * Returns the error string. This is a runtime, read-only property. - * @type {string} - */ - readonly ErrorString: string; - - /** - * Returns or sets the password used to log into the FTP server. - * @type {string} - */ - FTPPassword: string; - - /** - * Returns or sets the port number of the FTP server. - * @type {number} - */ - FTPPort: number; - - /** - * Returns or sets the user name used to log into the FTP server. - * @type {string} - */ - FTPUserName: string; - - /** - * Returns or sets whether to resize the image to fit the image to the width or height of the window. To use the property, the view mode should be set to -1 by -1. You can use SetViewMode method to set the view mode. - * @type {EnumDWT_FitWindowType} - */ - FitWindowType: EnumDWT_FitWindowType; - - /** - * Returns the response string from the HTTP server if an error occurs for HTTPUploadThroughPost() method. This is a runtime, read-only property. - * @type {string} - */ - readonly HTTPPostResponseString: string; - - /** - * Returns whether a HTTP request has credentials - * @type {boolean} - */ - HTTPRequestswithCredentials: boolean; - - /** - * Returns or sets the height of the dwt viewer object - * @type {string|number} - */ - Height: string | number; - - /** - * Returns how many images are in buffer. This is a runtime, read-only property. - * @type {number} - */ - readonly HowManyImagesInBuffer: number; - - /** - * Specifies the content type of a http upload. - * @type {string} - */ - HttpContentTypeFieldValue: string; - - /** - * Specifies the field name of uploaded image through POST. - * @type {string} - */ - HttpFieldNameOfUploadedImage: string; - - /** - * [Deprecated.] Sets or returns the password used to log into the HTTP server. - * @type {string} - */ - HTTPPassword: string; - - /** - * Returns or sets the port number of the HTTP server. - * @type {number|string} - */ - HTTPPort: number | string; - - /** - * [Deprecated.] Returns or sets the user name used to log into the HTTP server. - * @type {string} - */ - HTTPUserName: string; - - /** - * Returns or sets whether the feature of disk caching is enabled. - * @type {boolean} - */ - IfAllowLocalCache: boolean; - - /** - * Returns or sets whether insert or append new scanned images. - * @type {boolean} - */ - IfAppendImage: boolean; - - /** - * Returns or sets whether the Source's Auto-brightness function is enabled. This is a runtime property. - * @type {boolean} - */ - IfAutoBright: boolean; - - /** - * Returns or sets whether the data source (scanner) will discard blank images during scanning. The property works only if the device and its driver support discarding blank pages. You can find whether your device supports this capbility from its user manual. Or, you can use the built-in methods of Dynamic Web TWAIN to detect blank images: IsBlankImage, IsBlankImageEx. - * @type {boolean} - */ - IfAutoDiscardBlankpages: boolean; - - /** - * Returns or sets whether the Source enable automatic document feeding process. This is a runtime property. - * @type {boolean} - */ - IfAutoFeed: boolean; - - /** - * Returns or sets whether the Source enables the automatic document scanning process. This is a runtime property. - * @type {boolean} - */ - IfAutoScan: boolean; - - /** - * Specifies whether or not to automatically scroll to the last image or stay on the current image when loading or acquiring images - * @type {boolean} - */ - IfAutoScroll: boolean; - - /** - * Turns automatic border detection on and off. The property works only if the device and its driver support detecting the border automatically. You can find whether your device supports this capbility from its user manual. - * @type {boolean} - */ - IfAutomaticBorderDetection: boolean; - - /** - * Turns automatic skew correction on and off. - * @type {boolean} - */ - IfAutomaticDeskew: boolean; - - /** - * Returns or sets whether close the Data Source User Interface after acquire all images. Default value of this property is FALSE. - * @type {boolean} - */ - IfDisableSourceAfterAcquire: boolean; - - /** - * Returns or sets whether the Source supports duplex. If TRUE, the scanner scans both sides of a paper; otherwise, the scanner will scan only one side of the image. This is a runtime property. - * @type {boolean} - */ - IfDuplexEnabled: boolean; - - /** - * Returns or sets whether the Automatic Document Feeder (ADF) is enabled. This is a runtime property. - * @type {boolean} - */ - IfFeederEnabled: boolean; - - /** - * Returns whether or not there are documents loaded in the Source's feeder when IfFeederEnabled and IfPaperDetectable are TRUE. This is a runtime, read-only property. - * @type {boolean} - */ - readonly IfFeederLoaded: boolean; - - /** - * Returns or sets whether to resize the image to fit the size of window when the view mode is set to -1 by -1. You can use SetViewMode method to set the view mode. - * @type {boolean} - */ - IfFitWindow: boolean; - - /** - * [Deprecated.] Returns or sets whether the UI (User Interface) of Source runs in modal state. Default value of this property is TRUE. - * @type {boolean} - */ - IfModalUI: boolean; - - /** - * Sets or returns whether Dynamic Web TWAIN uses Graphics Device Interface (GDI) when decoding images. - * @type {boolean} - */ - IfOpenImageWithGDIPlus: boolean; - - /** - * Returns or sets whether FTP passive mode is enabled. - * @type {boolean} - */ - IfPASVMode: boolean; - - /** - * Returns the value whether the Source has a paper sensor that can detect documents on the ADF or Flatbed. This is a runtime, read-only property. - * @type {boolean} - */ - readonly IfPaperDetectable: boolean; - - /** - * Returns or sets whether SSL is used when uploading or downloading images. - * @type {boolean} - */ - IfSSL: boolean; - - /** - * [Deprecated.] Returns or sets whether communicate with device in a separate thread. Default value of this property is FALSE. - * @type {boolean} - */ - IfScanInNewThread: boolean; - - /** - * Sets or returns whether to show the cancel dialog when uploading images to server. - * @type {boolean} - */ - IfShowCancelDialogWhenImageTransfer: boolean; - - /** - * Returns or sets whether to show the file dialog box when saving scanned images or loading images from local folder. - * @type {boolean} - */ - IfShowFileDialog: boolean; - - /** - * Returns or sets whether the Source displays a progress indicator during acquisition and transfer, regardless of whether the Source's user interface is active. This is a runtime property. - * @type {boolean} - */ - IfShowIndicator: boolean; - - /** - * [Deprecated.] Returns or sets whether the driver of the printer displays the User Interface. - * @type {boolean} - */ - IfShowPrintUI: boolean; - - /** - * Returns or sets whether the progress bar will be displayed during the transaction. This is a runtime property. - * @type {boolean} - */ - IfShowProgressBar: boolean; - - /** - * Returns or sets whether the Source displays the User Interface. - * @type {boolean} - */ - IfShowUI: boolean; - - /** - * Returns or sets whether to throw exceptions - * @type {boolean} - */ - IfThrowException: boolean; - - /** - * Return or sets whether the Source allows to save many images in one TIFF file. The default value is FALSE. - * @type {boolean} - */ - IfTiffMultiPage: boolean; - - /** - * Returns whether the Source supports acquisition with the UI (User Interface) disabled. If FALSE, indicates that this Source can only support acquisition with the UI enabled. This is a runtime, read-only property. - * @type {boolean} - */ - readonly IfUIControllable: boolean; - - /** - * Sets or returns whether Dynamic Web TWAIN uses the new TWAIN Data Source Manager (TWAINDSM.dll) when acquiring images from TWAIN devices. - * @type {boolean} - */ - IfUseTwainDSM: boolean; - - /** - * [Deprecated.] The number of bits in each image pixel (or bit depth). This is a runtime, read-only property. - * @type {number} - */ - ImageBitsPerPixel: number; - - /** - * Returns or sets whether a TWAIN driver or Native Scan of Mac OS X is used for document scanning. This property works for Mac edition only. - * @type {number} - */ - ImageCaptureDriverType: number; - - /** - * [Deprecated.] Returns or sets whether the image enumerator is enabled in Image Editor. - * @type {boolean} - */ - ImageEditorIfEnableEnumerator: boolean; - - /** - * [Deprecated.] Returns or sets whether the Image Editor is a modal window. - * @type {boolean} - */ - ImageEditorIfModal: boolean; - - /** - * [Deprecated.] Returns or sets whether the Image Editor is read-only. - * @type {boolean} - */ - ImageEditorIfReadonly: boolean; - - /** - * [Deprecated.] Returns or sets the title of Image Editor window. - * @type {string} - */ - ImageEditorWindowTitle: string; - - /** - * Returns the document number of the current image. This is a runtime, read-only property. - * @type {number} - */ - readonly ImageLayoutDocumentNumber: number; - - /** - * Returns the value of the bottom-most edge of the current image frame (in Unit). This is a read-only runtime property. - * @type {number} - */ - readonly ImageLayoutFrameBottom: number; - - /** - * Returns the value of the left-most edge of the current image frame (in Unit). This is a runtime, read-only property. - * @type {number} - */ - readonly ImageLayoutFrameLeft: number; - - /** - * Returns the frame number of the current image. This is a runtime, read-only property. - * @type {number} - */ - readonly ImageLayoutFrameNumber: number; - - /** - * Returns the value of the right-most edge of the current image frame (in Unit). This is a runtime, read-only property. - * @type {number} - */ - readonly ImageLayoutFrameRight: number; - - /** - * Returns the value of the top-most edge of the current image frame (in Unit). This is a runtime, read-only property. - * @type {number} - */ - readonly ImageLayoutFrameTop: number; - - /** - * Returns the page number of the current image. This is a runtime, read-only property. - * @type {Long} - */ - readonly ImageLayoutPageNumber: number; - - /** - * [Deprecated.] Returns how tall/long, in pixels, the image is. This is a runtime, read-only property. - * @type {number} - */ - ImageLength: number; - - /** - * Returns or sets the margin between images when multiple images are displayed in Dynamic Web TWAIN. - * @type {number} - */ - ImageMargin: number; - - /** - * Returns the pixel type of the current image. This is a runtime, read-only property. Please note the property is only valid in OnPreTransfer and OnPostTransfer event. - * @type {EnumDWT_PixelType} - */ - readonly ImagePixelType: EnumDWT_PixelType; - - /** - * [Deprecated.] Returns how width, in pixels, the image is. This is a runtime, read-only property. - * @type {number} - */ - ImageWidth: number; - - /** - * [Deprecated.] Returns the X resolution of the current image. X resolution is the number of pixels per Unit in the horizontal direction. This is a runtime, read-only property. - * @type {number} - */ - ImageXResolution: number; - - /** - * [Deprecated.] Returns the Y resolution of the current image. Y resolution is the number of pixels per Unit in the vertical direction. This is a runtime, read-only property. - * @type {number} - */ - ImageYResolution: number; - - /** - * Returns or sets the quality of JPEG files and PDF files using JPEG compression. - * @type {number} - */ - JPEGQuality: number; - - /** - * Returns or sets the log level for debugging. - * @type {number} - */ - LogLevel: number; - - /** - * Return the magnetic data if the scanner support magnetic data recognition. - * @type {string} - */ - readonly MagData: string; - - /** - * Return the magnetic type if the scanner support magnetic data recognition. - * @type {number} - */ - readonly MagType: number; - - /** - * Sets or returns the manufacture string for the application identity. - * @type {string} - */ - Manufacturer: string; - - /** - * Returns or sets the maximum number of images can be held in buffer. - * @type {number} - */ - MaxImagesInBuffer: number; - - /** - * [Deprecated.] Returns or sets how many threads can be used when you upload files through POST. - * @type {number} - */ - MaxInternetTransferThreads: number; - - /** - * Sets or returns the maximum allowed size when Dynamic Web TWAIN uploads a document. - * @type {number} - */ - MaxUploadImageSize: number; - - /** - * Returns or sets the shape of the mouse. - * @type {boolean} - */ - MouseShape: boolean; - - /** - * Returns the X co-ordinate of the mouse. This is a runtime property. - * @type {number} - */ - readonly MouseX: number; - - /** - * Returns the Y co-ordinate of the mouse. This is a runtime property. - * @type {number} - */ - readonly MouseY: number; - - /** - * Returns or sets the name of the person who creates the PDF document. - * @type {string} - */ - PDFAuthor: string; - - /** - * Returns or sets the compression type of PDF files. This is a runtime property. - * @type {EnumDWT_PDFCompressionType} - */ - PDFCompressionType: EnumDWT_PDFCompressionType; - - /** - * Returns or sets the date when the PDF document is created. - * @type {string} - */ - PDFCreationDate: string; - - /** - * Returns or sets the name of the application that created the original document, if the PDF document is converted from another form. - * @type {string} - */ - PDFCreator: string; - - /** - * Returns or sets the keywords associated with the PDF document. - * @type {string} - */ - PDFKeywords: string; - - /** - * Returns or sets the date when the PDF document is last modified. - * @type {string} - */ - PDFModifiedDate: string; - - /** - * Returns or sets the name of the application that converted the PDF document from its native. - * @type {string} - */ - PDFProducer: string; - - /** - * Returns or sets the subject of the PDF document. - * @type {string} - */ - PDFSubject: string; - - /** - * Returns or sets the title of the PDF document. - * @type {string} - */ - PDFTitle: string; - - /** - * Returns or sets the value of the PDF version. - * @type {string} - */ - PDFVersion: string; - - /** - * Returns or sets the page size(s) the Source can/should use to acquire image data. This is a runtime property. - * @type {EnumDWT_CapSupportedSizes} - */ - PageSize: EnumDWT_CapSupportedSizes; - - /** - * Returns the number of transfers the Source is ready to supply, upon demand. This is a runtime, read-only property. - * @type {number} - */ - readonly PendingXfers: number; - - /** - * Returns or sets the pixel flavor for acquired images. This is a runtime property. - * @type {number} - */ - PixelFlavor: number; - - /** - * Returns or sets the pixel type of current data source. This is a runtime property. Using this property after calling OpenSource() method and before calling AcquireImage(). - * @type {EnumDWT_PixelType} - */ - PixelType: EnumDWT_PixelType; - - /** - * Sets or returns the product family string for the application identity. - * @type {string} - */ - ProductFamily: string; - - /** - * Sets the product key. A product key is generated in Licensing Tool which is intalled with Dynamic Web TWAIN. Each product key corresponds with a license. - * @type {string} - */ - ProductKey: string; - - /** - * Sets or returns the product name string for the application identity. - * @type {string} - */ - ProductName: string; - - /** - * [Deprecated.] Returns or sets the name of the proxy server. - * @type {string} - */ - ProxyServer: string; - - /** - * Returns or sets the current resolution for acquired images. This is a runtime property. - * @type {number} - */ - Resolution: number; - - /** - * Returns or sets how many scanned images are selected. - * @type {number} - */ - SelectedImagesCount: number; - - /** - * Returns or sets the border color of the selected image. It is a value specifying the 24-bit RGB value. - * @type {number} - */ - SelectionImageBorderColor: number; - - /** - * Specifies a fixed aspect ratio to be used for selecting an area. - * @type {number} - */ - SelectionRectAspectRatio: number; - - /** - * Specifies whether to show the page number - * @type {boolean} - */ - ShowPageNumber: boolean; - - /** - * Returns how many sources are installed in the system. This is a runtime, read-only property. - * @type {number} - */ - readonly SourceCount: number; - - /** - * Returns or sets the compression type of TIFF files. This is a runtime property. - * @type {EnumDWT_TIFFCompressionType} - */ - TIFFCompressionType: EnumDWT_TIFFCompressionType; - - /** - * Sets or returns the transfer mode. - * @type {EnumDWT_TransferMode} - */ - TransferMode: EnumDWT_TransferMode; - - /** - * Returns or sets the unit of measure. This is a runtime property. - * @type {EnumDWT_UnitType} - */ - Unit: EnumDWT_UnitType; - - /** - * Specifies whether to show the vertical scroll bar - * @type {boolean} - */ - VScrollBar: boolean; - - /** - * Sets or returns the version info string for the application identity. - * @type {string} - */ - readonly VersionInfo: string; - - /** - * Returns or sets the width of the dwt object viewer - * @type {string|number} - */ - Width: string | number; - - /** - * Returns and sets the number of images you are willing to transfer per session. This is a runtime property. - * @type {number} - */ - XferCount: number; - - /** - * Returns or sets zoom factor for the image, only valid When the view mode is set to -1 by -1. - * @type {number} - */ - Zoom: number; - - /* ignored - style - _AutoCropMethod - */ - - /* - *Methods - */ - - /** - * Displays the source's built-in interface to acquire image. - * @method WebTwain#AcquireImage - * @param {object} optionalDeviceConfig a JS object used to set up the device for image acquisition. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - AcquireImage(optionalDeviceConfig?: object, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Add text on an image. - * @method WebTwain#AddText - * @param {number} sImageIndex the index of the image that you want to add text to. - * @param {number} x the x coordinate for the text. - * @param {number} y the y coordinate for the text. - * @param {string} text the content of the text that you want to add. - * @param {number} txtColor the color for the text. - * @param {number} backgroundColor the background color. - * @param {number} backgroundRoundRadius ranging from 0 to 0.5. Please NOTE that MAC version does not support this parameter. - * @param {number} backgroundOpacity specifies the opacity of the background of the added text, it ranges from 0 to 1.0. Please NOTE that Mac version only supports value 0 and 1 - * @return {boolean} - */ - AddText(sImageIndex: number, x: number, y: number, text: string, txtColor: number, backgroundColor: number, backgroundRoundRadius: number, backgroundOpacity: number): boolean; - - /** - * Cancels all pending transfers. - * @method WebTwain#CancelAllPendingTransfers - * @return {boolean} - */ - CancelAllPendingTransfers(): boolean; - - /** - * Gets information of the capability specified by the Capability property. - * @method WebTwain#CapGet - * @return {boolean} - */ - CapGet(): boolean; - - /** - * Returns the Source's current Value for the specified capability. - * @method WebTwain#CapGetCurrent - * @return {boolean} - */ - CapGetCurrent(): boolean; - - /** - * Returns the Source's Default Value for the specified capability. This is the Source's preferred default value. - * @method WebTwain#CapGetDefault - * @return {boolean} - */ - CapGetDefault(): boolean; - - /** - * Returns the value of the bottom-most edge of the specified frame. - * @method WebTwain#CapGetFrameBottom - * @param {number} index specifies the value of which frame to get. The index is 0-based. - * @return {number} - */ - CapGetFrameBottom(index: number): number; - - /** - * Returns the value (in Unit) of the left-most edge of the specified frame. - * @method WebTwain#CapGetFrameLeft - * @param {number} index specifies the value of which frame to get. The index is 0-based. - * @return {number} - */ - CapGetFrameLeft(index: number): number; - - /** - * Returns the value (in Unit) of the left-most edge of the specified frame. - * @method WebTwain#CapGetFrameRight - * @param {number} index specifies the value of which frame to get. The index is 0-based. - * @return {number} - */ - CapGetFrameRight(index: number): number; - - /** - * Returns the value (in Unit) of the top-most edge of the specified frame. - * @method WebTwain#CapGetFrameTop - * @param {number} index specifies the value of which frame to get. The index is 0-based. - * @return {number} - */ - CapGetFrameTop(index: number): number; - - /* ignored - * CapGetHelp - * CapGetLabel - * CapGetLabels - */ - - /** - * Queries whether the Source supports a particular operation on the capability. - * @method WebTwain#CapIfSupported - * @param {EnumDWT_MessageType} messageType specifies the type of capability operation. - * @return {boolean} - */ - CapIfSupported(messageType: EnumDWT_MessageType): boolean; - - /** - * Changes the Current Value of the capability specified by Capability property back to its power-on value. - * @method WebTwain#CapReset - * @return {boolean} - */ - CapReset(): boolean; - - /** - * Sets the current capability using the container type specified by CapType property. The current capability is specified by Capability property. - * @method WebTwain#CapSet - * @return {boolean} - */ - CapSet(): boolean; - - /** - * Sets the values of the specified frame. - * @method WebTwain#CapSetFrame - * @param {number} index specifies the values of which frame to set. The index is 0-based. - * @param {number} left the value (in Unit) of the left-most edge of the specified frame. - * @param {number} top the value (in Unit) of the top-most edge of the specified frame. - * @param {number} right the value (in Unit) of the right-most edge of the specified frame. - * @param {number} bottom the value (in Unit) of the bottom-most edge of the specified frame. - * @return {boolean} - */ - CapSetFrame(index: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Changes the bitdepth of a specified image. - * @method WebTwain#ChangeBitDepth - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} sBitDepth specifies the target bit depth. - * @param {boolean} bHighQuality specifies whether or not to keep high quality while changing the bit depth. When it's true, it takes more time. - * @return {boolean} - */ - ChangeBitDepth(sImageIndex: number, sBitDepth: number, bHighQuality: boolean): boolean; - - /** - * Changes width and height of the image of a specified index in the buffer. Please note the file size of the image will be changed proportionately. - * @method WebTwain#ChangeImageSize - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} iNewWidth specifies the pixel width of the new image. - * @param {number} iNewHeight specifies the pixel height of the new image. - * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. - * @return {boolean} - */ - ChangeImageSize(sImageIndex: number, iNewWidth: number, iNewHeight: number, newVal: EnumDWT_InterpolationMethod): boolean; - - /** - * Clears all the web forms which are used for image uploading. - * @method WebTwain#ClearAllHTTPFormField - * @return {boolean} - */ - ClearAllHTTPFormField(): boolean; - - /** - * Clears the content of all custom tiff tags. - * @method WebTwain#ClearTiffCustomTag - * @return {void} - */ - ClearTiffCustomTag(): void; - - /** - * Closes Data Source. - * @method WebTwain#CloseSource - * @return {boolean} - */ - CloseSource(): boolean; - - /** - * Closes and unloads Data Source Manager. - * @method WebTwain#CloseSourceManager - * @return {boolean} - */ - CloseSourceManager(): boolean; - - /** - * Closes the current process used to scan - * @method WebTwain#CloseWorkingProcess - * @return {boolean} - */ - CloseWorkingProcess(): boolean; - - /** - * Converts the images specified by the indices to base64 synchronously. - * @method WebTwain#ConvertToBase64 - * @param {Array} indices indices specifies which images are to be converted to base64. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. - * @return {Base64Result} - - ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType): Base64Result; - */ - - /** - * Converts the images specified by the indices to base64 asynchronously. - * @method WebTwain#ConvertToBase64 - * @param {Array} indices indices specifies which images are to be converted to base64. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType, asyncSuccessFunc: (result: Base64Result) => void, asyncFailureFunc: (errorCode: number, errorString: string) => void): boolean; - - /** - * Converts the images specified by the indices to blob synchronously. - * @method WebTwain#ConvertToBlob - * @param {Array} indices indices specifies which images are to be converted to base64. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. - * @return {Blob} - */ - ConvertToBlob(indices: number[], enumImageType: EnumDWT_ImageType): Blob; - - /** - * Converts the images specified by the indices to blob asynchronously. - * @method WebTwain#ConvertToBlob - * @param {Array} indices indices specifies which images are to be converted to base64. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - ConvertToBlob(indices: number[], enumImageType: EnumDWT_ImageType, asyncSuccessFunc: (result: any) => void, asyncFailureFunc: (errorCode: number, errorString: string) => void): boolean; - - /** - * Changes a specified image to gray scale. - * @method WebTwain#ConvertToGrayScale - * @param {number} sIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - ConvertToGrayScale(sIndex: number): boolean; - - /** - * Copies the image of a specified index in buffer to clipboard in DIB format. - * @method WebTwain#CopyToClipboard - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - CopyToClipboard(sImageIndex: number): boolean; - - /** - * Create the font for adding text using the method AddText. - * @method WebTwain#CreateTextFont - * @param {number} height Specifies the desired height (in logical units) of the font.The absolute value of nHeight must not exceed 16,384 device units after it is converted.For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size or the smallest font if all the fonts exceed the requested size. - * @param {number} width Specifies the average width (in logical units) of characters in the font. If Width is 0, the aspect ratio of the device will be matched against the digitization aspect ratio of the available fonts to find the closest match, which is determined by the absolute value of the difference. - * @param {number} escapement Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of the display surface. The escapement vector is the line through the origins of the first and last characters on a line. The angle is measured counterclockwise from the x-axis. - * @param {number} orientation Specifies the angle (in 0.1-degree units) between the baseline of a character and the x-axis.The angle is measured counterclockwise from the x-axis for coordinate systems in which the y-direction is down and clockwise from the x-axis for coordinate systems in which the y-direction is up. - * @param {number} weight Specifies the font weight (in inked pixels per 1000). The described valuesare approximate; the actual appearance depends on the typeface. Some fonts haveonly FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used. - * @param {number} italic Specifies an italic font if set to TRUE. - * @param {number} underline Specifies an underlined font if set to TRUE. - * @param {number} strikeOut A strikeout font if set to TRUE. - * @param {number} charSet Specifies the font's character set. The OEM character set is system-dependent. Fonts with other character sets may exist in the system. An application that uses a font with an unknown character set must not attempt to translate or interpret strings that are to be rendered with that font. - * @param {number} outputPrecision Specifies the desired output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, and pitch. - * @param {number} clipPrecision Specifies the desired clipping precision. The clipping precision defines how to clip characters that are partially outside the clipping region. - * @param {number} quality Specifies the font's output quality, which defines how carefully the GDI must attempt to match the logical-font attributes to those of an actual physical font. - * @param {number} pitchAndFamily The pitch and family of the font. - * @param {string} faceName the typeface name, the length of this string must not exceed 32 characters, including the terminating null character. - * @return {boolean} - */ - CreateTextFont(height: number, width: number, escapement: number, orientation: number, weight: number, italic: number, underline: number, strikeOut: number, charSet: number, outputPrecision: number, clipPrecision: number, quality: number, pitchAndFamily: number, faceName: string): boolean; - - /** - * Crops the image of a specified index in buffer. - * @method WebTwain#Crop - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @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. - * @return {boolean} - */ - Crop(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Crops the image of a specified index in buffer to clipboard in DIB format. - * @method WebTwain#CropToClipboard - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @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. - * @return {boolean} - */ - CropToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Cuts the image data in the specified area to the system clipboard in DIB format. - * @method WebTwain#CutFrameToClipboard - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @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. - * @return {boolean} - */ - CutFrameToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Cuts the image of a specified index in buffer to clipboard in DIB format. - * @method WebTwain#CutToClipboard - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - CutToClipboard(sImageIndex: number): boolean; - - /** - * Disable the source. If the source's user interface is displayed when the source is enabled, it will be closed. - * @method WebTwain#DisableSource - * @return {boolean} - */ - DisableSource(): boolean; - - /** - * Enables the source to accept image. - * @method WebTwain#EnableSource - * @return {boolean} - */ - EnableSource(): boolean; - - /** - * Clears the specified area of a specified image, and fill the area with the fill color. - * @method WebTwain#Erase - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @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. - * @return {boolean} - */ - Erase(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * Downloads an image from the FTP server. - * @method WebTwain#FTPDownload - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. - * @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} - */ - FTPDownload(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Downloads an image from the FTP server. - * @method WebTwain#FTPDownloadEx - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. - * @param {EnumDWT_ImageType} lImageType simage format of the file to be downloaded. - * @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} - */ - FTPDownloadEx(FTPServer: string, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads the image of a specified index in the buffer to the FTP server. - * @method WebTwain#FTPUpload - * @param {string} FTPServer the name of the FTP server. - * @param {number} sImageIndex specifies the index of the image in the buffer. The index is 0-based. - * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUpload(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads the image of a specified index in the buffer to the FTP server as a specified image format. - * @method WebTwain#FTPUploadEx - * @param {string} FTPServer the name of the FTP server. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. - * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUploadEx(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads all images in buffer to the FTP server as Multi-Page TIFF. - * @method WebTwain#FTPUploadAllAsMultiPageTIFF - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUploadAllAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads all images in buffer to the FTP server as Multi-Page PDF. - * @method WebTwain#FTPUploadAllAsPDF - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUploadAllAsPDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads the selected images in buffer to the FTP server as Multi-Page PDF. - * @method WebTwain#FTPUploadAsMultiPagePDF - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUploadAsMultiPagePDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Uploads the selected images in buffer to the FTP server as Multi-Page TIFF. - * @method WebTwain#FTPUploadAsMultiPageTIFF - * @param {string} FTPServer the name of the FTP server. - * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - FTPUploadAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Sets the Source to eject the current page and advance the next page in the document feeder into the feeder acquire area when IfFeederEnabled is TRUE. - * @method WebTwain#FeedPage - * @return {boolean} - */ - FeedPage(): boolean; - - /** - * Flips the image of a specified index in buffer. - * @method WebTwain#Flip - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - Flip(sImageIndex: number): boolean; - - /** - * Get the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. - * @method WebTwain#GetCapItems - * @param {number} index Index is 0-based. It is the index of the cap item. - * @return {number} - */ - GetCapItems(index: number): number; - - /** - * Returns the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. - * @method WebTwain#GetCapItemsString - * @param {number} index Index is 0-based. It is the index of the cap item. - * @return {string} - */ - GetCapItemsString(index: number): string; - - // Get custom DS data, and returned string is encoded with base64 - /** - * Gets custom DS data, the returned string is base64 encoded. - * @method WebTwain#GetCustomDSDataEx - * @return {string | boolean} - */ - GetCustomDSDataEx(): string | boolean; - - // Get custom DS data, and save the data to the specified file - /** - * Gets custom DS data and save the data in a specified file. - * @method WebTwain#GetCustomDSData - * @param {string} fileName the path of the file used for storing custom DS data. - * @return {boolean} - */ - GetCustomDSData(fileName: string): boolean; - - /** - * Retrieve the device type of the currently selected data source, it might be a scanner, a web camera, etc. - * @method WebTwain#GetDeviceType - * @return {number | boolean} - */ - GetDeviceType(): number | boolean; - - /** - * Returns the pixel bit depth of the selected image. - * @method WebTwain#GetImageBitDepth - * @param {number} sImageIndex specifies the index of image. The index is 0-based. - * @return {number} - */ - GetImageBitDepth(sImageIndex: number): number; - - /** - * Returns the height (pixels) of the selected image. This is a read-only property. - * @method WebTwain#GetImageHeight - * @param {number} sImageIndex specifies the index of image. The index is 0-based. - * @return {number} - */ - GetImageHeight(sImageIndex: number): number; - - /** - * Returns the direct URL of an image specified by index, if iWidth and iHeight are not specified, you get the original image, otherwise you get the image with specified iWidth or iHeight while keeping the same aspect ratio. The returned string is like this 'dwt://dwt_trial_13000404/img?id=306159652&index=0&t=1502184632022' - * @method WebTwain#GetImagePartURL - * @param {number} index the index of the image. - * @param {number} iWidth the width of the image, it must be 150 or bigger - * @param {number} iHeight the height of the image, it must be 150 or bigger - * @return {string} - */ - GetImagePartURL(index: number, iWidth?: number, iHeight?: number): string; - - /** - * Returns the file size of the new image resized from the image of a specified index in buffer. - * @method WebTwain#GetImageSize - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} iWidth specifies the pixel width of the new image. - * @param {number} iHeight specifies the pixel height of the new image. - * @return {number} - */ - GetImageSize(sImageIndex: number, iWidth: number, iHeight: number): number; - - /** - * Pre-calculate the file size of the local image file that is saved from an image of a specified index in buffer. - * @method WebTwain#GetImageSizeWithSpecifiedType - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {EnumDWT_ImageType} sImageType specifies the type of an image file.. - * @return {number} - */ - GetImageSizeWithSpecifiedType(sImageIndex: number, sImageType: EnumDWT_ImageType): number; - - /** - * Returns the direct URL of an image specified by index, if iWidth or iHeight is set to -1, you get the original image, otherwise you get the image with specified iWidth or iHeight while keeping the same aspect ratio. - * @method WebTwain#GetImageURL - * @param {number} index the index of the image. - * @param {number} iWidth the width of the image. - * @param {number} iHeight the height of the image. - * @return {string} - */ - GetImageURL(index: number, iWidth?: number, iHeight?: number): string; - - /** - * Returns the width (pixels) of the selected image. This is a read-only property. - * @method WebTwain#GetImageWidth - * @param {number} sImageIndex specifies the index of image. The index is 0-based. - * @return {number} - */ - GetImageWidth(sImageIndex: number): number; - - /** - * Return the horizontal resolution of the specified image. - * @method WebTwain#GetImageXResolution - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {number} - */ - GetImageXResolution(sImageIndex: number): number; - - /** - * Return the vertical resolution of the specified image. - * @method WebTwain#GetImageYResolution - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {number} - */ - GetImageYResolution(sImageIndex: number): number; - - /** - * Return the runtime license info. - * @method WebTwain#GetLicenseInfo - */ - GetLicenseInfo(): { Domain: string, Detail: LicenseDetailItem[] }; - - /** - * Returns the index of the selected image. - * @method WebTwain#GetSelectedImageIndex - * @param {number} sSelectedIndex specifies the index of the selected image. - * @return {number} - */ - GetSelectedImageIndex(sSelectedIndex: number): number; - - /** - * Pre-calculate the file size of the local image file that is saved from the selected images in buffer. - * @method WebTwain#GetSelectedImagesSize - * @param {EnumDWT_ImageType} iImageType specifies the type of an image file. - * @return {number} - */ - GetSelectedImagesSize(iImageType: EnumDWT_ImageType): number; - - /** - * Check the skew angle of an image by its index in buffer. - * @method WebTwain#GetSkewAngle - * @param {number} sImageIndex the index of the image in the buffer. - * @return {number} - */ - GetSkewAngle(sImageIndex: number): number; - - /** - * Check the skew angle of a rectangular part of an image by its index in buffer. - * @method WebTwain#GetSkewAngleEx - * @param {number} sImageIndex the index of the image in the buffer. - * @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. - * @return {number} - */ - GetSkewAngleEx(sImageIndex: number, left: number, top: number, right: number, bottom: number): number; - - /** - * Get the source name according to the source index. - * @method WebTwain#GetSourceNameItems - * @param {number} index number index. Index is 0-based and can not be greater than SourceCount property. - * @return {string} - */ - GetSourceNameItems(index: number): string; - - /*ignored - GetSourceNames - GetSourceType - GetVersionInfoAsync - */ - - /** - * Downloads an image from the HTTP server. - * @method WebTwain#HTTPDownload - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} HTTPRemoteFile the name of the image to be downloaded. It should be the relative path of the file on the HTTP server. - * @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} - */ - HTTPDownload(HTTPServer: string, HTTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Directly downloads a file from the HTTP server to a local disk without loading it into Dynamic Web TWAIN. - * @method WebTwain#HTTPDownloadDirectly - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} HTTPRemoteFile The relative path of the file on the HTTP server. - * @param {string} localFile specify the location to store the downloaded file. - * @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} - */ - HTTPDownloadDirectly(HTTPServer: string, HTTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Downloads an image from the HTTP server. - * @method WebTwain#HTTPDownloadEx - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) - * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. - * @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} - */ - HTTPDownloadEx(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /*ignored - HTTPDownloadStreamThroughPost - HTTPDownloadThroughGet - */ - - /** - * Download an image from the server using a HTTP Post call. - * @method WebTwain#HTTPDownloadThroughPost - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) - * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. - * @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} - */ - HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads just a form created by SetHTTPFormField and SetHTTPHeader - * @method WebTwain#HTTPUpload - * @param {string} url the url where the images are sent in a POST request. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUpload(url: string, asyncSuccessFunc: (httppostresponsestring: string) => void, asyncFailureFunc: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads the images specified by the indices to the HTTP server. - * @method WebTwain#HTTPUpload - * @param {string} url the url where the images are sent in a POST request. - * @param {Array} indices indices specifies which images are to be uploaded. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded. - * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUpload(url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, asyncSuccessFunc: (httppostresponsestring: string) => void, asyncFailureFunc: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads the images specified by the indices to the HTTP server. - * @method WebTwain#HTTPUpload - * @param {string} url the url where the images are sent in a POST request. - * @param {Array} indices indices specifies which images are to be uploaded. - * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded. - * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string. - * @param {string} fileName the name of the image to be uploaded. - * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. - */ - HTTPUpload(url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, fileName: string, asyncSuccessFunc: (httpPostResponseString: string) => void, asyncFailureFunc: (errorCode: number, errorString: string, httpPostResponseString: string) => void): boolean; - - /** - * Uploads all images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. - * @method WebTwain#HTTPUploadAllThroughPostAsMultiPageTIFF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads all images in the buffer to the HTTP server through HTTP Post method as a Multi-Page PDF. - * @method WebTwain#HTTPUploadAllThroughPostAsPDF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. - * @method WebTwain#HTTPUploadAllThroughPutAsMultiPageTIFF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} RemoteFileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadAllThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. - * @method WebTwain#HTTPUploadAllThroughPutAsPDF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} RemoteFileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadAllThroughPutAsPDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /*ignored - HTTPUploadStreamThroughPost - */ - - /** - * Uploads the image of a specified index in the buffer to the HTTP server through the HTTP POST method. - * @method WebTwain#HTTPUploadThroughPost - * @param {string} HTTPServer the name of the HTTP server. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. - * @method WebTwain#HTTPUploadThroughPostAsMultiPageTIFF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page PDF. - * @method WebTwain#HTTPUploadThroughPostAsMultiPagePDF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Directly upload a specific local file to the HTTP server through the HTTP POST method without loading it into Dynamic Web TWAIN. - * @method WebTwain#HTTPUploadThroughPostDirectly - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} localFile specifies the path of a local file . - * @param {string} ActionPage the specified page for posting files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the file to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP POST method. - * @method WebTwain#HTTPUploadThroughPostEx - * @param {string} HTTPServer the name of the HTTP server. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". - * @param {string} fileName the name of the image to be uploaded. - * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.s - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadFailure. - * @return {boolean} - */ - HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string, httppostresponsestring: string) => void): boolean; - - /** - * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server through the HTTP PUT method. - * @method WebTwain#HTTPUploadThroughPut - * @param {string} HTTPServer the name of the HTTP server. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} RemoteFileName the name of the image to be created on the HTTP server. It should a relative path on the web server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadThroughPut(HTTPServer: string, sImageIndex: number, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. - * @method WebTwain#HTTPUploadThroughPutAsMultiPageTIFF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} RemoteFileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. - * @method WebTwain#HTTPUploadThroughPutAsMultiPagePDF - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} RemoteFileName the name of the image to be uploaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadThroughPutAsMultiPagePDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Directly uploads a specific local file to the HTTP server through the HTTP PUT method without loading it into Dynamic Web TWAIN. - * @method WebTwain#HTTPUploadThroughPutDirectly - * @param {string} HTTPServer the name of the HTTP server. - * @param {string} localFile specifies the path of a local file. - * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadThroughPutDirectly(HTTPServer: string, localFile: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP PUT method. - * @method WebTwain#HTTPUploadThroughPutEx - * @param {string} HTTPServer the name of the HTTP server. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. - * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - HTTPUploadThroughPutEx(HTTPServer: string, sImageIndex: number, RemoteFileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Converts the image ID of an image to its index. - * [Version] Added in v15.0 - * @method WebTwain#ImageIDToIndex - * @param {number} sImageID specifies the imageID. - * @return {number} - */ - ImageIDToIndex(sImageID: number): number; - - /** - * Converts the index of an image to its image ID. - * [Version] Added in v15.0 - * @method WebTwain#IndexToImageID - * @param {number} sImageIndex specifies the index. - * @return {number} - */ - IndexToImageID(sImageIndex: number): number; - - /** - * [Deprecated.] Detects whether an image is blank. - * @method WebTwain#IsBlankImage - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - IsBlankImage(sImageIndex: number): boolean; - - /** - * [Deprecated.] Detects whether a certain area on an image is blank. - * @method WebTwain#IsBlankImageEx - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @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 {boolean} bFuzzyMatch specifies whether use fuzzy matching when detecting. - * @return {boolean} - */ - IsBlankImageEx(sImageIndex: number, left: number, top: number, right: number, bottom: number, bFuzzyMatch: boolean): boolean; - - /** - * Detects whether a specific image is blank. - * @method WebTwain#IsBlankImageExpress - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - IsBlankImageExpress(sImageIndex: number): boolean; - - /** - * Loads a DIB format image from Clipboard into the Dynamic Web TWAIN. - * @method WebTwain#LoadDibFromClipboard - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - LoadDibFromClipboard(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Loads an image into the Dynamic Web TWAIN. - * @method WebTwain#LoadImage - * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - LoadImage(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Loads an image into the Dynamic Web TWAIN. - * @method WebTwain#LoadImageEx - * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. - * @param {EnumDWT_ImageType} lImageType the image format of the file to be loaded. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - LoadImageEx(localFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Loads image from a base64 byte array with the specified file format. - * @method WebTwain#LoadImageFromBase64Binary - * @param {string} bry specifies the base64 string data. - * @param {EnumDWT_ImageType} lImageType specifies the file format. - * @return {boolean} - */ - LoadImageFromBase64Binary(bry: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * [Deprecated.] Loads image from a byte array with the specified file format. - * @method WebTwain#LoadImageFromBytes - * @param {number} lBufferSize Specifies the buffer size. - * @param {Array} buffer A byte array of the image data. - * @param {EnumDWT_ImageType} lImageType Specifies the file format. - * @return {boolean} - */ - LoadImageFromBytes(lBufferSize: number, buffer: number[], lImageType: EnumDWT_ImageType): boolean; - - /** - * Mirrors the image of a specified index in buffer. - * @method WebTwain#Mirror - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - Mirror(sImageIndex: number): boolean; - - /** - * Moves a specified image. - * @method WebTwain#MoveImage - * @param {number} sSourceImageIndex Specifies the source index of image in buffer. The index is 0-based. - * @param {number} sTargetImageIndex Specifies the target index of image in buffer. The index is 0-based. - * @return {boolean} - */ - MoveImage(sSourceImageIndex: number, sTargetImageIndex: number): boolean; - - /*ignored - OnRefreshUI - */ - - /** - * Loads the specified Source into main memory and causes its initialization, - * placing Dynamic Web TWAIN into Capability Negotiation state. If no source is - * specified (no SelectSource() or SelectSourceByIndex() is called), opens the default source. - * @method WebTwain#OpenSource - * @return {boolean} - */ - OpenSource(): boolean; - - /** - * Loads and opens Data Source Manager. - * @method WebTwain#OpenSourceManager - * @return {boolean} - */ - OpenSourceManager(): boolean; - - /** - * Decorates image of a specified index in buffer with rectangles of transparent color. - * @method WebTwain#OverlayRectangle - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @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 {number} color Specifies the fill color of the rectangle. The byte-ordering of the RGB value is 0xBBGGRR. BB represents blue, GG represents green, RR represents red. - * @param {number} fOpacity Specifies the opacity of the rectangle. The value represents opacity. 1.0 is 100% opaque and 0.0 is totally transparent. - * @return {boolean} - */ - OverlayRectangle(sImageIndex: number, left: number, top: number, right: number, bottom: number, color: number, fOpacity: number): boolean; - - /** - * Shows the GUI of Image Printer. - * @method WebTwain#Print - * @param {boolean} bUseSystemDefaultPrintUI specifies whether to use the system Print UI or not. - * @return {boolean} - */ - Print(bUseSystemDefaultPrintUI: boolean): boolean; - - /** - * Binds a specified function to an event, so that the function gets called whenever the event fires. - * @method WebTwain#RegisterEvent - * @param {string} name the name of the event that the function is bound to. - * @param {any} evt specifies the function to call when event fires. - * @return {boolean} - */ - RegisterEvent(name: string, evt: any): boolean; - - /** - * Removes all images in buffer. - * @method WebTwain#RemoveAllImages - * @return {boolean} - */ - RemoveAllImages(): boolean; - - /** - * Removes selected images in buffer. - * @method WebTwain#RemoveAllSelectedImages - * @return {boolean} - */ - RemoveAllSelectedImages(): boolean; - - /** - * Removes the image of a specified index in buffer. - * @method WebTwain#RemoveImage - * @param {number} sImageIndexToBeDeleted specifies the index of the image to be deleted in buffer. The index is 0-based. - * @return {boolean} - */ - RemoveImage(sImageIndexToBeDeleted: number): boolean; - - /** - * Reverts the current image layout to the Data Source's default. - * @method WebTwain#ResetImageLayout - * @return {boolean} - */ - ResetImageLayout(): boolean; - - /** - * Sets the Source to return the current page to the input side of the document feeder and - * feed the last page from the outside of the feeder back into the acquisition area if IfFeederEnabled is TRUE. - * @method WebTwain#RewindPage - * @return {boolean} - */ - RewindPage(): boolean; - - /** - * Rotates the image of a specified index in buffer by specified angle. - * @method WebTwain#Rotate - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} fAngle Specifies the rotation angle. - * @param {boolean} bKeepSize Keep size or not. - * @return {boolean} - */ - Rotate(sImageIndex: number, fAngle: number, bKeepSize: boolean): boolean; - - /** - * Rotates the image of a specified index in buffer by specified angle. - * @method WebTwain#RotateEx - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} fAngle Specifies the rotation angle. - * @param {boolean} bKeepSize Keep size or not. - * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. - * @return {boolean} - */ - RotateEx(sImageIndex: number, fAngle: number, bKeepSize: boolean, newVal: EnumDWT_InterpolationMethod): boolean; - - /** - * Rotates the image of a specified index in buffer by 90 degrees counter-clockwise. - * @method WebTwain#RotateLeft - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - RotateLeft(sImageIndex: number): boolean; - - /** - * Rotates the image of a specified index in buffer by 90 degrees clockwise. - * @method WebTwain#RotateRight - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - RotateRight(sImageIndex: number): boolean; - - /** - * Saves all images in buffer as a MultiPage TIFF file. - * @method WebTwain#SaveAllAsMultiPageTIFF - * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - SaveAllAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves all images in buffer as a Multi-Page PDF file. - * @method WebTwain#SaveAllAsPDF - * @param {string} localFile the name of the Multi-Page PDF file to be saved. It should be an absolute path on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - SaveAllAsPDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the image of a specified index in buffer as a BMP file. - * @method WebTwain#SaveAsBMP - * @param {string} localFile the name of the BMP file to be saved. It should be an absolute path on the local disk. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - SaveAsBMP(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /*ignored - SaveAsGIF - */ - - /** - * Saves the image of a specified index in buffer as a JPEG file. - * @method WebTwain#SaveAsJPEG - * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - SaveAsJPEG(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the image of a specified index in buffer as a PDF file. - * @method WebTwain#SaveAsPDF - * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - SaveAsPDF(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the image of a specified index in buffer as a PNG file. - * @method WebTwain#SaveAsPNG - * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - SaveAsPNG(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the image of a specified index in buffer as a TIFF file. - * @method WebTwain#SaveAsTIFF - * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - SaveAsTIFF(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the selected images in buffer as a Multipage PDF file. - * @method WebTwain#SaveSelectedImagesAsMultiPagePDF - * @param {string} localFile the name of the MultiPage PDF file to be saved. It should be an absolute path on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - SaveSelectedImagesAsMultiPagePDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the selected images in buffer as a Multipage TIFF file. - * @method WebTwain#SaveSelectedImagesAsMultiPageTIFF - * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. - * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. - * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. - * @return {boolean} - */ - SaveSelectedImagesAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - - /** - * Saves the selected images in buffer to base64 string. - * @method WebTwain#SaveSelectedImagesToBase64Binary - * @return {string|boolean} - */ - SaveSelectedImagesToBase64Binary(optionalAsyncSuccessFunc?: (result: string[]) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): string | boolean; - - /** - * [Deprecated.] Saves the selected images in buffer to a byte array in the specified file format. - * @method WebTwain#SaveSelectedImagesToBytes - * @param {number} bufferSize specified the buffer size. - * @param {Array} buffer A byte array of the image data. - * @return {number} - */ - SaveSelectedImagesToBytes(bufferSize: number, buffer: number[]): number; - - /** - * Brings up the TWAIN Data Source Manager's Source Selection User Interface (UI) - * so that user can choose which Data Source to be the current Source. - * @method WebTwain#SelectSource - * @return {boolean} - */ - SelectSource(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: () => void): boolean; - - /** - * Selects the index-the source in SourceNameItems property as the current source. - * @method WebTwain#SelectSourceByIndex - * @param {number} index It is the index of SourceNameItems property. - * @return {boolean} - */ - SelectSourceByIndex(index: number): boolean; - - /*ignored - SetCancel - */ - - /** - * Set the value of the specified cap item. - * @method WebTwain#SetCapItems - * @param {number} index Index is 0-based. It is the index of the cap item. - * @param {number} newVal For string type, please use CapItemsstring property. - * @return {void} - */ - SetCapItems(index: number, newVal: number): void; - - /** - * Set the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. - * @method WebTwain#SetCapItemsString - * @param {number} index Index is 0-based. It is the index of the cap item. - * @param {string} newVal The new value to be set. - * @return {void} - */ - SetCapItemsString(index: number, newVal: string): void; - - /** - * [Deprecated.] Sets current cookie into the Http Header to be used when uploading scanned images through POST. - * @method WebTwain#SetCookie - * @param {string} cookie the cookie on current page. - * @return {void} - */ - SetCookie(cookie: string): void; - - // Set custom DS data (DAT_CUSTOMDSDATA), the input string is encoded with base64 - /** - * Sets custom DS data to be used for scanning, the input string is encoded with base64. Custom DS data means a specific scanning profile. - * @method WebTwain#SetCustomDSDataEx - * @param {string} value the input string which is encoded with base64. - * @return {boolean} - */ - SetCustomDSDataEx(value: string): boolean; - - // Set custom DS data, load data from the specified file - /** - * Sets custom DS data to be used for scanning, the data is stored in a file. Custom DS data means a specific scanning profile. - * @method WebTwain#SetCustomDSData - * @param {string} fileName the absolute path of the file where the custom data source data is stored. - * @return {boolean} - */ - SetCustomDSData(fileName: string): boolean; - - /** - * Change the DPI (dots per inch) for the specified image. - * @method WebTwain#SetDPI - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} xResolution The horizontal resolution. - * @param {number} yResolution The vertical resolution. - * @param {boolean} bResampleImage Whether to resample the image. (The image size will be changed if this is set to true). - * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. - * @return {boolean} - */ - SetDPI(sImageIndex: number, xResolution: number, yResolution: number, bResampleImage: boolean, newVal: EnumDWT_InterpolationMethod): boolean; - - /** - * Sets file name and file format information used in File Transfer Mode. - * @method WebTwain#SetFileXferInfo - * @param {string} fileName the name of the file to be used in transfer. - * @param {EnumDWT_FileFormat} fileFormat an enumerated value indicates the format of the image. - * @return {boolean} - */ - SetFileXferInfo(fileName: string, fileFormat: EnumDWT_FileFormat): boolean; - - /** - * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images. - * @method WebTwain#SetHTTPFormField - * @param {string} FieldName specifies the name of a text field in web form. - * @param {string} FieldValue specifies the value of a text field in web form. - * @return {boolean} - */ - SetHTTPFormField(FieldName: string, FieldValue: string): boolean; - - /** - * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images. - * @method WebTwain#SetHTTPFormField - * @param {string} FieldName specifies the name of the field which could later be used to retrieve the blob - * @param {Blob} blobValue specifies the blob to be put in the form. - * @param {string} optionalFileName specifies the file name for the blob - * @return {boolean} - */ - SetHTTPFormField(FieldName: string, blobValue: Blob, optionalFileName?: string): boolean; - - /** - * Sets a header for the current HTTP Post request. - * @method WebTwain#SetHTTPHeader - * @param {string} key the key of the header. - * @param {string} value the value of the header. - * @return {boolean} - */ - SetHTTPHeader(key: string, value: string): boolean; - - /** - * Sets the left, top, right, and bottom sides of the image layout rectangle for the current Data Source. - * @method WebTwain#SetImageLayout - * @param {number} left specifies the floating point number for the left side of the image layout rectangle. - * @param {number} top specifies the floating point number for the top side of the image layout rectangle. - * @param {number} right specifies the floating point number for the right side of the image layout rectangle. - * @param {number} bottom specifies the floating point number for the bottom side of the image layout rectangle. - * @return {boolean} - */ - SetImageLayout(left: number, top: number, right: number, bottom: number): boolean; - - /** - * Change the width of an image in buffer. - * @method WebTwain#SetImageWidth - * @param {number} sImageIndex specifies which image you'd like to change. - * @param {number} iNewWidth specifies how wide you'd like to change the image. - * @return {boolean} - */ - SetImageWidth(sImageIndex: number, iNewWidth: number): boolean; - - /** - * Set the language for the authorization dialogs. - * @method WebTwain#SetLanguage - * @param {EnumDWT_Language} language specify the language - * @return {boolean} - */ - SetLanguage(language: EnumDWT_Language): boolean; - - /** - * Sets the time-out used to open a specified Data Source. - * @method WebTwain#SetOpenSourceTimeout - * @param {number} iMilliseconds specifies the number of milliseconds. - * @return {boolean} - */ - SetOpenSourceTimeout(iMilliseconds: number): boolean; - - /** - * Draws a rectangle on the viewer which represents the selected area. - * @method WebTwain#SetSelectedImageArea - * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based. - * @param {number} left The X axis of the left border. - * @param {number} top The Y axis of the top border. - * @param {number} right The X axis of the right border. - * @param {number} bottom The Y axis of the bottom border. - * @return {boolean} - */ - SetSelectedImageArea(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - - /** - * You can use the method to select images programatically which is ususally done by mouse clicking. - * @method WebTwain#SetSelectedImageIndex - * @param {number} sSelectedIndex this is the index of an array that holds the indices of selected images. - * @param {number} newVal specifies the index of an image that you want to select. - * @return {boolean} - */ - SetSelectedImageIndex(selectedIndex: number, newVal: number): boolean; - - /** - * Sets a custom tiff tag. Currently you can set up to 32 tags. The string to be set in a tag can be encoded with base64. - * @method WebTwain#SetTiffCustomTag - * @param {number} tag specifies the tag identifier. The value should be between 600 and 700. - * @param {string} content the string to be set for this tag. The string will be written to the .tiff file when you save/upload it. If the string is base64 encoded, we'll decode it before writing it. - * @param {boolean} base64Str if you'd like to encode the string with base64, set this to true. Otherwise, the string will be plin text. - * @return {boolean} - */ - SetTiffCustomTag(tag: number, content: string, base64Str: boolean): boolean; - - /** - * Configures how segmented upload is done. - * @method WebTwain#SetUploadSegment - * @param {number} segmentUploadThreshold specifies the threshold (in MB) over which segmented upload will be invoked. - * @param {number} moduleSize specifies the size of each segment (in KB). - * @return {boolean} - */ - SetUploadSegment(segmentUploadThreshold: number, moduleSize: number): boolean; - - /** - * Sets the view mode that images are displayed in Dynamic Web TWAIN. You can use this method to display multiple images in Dynamic Web TWAIN. - * @method WebTwain#SetViewMode - * @param {number} sHorizontalImageCount specifies how many columns can be displayed in Dynamic Web TWAIN. - * @param {number} sVerticalImageCount specifies how many rows can be displayed in Dynamic Web TWAIN.. - * @return {void} - */ - SetViewMode(sHorizontalImageCount: number, sVerticalImageCount: number): void; - - /** - * Show save file dialog or show open file dialog. - * @method WebTwain#ShowFileDialog - * @param {boolean} SaveDialog True -- show save file dialog, False -- show open file dialog. - * @param {string} Filter The filter name specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0", but the program will replace "\0" with "|" automatically. - * @param {number} FilterIndex The index of the currently selected filter in the File Types control. The buffer pointed to by Filter contains pairs of strings that define the filters. The index is 0-based. - * @param {string} DefExtension Define the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name only if the user fails to type an extension. If this member is NULL and the user fails to type an extension, no extension is appended. - * @param {string} InitialDir The initial directory. The algorithm for selecting the initial directory varies on different platforms. - * @param {boolean} AllowMultiSelect True -- allows users to select more than one file, False -- only allows to select one file. - * @param {boolean} OverwritePrompt True -- If a file already exists with the same name, the old file will be simply overwritten, False -- not allows to save and overwrite a same name file. - * @param {number} Flags If this parameter equals 0, the program will be initiated with the default flags, otherwise initiated with the cumstom value and paramters "AllowMultiSelect" and "OverwritePrompt" will be useless. - * @return {boolean} - */ - ShowFileDialog(SaveDialog: boolean, Filter: string, FilterIndex: number, DefExtension: string, InitialDir: string, AllowMultiSelect: boolean, OverwritePrompt: boolean, Flags: number): boolean; - - /** - * Shows the GUI of Image Editor. - * @method WebTwain#ShowImageEditor - * @param {string} elEditorDIV Specifies a DIV by its ID to put the editor in - * @param {number} width Specifies the width of the DIV - * @param {number} height Specifies the height of the DIV - * @param {boolean} bHideToolBar Specifies whether to show the toolbar or not - * @return {boolean} - */ - ShowImageEditor(elEditorDIV?: string, width?: number, height?: number, bHideToolBar?: boolean): boolean; - - /** - * [Deprecated.] Shows the GUI of Image Editor with custom settings. - * @method WebTwain#ShowImageEditorEx - * @param {number} x specifies the new position of the left top corner of the window. - * @param {number} y specifies the new position of the left top corner of the window. - * @param {number} cx specifies the width of the window. - * @param {number} cy specifies the height of the window. - * @param {number} nCmdShow specifices how the window should be shown. - * @return {boolean} - */ - ShowImageEditorEx(x: number, y: number, cx: number, cy: number, nCmdShow: number): boolean; - - /*ingored - SourceNameItems - */ - - /** - * Shows the GUI of Image Editor. - * @method WebTwain#startScan - * @return {Promise} - * @param {any} scanSetup Specifies how images are scanned and outputed - */ - startScan(scanSetup: any): Promise; - - /** - * Switchs two images of specified indices in buffer. - * @method WebTwain#SwitchImage - * @param {number} sImageIndex1 specifies the index of image in buffer. The index is 0-based. - * @param {number} sImageIndex2 specifies the index of image in buffer. The index is 0-based. - * @return {boolean} - */ - SwitchImage(sImageIndex1: number, sImageIndex2: number): boolean; - - /** - * Unbinds an event from the specified function, so that the function stops receiving notifications when the event fires. - * @method WebTwain#UnregisterEvent - * @param {string} name the name of the event. - * @param {object} evt specified the function to be unbound. - * @return {boolean} - */ - UnregisterEvent(name: string, evt: object): boolean; - - /** - * Tag specified images - * @method WebTwain#TagImages - * @param {number[]} aryImageIndices The indices of the images to tag - * @param {string} tagName specifies a tag - * @return {boolean} - */ - TagImages(aryImageIndices: number[], tagName: string): boolean; - - /** - * Sets a default tag that's applied to newly acquired images - * @method WebTwain#SetDefaultTag - * @param {string} tagName specifies a tag - * @return {boolean} - */ - SetDefaultTag(tagName: string): boolean; - - /** - * Clear the tags from the specified image - * @method WebTwain#ClearImageTags - * @param {number} sImageIndex specified a image - */ - ClearImageTags(sImageIndex: number): boolean; - - /** - * Specifies a tag and use it to filter images - * @method WebTwain#FilterImagesByTag - * @param {string} tagName specifies a tag - * @return {boolean} - */ - FilterImagesByTag(tagName: string): boolean; - - /** - * Selects all images - * @method WebTwain#SelectAllImages - * @return {boolean} - */ - SelectAllImages(): boolean; - - /** - * Inverts the color of the pixels of the specified image - * @method WebTwain#Invert - * @param {number} sImageIndex specifies an image - * @return {boolean} - */ - Invert(sImageIndex: number): boolean; - - /** - * Converts the specified image to black & white - * @method WebTwain#ConvertToBW - * @param {number} sImageIndex specifies an image - * @return {boolean} - */ - ConvertToBW(sImageIndex: number): boolean; - - /*ignored - checkErrorString - first - getInstance - last - next - on - onEvent - previous - - ...other internal ones - */ - Addon: DynamsoftWebTwainAddon; +export interface Product { + bActiveXEdition: boolean; + bChromeEdition: boolean; + bHTML5Edition: boolean; + bPluginEdition: boolean; + host: string; + name: string; } +declare const Dynamsoft: (typeof DynamsoftEnums & typeof DynamsoftStatic); +export default Dynamsoft; diff --git a/types/dwt/README.md b/types/dwt/README.md index 70f0d24b35..897c877506 100644 --- a/types/dwt/README.md +++ b/types/dwt/README.md @@ -2,15 +2,13 @@ > `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). +This package contains type definitions for [dwt](https://www.npmjs.com/package/dwt). Check out more on its [official site](https://www.dynamsoft.com/products/webtwain_overview.aspx). # Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dwt +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dwt. -Additional Details - * Last updated: 07 Jan 2020 09:05:12 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. +### Additional Details + * Last updated: Tue, 7 July 2020 20:38:11 GMT # Credits -These definitions were written by Xiao Ling , Josh Hall , Lincoln Hu , Tom Kent . +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), and [Dave Sueltenfuss](https://github.com/dsueltenfuss). diff --git a/types/dwt/WebTwain.Acquire.d.ts b/types/dwt/WebTwain.Acquire.d.ts new file mode 100644 index 0000000000..3bf67f0a8c --- /dev/null +++ b/types/dwt/WebTwain.Acquire.d.ts @@ -0,0 +1,1022 @@ +import { DynamsoftEnums as Dynamsoft } from "./Dynamsoft.Enum"; +import { WebTwainEdit } from "./WebTwain.Edit"; + +export interface WebTwainAcquire extends WebTwainEdit { + /** + * Start image acquisition. + * @param deviceConfiguration Configuration for the acquisition. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + AcquireImage( + successCallBack?: () => void, + failureCallBack?: ( + errorCode: number, + errorString: string) => void + ): void; + AcquireImage( + deviceConfiguration?: DeviceConfiguration, + successCallBack?: () => void, + failureCallBack?: ( + deviceConfiguration: DeviceConfiguration, + errorCode: number, + errorString: string) => void + ): void; + /** + * Close the data source (a TWAIN/ICA/SANE device which in most cases is a scanner) to free it to be used by other applications. + */ + CloseSource(): boolean; + /** + * Disable the data source (a TWAIN/ICA/SANE device which in most cases is a scanner) to stop the acquiring process. If the data source's user interface is displayed, it will be closed. + */ + DisableSource(): boolean; + /** + * Enable the data source to start the acquiring process. + */ + EnableSource(): boolean; + /** + * Display the TWAIN source's built-in user interface. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + EnableSourceUI( + successCallBack: () => void, + failureCallBack: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Load a data source to get it ready to acquire images. + */ + OpenSource(): boolean; + /** + * Return all available data sources (scanners, etc.) and optionally all detailed information about them. + * @param bIncludeDetails Whether to return more details about the data sources or just their names. + */ + GetSourceNames(bIncludeDetails?: boolean): string[] | SourceDetails[]; + /** + * Bring up the Source Selection User Interface (UI) for the user to choose a data source. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SelectSource( + successCallBack?: () => void, + failureCallBack?: (errorCode: number, errorString: string) => void + ): boolean | void; + /** + * Select a data source by its index. + * @param index The index of the data source. + */ + SelectSourceByIndex(index: number): boolean; + /** + * Sets a timer which stops the data source opening process once it expires. + * @param duration Define the duration of the timer (in milliseconds). + */ + SetOpenSourceTimeout(duration: number): boolean; + /** + * Start the acquisition by passing all settings at once. + * @param scanSetup Configuration for the acquisition. + */ + startScan(scanSetup: ScanSetup): Promise; + /** + * Cancels all pending transfers. + */ + CancelAllPendingTransfers(): boolean; + /** + * Closes and unloads Data Source Manager. + */ + CloseSourceManager(): boolean; + /** + * Closes the scanning process to release resources on the machine. + */ + CloseWorkingProcess(): boolean; + /** + * Ejects the current page and begins scanning the next page in the document feeder. + */ + FeedPage(): boolean; + /** + * Get the custom data source data and saves the data in a specified file. + * @param fileName The path of the file to save the data source data to. + */ + GetCustomDSData(fileName: string): boolean; + /** + * Gets custom DS data and returns it in a base64 string. + */ + GetCustomDSDataEx(): string; + /** + * Inspect the current data source and return whether it is a scanner, a webcam, etc. + */ + GetDeviceType(): number; + /** + * Get the name of a data source by its index in data source manager source list. + * @param index The index of the data source. + */ + GetSourceNameItems(index: number): string; + /** + * Load and open data source manager. + */ + OpenSourceManager(): boolean; + /** + * Reset the image layout in the data source. + */ + ResetImageLayout(): boolean; + /** + * If called while {IfFeederEnabled} property is true, the data source will return the current page to the input area and return the last page from the output area into the acquisition area. + */ + RewindPage(): boolean; + /** + * Sets custom data source data to be used for scanning, the data is stored in a file which can be regarded as a scanning profile. + * @param fileName The path of the file. + */ + SetCustomDSData(fileName: string): boolean; + /** + * Set custom data source data to be used for scanning, the input is a base64 string. + * @param dsDataString The string that contains custom data source data. + */ + SetCustomDSDataEx(dsDataString: string): boolean; + /** + * Set the file transfer information to be used in File Transfer mode. + * @param fileName The path to transfer the file to. + * @param fileFormat The format of the file. + */ + SetFileXferInfo( + fileName: string, + fileFormat: Dynamsoft.EnumDWT_FileFormat | number + ): boolean; + /** + * Set the left, top, right, and bottom sides of the image layout + * rectangle for the current data source. The image layout rectangle + * defines a frame of the data source's scanning area to be acquired. + * @param left Specify the rectangle (leftmost coordinate). + * @param top Specify the rectangle (topmost coordinate). + * @param right Specify the rectangle (rightmost coordinate). + * @param bottom Specify the rectangle (bottommost coordinate). + */ + SetImageLayout( + left: number, + top: number, + right: number, + bottom: number + ): boolean; + /** + * Return or set the pixel bit depth for the current value of `PixelType`. + */ + BitDepth: number; + /** + * Return or set whether newly acquired images are inserted or appended. + */ + IfAppendImage: boolean; + /** + * Return or set whether to close the user interface after all images have been acquired. + */ + IfDisableSourceAfterAcquire: boolean; + /** + * Return or set whether to enable duplex scanning (in other words, whether to scan both sides of the paper). + */ + IfDuplexEnabled: boolean; + /** + * Return or set whether a data source's Automatic Document Feeder (ADF) is enabled for scanning. + */ + IfFeederEnabled: boolean; + /** + * Return or set whether the data source displays the user interface when scanning. + */ + IfShowUI: boolean; + /** + * Return or set whether to use TWAIN or ICA protocol on macOS. + */ + ImageCaptureDriverType: Dynamsoft.EnumDWT_Driver | number; + /** + * Return or set the page size the data source uses to acquire images. + */ + PageSize: Dynamsoft.EnumDWT_CapSupportedSizes | number; + /** + * Return or set the pixel type used when acquiring images. + */ + PixelType: Dynamsoft.EnumDWT_PixelType | number; + /** + * Return or set the resolution used when acquiring images. + */ + Resolution: number; + /** + * Returns how many data sources are available on the local system. + */ + readonly SourceCount: number; + /** + * Return or set the brightness to be used for scanning by the data source. + */ + Brightness: number; + /** + * Return or set Contrast to be used for scanning by the data source. + */ + Contrast: number; + /** + * Return the device name of current source. + */ + readonly CurrentSourceName: string; + /** + * Return a value that indicates the data source status. + */ + DataSourceStatus: number; + /** + * Return the name of the default source. + */ + DefaultSourceName: string; + /** + * Return whether the source supports duplex. If yes, it further returns the level of duplex the data source supports. + */ + readonly Duplex: Dynamsoft.EnumDWT_DUPLEX | number; + /** + * Return or set whether to enable the data source's auto-brightness feature. + */ + IfAutoBright: boolean; + /** + * Return or set whether the data source (the scanner) discards blank images during scanning automatically. + */ + IfAutoDiscardBlankpages: boolean; + /** + * Return or set whether to enable the data source's automatic document feeding process. + */ + IfAutoFeed: boolean; + /** + * Return or set whether to enable the data source's automatic border detection feature. + */ + IfAutomaticBorderDetection: boolean; + /** + * Return or set whether to enable the data source's automatic skew correction feature. + */ + IfAutomaticDeskew: boolean; + /** + * Return or set whether to enable the data source's automatic document scanning process. + */ + IfAutoScan: boolean; + /** + * Return whether or not there are documents loaded in the data source's feeder. + */ + readonly IfFeederLoaded: boolean; + /** + * Return whether the Source has a paper sensor that can detect pages on the ADF or Flatbed. + */ + readonly IfPaperDetectable: boolean; + /** + * Return or set whether the data source displays a progress indicator during acquisition and transfer. + */ + IfShowIndicator: boolean; + /** + * Return whether the data source supports acquisitions with the UI (User Interface) disabled. + */ + readonly IfUIControllable: boolean; + /** + * Return or set whether the new TWAIN DSM (data source Manager) is used for acquisitions. The new TWAIN DSM is a DLL called 'TWAINDSM.dll' while the default | old DSM is called 'twain_32.dll'. + */ + IfUseTwainDSM: boolean; + /** + * Return the value of the bottom edge of the current image frame (in Unit). + */ + readonly ImageLayoutFrameBottom: number; + /** + * Return the value of the left edge of the current image frame (in Unit). + */ + readonly ImageLayoutFrameLeft: number; + /** + * Return the value of the right edge of the current image frame (in Unit). + */ + readonly ImageLayoutFrameRight: number; + /** + * Return the value of the top edge of the current image frame (in Unit). + */ + readonly ImageLayoutFrameTop: number; + /** + * Return the document number of the current image. + */ + readonly ImageLayoutDocumentNumber: number; + /** + * Return the page number of the current image. + */ + readonly ImageLayoutPageNumber: number; + /** + * Return the bit depth of the current image. + */ + readonly ImageBitsPerPixel: number; + /** + * Return the pixel type of the current image. + */ + readonly ImagePixelType: Dynamsoft.EnumDWT_PixelType | number; + /** + * Return the length of the current image. + */ + readonly ImageLength: number; + /** + * Return the width of the current image. + */ + readonly ImageWidth: number; + /** + * Return the horizontal resolution of the current image. + */ + readonly ImageXResolution: number; + /** + * Return the vertical resolution of the current image. + */ + readonly ImageYResolution: number; + /** + * Return the data of the magnetic data if the data source supports magnetic data recognition. + */ + readonly MagData: string; + /** + * Return the type of the magnetic data if the data source supports magnetic data recognition. + */ + readonly MagType: Dynamsoft.EnumDWT_MagType | number; + /** + * Return the number of transfers the data source is ready to supply upon demand. + */ + readonly PendingXfers: number; + /** + * Return or set the pixel flavor to be used for acquiring images. + */ + PixelFlavor: number; + /** + * Return or set the data source's transfer mode. + */ + TransferMode: Dynamsoft.EnumDWT_TransferMode | number; + /** + * Return or set the unit of measure for all quantities. + */ + Unit: Dynamsoft.EnumDWT_UnitType | number; + /** + * Return and set the number of images your application is willing to accept for each scan job. + */ + XferCount: number; + /** + * Gets detailed information about all capabilities of the current data source. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument capabilityDetails Detailed information about the specified capabilities. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + getCapabilities( + succssCallback: (capabilityDetails: CapabilityDetails[]) => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Sets up one or multiple capabilities in one call. + * @param capabilities A object that describes how to set capabilities. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument capabilities The capabilities to set. + */ + setCapabilities( + capabilities: Capabilities, + succssCallback: (capabilities: Capabilities) => void, + failureCallback: (capabilities: Capabilities) => void + ): void; + /** + * [Deprecation] Specifies the capabiltiy to be negotiated. This is a runtime property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + Capability: Dynamsoft.EnumDWT_Cap; + /** + * [Deprecation] Return or set the index (0-based) of + * a list to indicate the Current Value when the value of + * the CapType property is TWON_ENUMERATION. If the data type + * of the capability is String, the list is in CapItemsString property. + * For other data types, the list is in CapItems property. This is a runtime property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapCurrentIndex: number; + /** + * [Deprecation] Return or set the current value in a range when the + * value of the CapType property is TWON_RANGE. This is a runtime property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapCurrentValue: number; + /** + * [Deprecation] Return the index (0-based) of a list to indicate the + * Default Value when the value of the CapType property is TWON_ENUMERATION. + * If the data type of the capability is String, the list is in CapItemsString property. + * For other data types, the list is in CapItems property. This is a runtime, read-only property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + readonly CapDefaultIndex: number; + /** + * [Deprecation] Return the default value in a range when the value of the + * CapType property is TWON_RANGE. This is a runtime, read-only property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapDefaultValue: number; + /** + * [Deprecation] Retruns the description for a capability + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapDescription: string; + /** + * [Deprecation] Return or set the maximum value in a range when the + * value of the CapType property is TWON_RANGE. This is a runtime property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapMaxValue: number; + /** + * [Deprecation] Return or set the minimum value in a range when the + * value of the CapType property is TWON_RANGE. This is a runtime property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapMinValue: number; + /** + * [Deprecation] Return or set how many items are in the list when the + * value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * For String data type, the list is in CapItemsString property. + * For other data types, the list is in CapItems property. + * This is a runtime property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapNumItems: number; + /** + * [Deprecation] Return or set the step size in a range when the value + * of the CapType property is TWON_RANGE. This is a runtime property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapStepSize: number; + /** + * [Deprecation] Return or set the type of capability container used + * to exchange capability information between application and source. + * This is a runtime property. + */ + CapType: Dynamsoft.EnumDWT_CapType; + /** + * [Deprecation] Return or set the value of the capability specified by + * Capability property when the value of the CapType property is TWON_ONEVALUE. + * This is a runtime property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapValue: number; + /** + * [Deprecation] Return or set the string value for a capability when the + * value of the CapType property is TWON_ONEVALUE. This is a runtime property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapValueString: string; + /** + * [Deprecation] Return or set the value type for reading the value of a capability. + * This is a runtime property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapValueType: number; + /** + * [Deprecation] Gets information of the capability specified by the Capability property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapGet(): boolean; + /** + * [Deprecation] Return the Source's current Value for the specified capability. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapGetCurrent(): boolean; + /** + * [Deprecation] Return the Source's Default Value for the specified capability. + * This is the Source's preferred default value. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapGetDefault(): boolean; + /** + * [Deprecation] Return the value of the bottom-most edge of the specified frame. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + * @param index specifies the value of which frame to get. The index is 0-based. + */ + CapGetFrameBottom(index: number): number; + /** + * [Deprecation] Return the value (in Unit) of the left-most edge of the specified frame. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + * @param index specifies the value of which frame to get. The index is 0-based. + */ + CapGetFrameLeft(index: number): number; + /** + * [Deprecation] Return the value (in Unit) of the left-most edge of the specified frame. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + * @param index specifies the value of which frame to get. The index is 0-based. + */ + CapGetFrameRight(index: number): number; + /** + * [Deprecation] Return the value (in Unit) of the top-most edge of the specified frame. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + * @param index specifies the value of which frame to get. The index is 0-based. + */ + CapGetFrameTop(index: number): number; + /** + * [Deprecation] Use getCapabilities() and setCapabilities() instead. + */ + CapGetHelp(index: number): number; + /** + * [Deprecation] Use getCapabilities() and setCapabilities() instead. + */ + CapGetLabel(index: number): number; + /** + * [Deprecation] Use getCapabilities() and setCapabilities() instead. + */ + CapGetLabels(index: number): number; + /** + * [Deprecation] Queries whether the Source supports a particular operation on the capability. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + * @param {Dynamsoft.EnumDWT_MessageType} messageType specifies the type of capability operation. + */ + CapIfSupported(messageType: Dynamsoft.EnumDWT_MessageType): boolean; + /** + * [Deprecation] Changes the Current Value of the capability specified by + * Capability property back to its power-on value. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapReset(): boolean; + /** + * [Deprecation] Sets the current capability using the container type specified by + * CapType property. The current capability is specified by Capability property. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + */ + CapSet(): boolean; + /** + * [Deprecation] Sets the values of the specified frame. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + * @param index specifies the values of which frame to set. The index is 0-based. + * @param left the value (in Unit) of the left-most edge of the specified frame. + * @param top the value (in Unit) of the top-most edge of the specified frame. + * @param right the value (in Unit) of the right-most edge of the specified frame. + * @param bottom the value (in Unit) of the bottom-most edge of the specified frame. + */ + CapSetFrame(index: number, left: number, top: number, right: number, bottom: number): boolean; + /** + * Get the cap item value of the capability specified by Capability property, + * when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + * @param index Index is 0-based. It is the index of the cap item. + */ + GetCapItems(index: number): number; + /** + * Returns the cap item value of the capability specified by Capability property, + * when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + * @param index Index is 0-based. It is the index of the cap item. + */ + GetCapItemsString(index: number): string; + /** + * [Deprecation] Set the value of the specified cap item. + * @param index Index is 0-based. It is the index of the cap item. + * @param newVal For string type, please use CapItemsstring property. + */ + SetCapItems(index: number, newVal: number): void; + /** + * [Deprecation] Set the cap item value of the capability specified by Capability property, + * when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * [Alternative] Use getCapabilities() and setCapabilities() instead. + * @param index Index is 0-based. It is the index of the cap item. + * @param newVal The new value to be set. + */ + SetCapItemsString(index: number, newVal: string): void; +} +export interface DeviceConfiguration { + /** + * Whether to show the built-in User Interface from the device vendor + */ + IfShowUI?: boolean; + /** + * How a pixel is represented. Basically it means whether to scan in color, grey or black & white + */ + PixelType?: Dynamsoft.EnumDWT_PixelType | number | string; + /** + * How detailed is the acquisition. Measured by dots per pixel (DPI) + */ + Resolution?: number; + /** + * Whether to use the document feeder or the flatbed of the device. + */ + IfFeederEnabled?: boolean; + /** + * Whether to scan one side or both sides of each paper. + */ + IfDuplexEnabled?: boolean; + /** + * Whether to close the built-in User Interface after aquisition. Only valid when {IfShowUI} is true. + */ + IfDisableSourceAfterAcquire?: boolean; + /** + * Whether to retrieve information about the image after it's transferred. + */ + IfGetImageInfo?: boolean; + /** + * Whether to retrieve extended information about the image after it's transferred. + */ + IfGetExtImageInfo?: boolean; + /** + * How much extended information is retrieved. Only valid when {IfGetExtImageInfo} is true. + */ + extendedImageInfoQueryLevel?: number; +} +export interface SourceDetails { + /** + * The driver type which can be "TWAIN" | "ICA" | "SANE" + */ + DriverType?: string; + /** + * Information about the driver if it's DriverType is "ICA" + */ + DeviceInfo?: any; + /** + * The name of the data source. E.g. "TWAIN2 FreeImage Software Scanner". + */ + ProductName?: string; + /** + * Whether it is the default source. + */ + IsDefaultSource?: boolean; + /** + * Whether it is the current source. + */ + IsCurrentSource?: boolean; + /** + * The family name of the data source. E.g. "Software Scan". + */ + ProductFamily?: string; + /** + * The manufacturer of the data source. E.g. "TWAIN Working Group". + */ + Manufacturer?: string; + /** + * Supported Groups + */ + SupportedGroups?: number; + /** + * The version of the protocol based on which the data source is developed. + */ + ProtocolMajor?: number; + ProtocolMinor?: number; + /** + * Detailed version of the data source. + */ + Version?: Version; +} +export interface Version { + MajorNum?: number; + MinorNum?: number; + Language?: number; + Country?: number; + Info?: string; +} +export interface ScanSetup { + /** + * An id that specifies this specific setup. + */ + setupId?: string; + /** + * Whether to ignore or fail the acquistion when an exception is raised. Set "ignore" or "fail". + */ + exception?: string; + /** + * The name of the data source (the scanner). If not set, the default data source is used. + */ + scanner?: string; + ui?: { + /** + * Whether to show the UI of the device. + */ + bShowUI?: boolean, + /** + * Whether to show the indicator of the device. + */ + bShowIndicator?: boolean, + }; + /** + * The TWAIN transfer mode. + */ + transferMode?: Dynamsoft.EnumDWT_TransferMode | number; + /** + * Set how the transfer is done. + */ + fileXfer?: { + /** + * Specify the file name (or pattern) for file transfer. + * Example: "C:\\WebTWAIN<%06d>.bmp" + */ + fileName?: string, + /** + * Specify the file format. + */ + fileFormat?: Dynamsoft.EnumDWT_FileFormat | number, + /** + * Specify the quality of JPEG files. + */ + jpegQuality?: number, + /** + * Specify the compression type of the file. + */ + compressionType?: Dynamsoft.EnumDWT_CompressionType | number + }; + /** + * Set where the scanned images are inserted. + */ + insertingIndex?: number; + /** + * The profile is a base64 string, if present, it overrides settings and more settings. + */ + profile?: string; + /** + * Basic settings. + */ + settings?: { + /** + * "ignore" (default) or "fail". + */ + exception?: string, + /** + * Specify the pixel type. + */ + pixelType?: Dynamsoft.EnumDWT_PixelType | number, + /** + * Specify the resolution. + */ + resolution?: number, + /** + * Whether to enable document feader. + */ + bFeeder?: boolean, + /** + * Whether to enable duplex scan. + */ + bDuplex?: boolean + }; + moreSettings?: { + /** + * "ignore" (default) or "fail". + */ + exception?: string, + /** + * Specify the bit depth. + */ + bitDepth?: number, + /** + * Specify the page size. + */ + pageSize?: Dynamsoft.EnumDWT_CapSupportedSizes | number, + /** + * Specify the unit. + */ + unit?: Dynamsoft.EnumDWT_UnitType | number, + /** + * Specify a layout to scan, if present, it'll override pageSize. + */ + layout?: { + left?: number, + top?: number, + right?: number, + bottom?: number + }, + /** + * Specify the pixel flavor. + */ + pixelFlavor?: Dynamsoft.EnumDWT_CapPixelFlavor | number, + /** + * Specify Brightness. + */ + brightness?: number, + /** + * Specify contrast. + */ + contrast?: number, + /** + * Specify how many images are transferred per session. + */ + nXferCount?: number, + /** + * Whether to enable automatic blank image detection and removal. + */ + autoDiscardBlankPages?: boolean, + /** + * Whether to enable automatic border detection. + */ + autoBorderDetection?: boolean, + /** + * Whether to enable automatic skew correction. + */ + autoDeskew?: boolean, + /** + * Whether to enable automatic brightness adjustment. + */ + autoBright?: boolean + }; + /** + * A callback triggered before the scan, after the scan and after each page has been transferred. + */ + funcScanStatus?: (status: Status) => void; + /** + * Set up how the scanned images are outputted. + */ + outputSetup?: { + /** + * Output type. "http" is the only supported type for now. + */ + type?: string, + /** + * Set the output format. + */ + format?: Dynamsoft.EnumDWT_ImageType | number, + /** + * Specify how many times the library will try the output. + */ + reTries?: number, + /** + * Whether to use the FileUploader. + */ + useUploader?: false, + /** + * Whether to upload all images in one HTTP post. + */ + singlePost?: boolean, + /** + * Whether to show a progress bar when outputting. + */ + showProgressBar?: boolean, + /** + * Whether to remove the images after outputting. + */ + removeAfterOutput?: boolean, + /** + * A callback triggered during the outputting. + * @argument fileInfo A JSON object that contains the fileName, percentage, statusCode, responseString, etc. + */ + funcHttpUploadStatus?: (fileInfo: any) => void, + /** + * Setup for PDF output. + */ + pdfSetup?: { + author?: string, + compression?: Dynamsoft.EnumDWT_PDFCompressionType | number, + creator?: string, + /** + * Example: 'D:20181231' + */ + creationDate?: string, + keyWords?: string, + /** + * Example: 'D:20181231' + */ + modifiedDate?: string, + producer?: string, + subject?: string, + title?: string, + version?: number, + quality?: number + }, + /** + * Setup for TIFF output. + */ + tiffSetup?: { + quality?: number, + compression?: Dynamsoft.EnumDWT_TIFFCompressionType | number, + /** + * Specify Tiff custom tags. + */ + tiffTags?: TiffTag[] + }, + /** + * Setup for HTTP upload via Post. + */ + httpParams?: { + /** + * Target of the request. + * Example: "http://dynamsoft.com/receivepost.aspx" + */ + url?: string, + /** + * Custom headers in the form. + * Example: {md5: ""} + */ + headers?: any, + /** + * Custom form fields. + * Example: {"UploadedBy": "Dynamsoft"} + */ + formFields?: any, + /** + * The maximum size of a file to be uploaded (in bytes). + */ + maxSizeLimit?: number, + /** + * Specify how many threads (<=4) are to be used. Only valid when {useUploader} is true. + */ + threads?: number, + /** + * Specify the names for the files in the form. + * Example: "RemoteName<%06d>" + */ + remoteName?: string, + /** + * Specify the name(s) (pattern) of the uploaded files. + * Example: "uploadedFile<%06d>.jpg" + */ + fileName?: string + } + }; +} +export interface Status { + bScanCompleted?: boolean; + event?: string; + result?: { + currentPageNum?: number + }; +} +export interface TiffTag { + tagIdentifier?: number; + content?: string; + useBase64Encoding?: boolean; +} +/** + * Detailed information about a specific capability, + */ +export interface CapabilityDetails { + /** + * The Capability. + */ + capability: ValueAndLabel; + /** + * The container type of the Capability + */ + conType: ValueAndLabel; + /** + * The index for the current value of the Capability + */ + curIndex: number; + /** + * The current value of the Capability + */ + curValue: ValueAndLabel; + /** + * The index for the default value of the Capability + */ + defIndex: number; + /** + * The operation types that are supported by the Capability. Types include {"get", "set", "reset" "getdefault", "getcurrent"} + */ + query: string[]; + /** + * The value type of the Capability. Value types include + * TWTY_BOOL: 6 + * TWTY_FIX32: 7 + * TWTY_FRAME: 8 + * TWTY_INT8: 0 + * TWTY_INT16: 1 + * TWTY_INT32: 2 + * TWTY_STR32: 9 + * TWTY_STR64: 10 + * TWTY_STR128: 11 + * TWTY_STR255: 12 + * TWTY_UINT8: 3 + * TWTY_UINT16: 4 + * TWTY_int: 5 + */ + valueType: ValueAndLabel; + /** + * The available values of the Capability + */ + values: ValueAndLabel[]; +} +export interface ValueAndLabel { + /** + * Numeric representation of the item + */ + value: Dynamsoft.EnumDWT_Cap | Dynamsoft.EnumDWT_CapType | Dynamsoft.EnumDWT_CapValueType | number; + /** + * Label or name of the item + */ + label: string; +} +export interface Capabilities { + /** + * Whether to "ignore" or "fail" the request if an exception occurs. This is an overall setting that is inherited by all capabilities. + */ + exceptition: string; + /** + * Specifies how to set capabilities + */ + capabilities: CapabilitySetup[]; +} +export interface CapabilitySetup { + /** + * Specify a capability + */ + capability: Dynamsoft.EnumDWT_Cap | number; + /** + * The value to set to the capability or the value of the capability after setting. + */ + curValue: number | string; + errorCode?: number; + errorString?: string; + /** + * Whether to "ignore" or "fail" the request if an exception occurs when setting this specific capability. + */ + exception?: string; +} diff --git a/types/dwt/WebTwain.Buffer.d.ts b/types/dwt/WebTwain.Buffer.d.ts new file mode 100644 index 0000000000..cb92a7873e --- /dev/null +++ b/types/dwt/WebTwain.Buffer.d.ts @@ -0,0 +1,253 @@ +import { DynamsoftEnums as Dynamsoft } from "./Dynamsoft.Enum"; +import { WebTwainIO } from "./WebTwain.IO"; + +export interface WebTwainBuffer extends WebTwainIO { + /** + * Return the current deviation of the pixels in the image. + */ + readonly BlankImageCurrentStdDev: number; + /** + * Return or set the standard deviation of the pixels in the image. + */ + BlankImageMaxStdDev: number; + /** + * Return or set the dividing line between black and white. The default value is 128. + */ + BlankImageThreshold: number; + /** + * Return or set how much physical memory is allowed for storing images currently loaded in Dynamic Web TWAIN. Once the limit is reached, images will be cached on the hard disk. + */ + BufferMemoryLimit: number; + /** + * Remove all tags from the specified image. + * @param index Specify the image. + */ + ClearImageTags(index: number): boolean; + /** + * Return or set the current index of image in the buffer. + */ + CurrentImageIndexInBuffer: number; + /** + * Filter images by the specified tag. + * @param tag The tag used as the filter. + */ + FilterImagesByTag(tag: string): boolean; + /** + * Return the pixel bit depth of the specified image. + * @param index Specify the image. + */ + GetImageBitDepth(index: number): number; + /** + * Return the height (in pixels) of the specified image. + * @param index Specify the image. + */ + GetImageHeight(index: number): number; + /** + * Return the internal URL of the specified image. If width and height are not specified, + * you get the original image, otherwise you get the image with specified width or height + * while keeping the same aspect ratio. The returned string is like this + * 'dwt://dwt_trial_13000404/img?id=306159652&index=0&t=1502184632022'. + * @param index Specify the image. + * @param width the width of the image, it must be 150 or bigger + * @param height the height of the image, it must be 150 or bigger + */ + GetImagePartURL(index: number, width?: number, height?: number): string; + /** + * Calculate the size in bytes of the specified image assuming it's resized to the given dimensions. + * @param index Specify the image. + * @param width Specify the width. + * @param height Specify the height. + */ + GetImageSize(index: number, width: number, height: number): number; + /** + * Calculate the size in bytes of the specified image assuming an expected file type. + * @param index Specify the image. + * @param type Sepcify the expected file type. + */ + GetImageSizeWithSpecifiedType(index: number, type: Dynamsoft.EnumDWT_ImageType | number): number; + /** + * Return the direct URL of the specified image, if width or height is set to -1, + * you get the original image, otherwise you get the image with specified width or + * height while keeping the same aspect ratio. + * @param index Specify the image. + * @param width Specify the width. + * @param height Specify the height. + */ + GetImageURL(index: number, width?: number, height?: number): string; + /** + * Return the width (in pixels) of the specified image. + * @param index Specify the image. + */ + GetImageWidth(index: number): number; + /** + * Return the horizontal resolution of the specified image. + * @param index Specify the image. + */ + GetImageXResolution(index: number): number; + /** + * Return the vertical resolution of the specified image. + * @param index Specify the image. + */ + GetImageYResolution(index: number): number; + /** + * [Deprecation] Return an index from the selected indices array. Read SelectedImagesIndices instead. + * [Alternative] Read SelectedImagesIndices instead. + * @param indexOfIndices Specify the index of the specified image. + */ + GetSelectedImageIndex(indexOfIndices: number): number; + /** + * Calculate the size in bytes of all selected images assuming an expected file type. + * @param type Sepcify the expected file type. + */ + GetSelectedImagesSize(type: Dynamsoft.EnumDWT_ImageType | number): number; + /** + * Return the skew angle of the specified image. + * @param index Specify the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument angle The skew angle. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + GetSkewAngle( + index: number, + successCallback?: ( + angle: number) => void, + failureCallback?: ( + errorCode: number, + errorString: string) => void + ): number | void; + /** + * Return the skew angle of the specified rectangle on the specified image. + * @param index Specify the image. + * @param left The x-coordinate of the upper-left corner of the rectangle. + * @param top The y-coordinate of the upper-left corner of the rectangle. + * @param right The x-coordinate of the lower-right corner of the rectangle. + * @param bottom The y-coordinate of the lower-right corner of the rectangle. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument angle The skew angle. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + GetSkewAngleEx( + index: number, + left: number, + top: number, + right: number, + bottom: number, + successCallback?: ( + angle: number) => void, + failureCallback?: ( + errorCode: number, + errorString: string) => void + ): number | void; + /** + * Return how many images are held in the buffer + */ + readonly HowManyImagesInBuffer: number; + /** + * Return or set whether the feature of disk caching is enabled. + */ + IfAllowLocalCache: boolean; + /** + * Return the imageId of an image specified by the index. + * @param index The index of the image. + */ + IndexToImageID(index: number): number; + /** + * Return the index of an image specified by the imageId. + * @param imageId The imageId of the image. + */ + ImageIDToIndex(imageId: number): number; + /** + * Check whether the specified image is blank. + * @param index Specify the image. + */ + IsBlankImage(index: number): boolean; + /** + * [Deprecation] Detect whether a certain area on an image is blank. + * [Alternative] Use IsBlankImage or IsBlankImageExpress instead. + * @param index Specify the image. + * @param left The x-coordinate of the upper-left corner of the rectangle. + * @param top The y-coordinate of the upper-left corner of the rectangle. + * @param right The x-coordinate of the lower-right corner of the rectangle. + * @param bottom The y-coordinate of the lower-right corner of the rectangle. + * @param bFuzzyMatch Specify whether use fuzzy matching when detecting. + */ + IsBlankImageEx(index: number, left: number, top: number, right: number, bottom: number, bFuzzyMatch: boolean): boolean; + /** + * Check whether the specified image is blank. + * @param index Specify the image. + */ + IsBlankImageExpress(index: number): boolean; + /** + * Return or set how many images can be held in the buffer. + */ + MaxImagesInBuffer: number; + /** + * Change the position of an image in the buffer. + * @param from Specify the original position by index. + * @param to Specify the target position by index. + */ + MoveImage(from: number, to: number): boolean; + /** + * Remove all images in the buffer. + */ + RemoveAllImages(): boolean; + /** + * Remove the selected images in the buffer. + */ + RemoveAllSelectedImages(): boolean; + /** + * Remove the specified image. + * @param index Specify the image. + */ + RemoveImage(index: number): boolean; + /** + * Select all images and return the indices. + */ + SelectAllImages(): number[]; + /** + * [Deprecation] Return how many images are selected. + * [Alternative] Read the length of SelectedImagesIndices instead. + */ + readonly SelectedImagesCount: number; + /** + * Return the indices of the selected images. + */ + readonly SelectedImagesIndices: number[]; + /** + * Select the specified images. + * @param indices Specify one or multiple images. + */ + SelectImages(indices: number[]): boolean; + /** + * Specify a aspect ratio to be used when selecting a rectangle on an image. + */ + SelectionRectAspectRatio: number; + /** + * Set a default tag for newlay acquired images. + * @param tag Specifies the tag. + */ + SetDefaultTag(tag: string): boolean; + /** + * [Deprecation] You can use the method to select images programatically. + * [Alternative] Use SelectImages() or SelectAllImages() instead. + * @param indexOfIndices The index of an array that holds the indices of selected images. + * @param index The index of an image that you want to select. + */ + SetSelectedImageIndex(indexOfIndices: number, index: number): boolean; + /** + * Exchange the positions of two images. + * @param index1 Specify the 1st image. + * @param index2 Specify the 2nd image. + */ + SwitchImage(index1: number, index2: number): boolean; + /** + * Add a tag to specified images. + * @param indices Specifies images to be tagged. + * @param tag Specify the tag. + */ + TagImages(indices: number[], tag: string): boolean; +} diff --git a/types/dwt/WebTwain.Edit.d.ts b/types/dwt/WebTwain.Edit.d.ts new file mode 100644 index 0000000000..058b0d8b1d --- /dev/null +++ b/types/dwt/WebTwain.Edit.d.ts @@ -0,0 +1,434 @@ +import { DynamsoftEnums as Dynamsoft } from "./Dynamsoft.Enum"; +import { WebTwainBuffer } from "./WebTwain.Buffer"; + +export interface WebTwainEdit extends WebTwainBuffer { + /** + * Show the built-in image editor. If called without any arguments while the editor is open, it'll close the editor. + * @param divId Specify a div element to hold the editor. + * @param width Specify the width of the editor. + * @param height Specify the height of the editor. + */ + ShowImageEditor( + divId?: string, + width?: number, + height?: number + ): boolean; + /** + * Change the bit depth of the specified image. + * @param index Specify the image. + * @param bitDepth Specify the bit depth. + * @param highQuality Whether to keep high quality. + */ + ChangeBitDepth( + index: number, + bitDepth: number, + highQuality: boolean, + ): boolean; + /** + * Change the size of the specified image. + * @param index Specify the image. + * @param width Specify the new width. + * @param height Specify the new height. + * @param method Specify the algorithm for the change. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + ChangeImageSize( + index: number, + width: number, + height: number, + method: Dynamsoft.EnumDWT_InterpolationMethod | number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Change the DPI (dots per inch) of the specified image. + * @param index Specify the image. + * @param xResolution Specify the horizontal DPI. + * @param yResolution Specify the vertical DPI. + * @param resample Whether to resample the image. + * @param method Specify the algorithm for the change. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SetDPI( + index: number, + xResolution: number, + yResolution: number, + resample: boolean, + method: Dynamsoft.EnumDWT_InterpolationMethod | number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Convert the specified image to black & white. + * @param index Specify the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + ConvertToBW( + index: number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Convert the specified image to grayscale. + * @param index Specify the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + ConvertToGrayScale( + index: number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Invert the colour of the pixels on the specified image. + * @param index Specify the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + Invert( + index: number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Change the width of the specified image by adding a margin or removing part of the image. + * @param index Specify the image. + * @param width Specify the new width. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SetImageWidth( + index: number, + width: number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Flip the specified image. + * @param index Specify the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + Flip( + index: number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Mirror the specified image. + * @param index Specify the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + Mirror( + index: number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Rotate the specified image 90 degrees counterclockwise. + * @param index Specify the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + RotateLeft( + index: number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Rotate the specified image 90 degrees clockwise. + * @param index Specify the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + RotateRight( + index: number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Rotate the specified image by the specified angle. + * @param index Specify the image. + * @param angle Specify the angle. + * @param keepSize Whether to keep the original size. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + Rotate( + index: number, + angle: number, + keepSize: boolean, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Rotate the specified image by the specified angle. + * @param index Specify the image. + * @param angle Specify the angle. + * @param keepSize Whether to keep the original size. + * @param method Specify the algorithm for the change. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + RotateEx( + index: number, + angle: number, + keepSize: boolean, + method: Dynamsoft.EnumDWT_InterpolationMethod | number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Crop the specified image using the specified coordinates. + * @param index Specify the image. + * @param left Specify the rectangle (leftmost coordinate). + * @param top Specify the rectangle (topmost coordinate). + * @param right Specify the rectangle (rightmost coordinate). + * @param bottom Specify the rectangle (bottommost coordinate). + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + Crop( + index: number, + left: number, + top: number, + right: number, + bottom: number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Erase a rectangular area from the specified image. + * @param index Specify the image. + * @param left Specify the rectangle (leftmost coordinate). + * @param top Specify the rectangle (topmost coordinate). + * @param right Specify the rectangle (rightmost coordinate). + * @param bottom Specify the rectangle (bottommost coordinate). + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + Erase( + index: number, + left: number, + top: number, + right: number, + bottom: number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string + ) => void + ): void | boolean; + /** + * Copy the specified image to the clipboard of the operating system. + * @param index Specify the image. + */ + CopyToClipboard(index: number): boolean; + /** + * Cut the specified image to the clipboard of the operating system. + * @param index Specify the image. + */ + CutToClipboard(index: number): boolean; + /** + * Crop a rectangular area from the specified image to the clipboard of the operating system. + * @param index Specify the image. + * @param left Specify the rectangle (leftmost coordinate). + * @param top Specify the rectangle (topmost coordinate). + * @param right Specify the rectangle (rightmost coordinate). + * @param bottom Specify the rectangle (bottommost coordinate). + */ + CropToClipboard( + index: number, + left: number, + top: number, + right: number, + bottom: number + ): boolean; + /** + * Cut a rectangular area from the specified image to the clipboard of the operating system. + * @param index Specify the image. + * @param left Specify the rectangle (leftmost coordinate). + * @param top Specify the rectangle (topmost coordinate). + * @param right Specify the rectangle (rightmost coordinate). + * @param bottom Specify the rectangle (bottommost coordinate). + */ + CutFrameToClipboard( + index: number, + left: number, + top: number, + right: number, + bottom: number + ): boolean; + /** + * Return or set the fill colour for the empty area on an image that has been cut/cropped/erased. + */ + BackgroundFillColor: number; + /** + * [Deprecation] Add text on an image. + * [Alternative] Annotation feature to be added in a later version. + * @param index the index of the image that you want to add text to. + * @param x the x coordinate for the text. + * @param y the y coordinate for the text. + * @param text the content of the text that you want to add. + * @param txtColor the color for the text. + * @param backgroundColor the background color. + * @param backgroundRoundRadius ranging from 0 to 0.5. Please NOTE that MAC version does not support this parameter. + * @param backgroundOpacity specifies the opacity of the background of the added text, it ranges from 0 to 1.0. Please NOTE that Mac version only supports value 0 and 1 + */ + AddText( + index: number, + x: number, + y: number, + text: string, + txtColor: number, + backgroundColor: number, + backgroundRoundRadius: number, + backgroundOpacity: number + ): boolean; + /** + * [Deprecation] Create the font for adding text using the method AddText. + * [Alternative] Annotation feature to be added in a later version. + * @param height Specifies the desired height (in logical units) of the font. + * The absolute value of nHeight must not exceed 16,384 device units after it is converted. + * For all height comparisons, the font mapper looks for the largest font that does not + * exceed the requested size or the smallest font if all the fonts exceed the requested size. + * @param width Specifies the average width (in logical units) of characters in the font. + * If Width is 0, the aspect ratio of the device will be matched against the digitization + * aspect ratio of the available fonts to find the closest match, which is determined by the + * absolute value of the difference. + * @param escapement Specifies the angle (in 0.1-degree units) between the escapement vector + * and the x-axis of the display surface. The escapement vector is the line through the origins + * of the first and last characters on a line. The angle is measured counterclockwise from the x-axis. + * @param orientation Specifies the angle (in 0.1-degree units) between the baseline of a character + * and the x-axis.The angle is measured counterclockwise from the x-axis for coordinate systems + * in which the y-direction is down and clockwise from the x-axis for coordinate systems in which + * the y-direction is up. + * @param weight Specifies the font weight (in inked pixels per 1000). The described valuesare + * approximate; the actual appearance depends on the typeface. Some fonts haveonly FW_NORMAL, + * FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used. + * @param italic Specifies an italic font if set to TRUE. + * @param underline Specifies an underlined font if set to TRUE. + * @param strikeOut A strikeout font if set to TRUE. + * @param charSet Specifies the font's character set. The OEM character set is system-dependent. + * Fonts with other character sets may exist in the system. An application that uses a font with + * an unknown character set must not attempt to translate or interpret strings that are to be + * rendered with that font. + * @param outputPrecision Specifies the desired output precision. The output precision defines + * how closely the output must match the requested font's height, width, character orientation, + * escapement, and pitch. + * @param clipPrecision Specifies the desired clipping precision. The clipping precision defines + * how to clip characters that are partially outside the clipping region. + * @param quality Specifies the font's output quality, which defines how carefully the GDI must + * attempt to match the logical-font attributes to those of an actual physical font. + * @param pitchAndFamily The pitch and family of the font. + * @param faceName The typeface name, the length of this string must not exceed 32 characters, + * including the terminating null character. + */ + CreateTextFont( + height: number, + width: number, + escapement: number, + orientation: number, + weight: number, + italic: number, + underline: number, + strikeOut: number, + charSet: number, + outputPrecision: number, + clipPrecision: number, + quality: number, + pitchAndFamily: number, + faceName: string + ): boolean; + /** + * [Deprecation] Decorates image of a specified index in buffer with rectangles of transparent color. + * [Alternative] Annotation feature to be added in a later version. + * @param index specifies the index of image in buffer. The index is 0-based. + * @param left Specify the rectangle (leftmost coordinate). + * @param top Specify the rectangle (topmost coordinate). + * @param right Specify the rectangle (rightmost coordinate). + * @param bottom Specify the rectangle (bottommost coordinate). + * @param color Specifies the fill color of the rectangle. The byte-ordering of the RGB value is 0xBBGGRR. BB represents blue, GG represents green, RR represents red. + * @param fOpacity Specifies the opacity of the rectangle. The value represents opacity. 1.0 is 100% opaque and 0.0 is totally transparent. + */ + OverlayRectangle( + index: number, + left: number, + top: number, + right: number, + bottom: number, + color: number, + fOpacity: number + ): boolean; +} diff --git a/types/dwt/WebTwain.IO.d.ts b/types/dwt/WebTwain.IO.d.ts new file mode 100644 index 0000000000..5975d0560e --- /dev/null +++ b/types/dwt/WebTwain.IO.d.ts @@ -0,0 +1,951 @@ +import { DynamsoftEnums as Dynamsoft } from "./Dynamsoft.Enum"; +import { WebTwainUtil } from "./WebTwain.Util"; + +export interface WebTwainIO extends WebTwainUtil { + /** + * The password to connect to the FTP. + */ + FTPPassword: string; + /** + * The port to connect to the FTP. + */ + FTPPort: number; + /** + * The password to connect to the FTP. + */ + FTPUserName: string; + /** + * Return or set whether to use passive mode when connect to the FTP. + */ + IfPASVMode: boolean; + /** + * Return or set the field name for the uploaded file. + * By default, it's "RemoteFile". + */ + HttpFieldNameOfUploadedImage: string; + /** + * [Deprecation] Return or set the password used to log into the HTTP server. + */ + HTTPPassword: string; + /** + * [Deprecation] Return or set the user name used to log into the HTTP server. + */ + HTTPUserName: string; + /** + * Return or set the HTTP Port. + */ + HTTPPort: number; + /** + * Return or set whether to use SSL in HTTP requests. + */ + IfSSL: boolean; + /** + * Return the response string of the latest HTTP Post request. + */ + readonly HTTPPostResponseString: string; + /** + * Return or set whether to show open/save file dialog when saving images in the buffer or loading images from a local directory. + */ + IfShowFileDialog: boolean; + /** + * Return or set whether to show the progress of an operation with a button to cancel it. + */ + IfShowCancelDialogWhenImageTransfer: boolean; + /** + * Return or set whether to show the progressbar. + */ + IfShowProgressBar: boolean; + /** + * Return or set the quality for JPEG compression. + * The values range from 0 to 100. + */ + JPEGQuality: number; + /** + * Return or set whether to insert or append images when they are scanned/loaded. + */ + IfAppendImage: boolean; + /** + * Return or set whether to append to or replace an existing TIFF file with the same name. + */ + IfTiffMultiPage: boolean; + /** + * Return or set the compression type for TIFF files. + */ + TIFFCompressionType: Dynamsoft.EnumDWT_TIFFCompressionType | number; + /** + * Return or set the name of the person who creates the PDF document. + */ + PDFAuthor: string; + /** + * Return or set the compression type of PDF files. This is a runtime property. + */ + PDFCompressionType: Dynamsoft.EnumDWT_PDFCompressionType; + /** + * Return or set the date when the PDF document is created. + */ + PDFCreationDate: string; + /** + * Return or set the name of the application that created the original document, if the PDF document is converted from another form. + */ + PDFCreator: string; + /** + * Return or set the keywords associated with the PDF document. + */ + PDFKeywords: string; + /** + * Return or set the date when the PDF document is last modified. + */ + PDFModifiedDate: string; + /** + * Return or set the name of the application that converted the PDF document from its native. + */ + PDFProducer: string; + /** + * Return or set the subject of the PDF document. + */ + PDFSubject: string; + /** + * Return or set the title of the PDF document. + */ + PDFTitle: string; + /** + * Return or set the value of the PDF version. + */ + PDFVersion: string; + /** + * Clear all the custom fields from the HTTP Post Form. + */ + ClearAllHTTPFormField(): boolean; + /** + * Clear the content of all custom tiff tags. + */ + ClearTiffCustomTag(): boolean; + /** + * Convert the specified images to a base64 string. + * @param indices Specify one or multiple images. + * @param type The file type. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument result The resulting base64 string. + * @argument indices The indices of the converted images. + * @argument type The file type. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + ConvertToBase64( + indices: number[], + type: Dynamsoft.EnumDWT_ImageType | number, + successCallback: ( + result: Base64Result, + indices: number[], + type: number) => void, + failureCallBack: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Convert the specified images to a blob. + * @param indices Specify one or multiple images. + * @param type The file type. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument result The resulting blob. + * @argument indices The indices of the converted images. + * @argument type The file type. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + ConvertToBlob( + indices: number[], + type: Dynamsoft.EnumDWT_ImageType | number, + successCallback: ( + result: Blob, + indices: number[], + type: number) => void, + failureCallBack: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Download the specified file via FTP + * @param host The FTP Host. + * @param path Specify the file to download. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + FTPDownload( + host: string, + path: string, + successCallback: () => void, + failureCallBack: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Download the specified file via FTP. + * @param host The FTP Host. + * @param path Specify the file to download. + * @param type The format of the file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + FTPDownloadEx( + host: string, + path: string, + type: Dynamsoft.EnumDWT_ImageType | number, + successCallback: () => void, + failureCallBack: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Upload the specified image via FTP. + * @param host The FTP Host. + * @param index Specify the image. + * @param path The path to save the file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + FTPUpload( + host: string, + index: number, + path: string, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Upload the specified image via FTP. + * @param host The FTP Host. + * @param index Specify the image. + * @param path The path to save the file. + * @param type The format of the file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + FTPUploadEx( + host: string, + index: number, + path: string, + type: Dynamsoft.EnumDWT_ImageType | number, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Upload all images as a multi-page TIFF via FTP. + * @param host The FTP Host. + * @param path Specify the path to save the file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + FTPUploadAllAsMultiPageTIFF( + host: string, + path: string, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Upload all images as a multi-page PDF via FTP. + * @param host The FTP Host. + * @param path Specify the path to save the file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + FTPUploadAllAsPDF( + host: string, + path: string, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Upload selected images as a multi-page PDF via FTP. + * @param host The FTP Host. + * @param path Specify the path to save the file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + FTPUploadAsMultiPagePDF( + host: string, + path: string, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Upload selected images as a multi-page TIFF via FTP. + * @param host The FTP Host. + * @param path Specify the path to save the file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + FTPUploadAsMultiPageTIFF( + host: string, + path: string, + type: Dynamsoft.EnumDWT_ImageType | number, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Download the specified file via a HTTP Get request. + * @param host The HTTP Host. + * @param path Specify the path of the file to download. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + HTTPDownload( + host: string, + path: string, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Download the specified file via a HTTP Get request. + * @param host The HTTP Host. + * @param path Specify the path of the file to download. + * @param type The format of the file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + HTTPDownloadEx( + host: string, + path: string, + type: Dynamsoft.EnumDWT_ImageType | number, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Download the specified file via a HTTP Post request. + * @param host The HTTP Host. + * @param path Specify the path of the file to download. + * @param type The format of the file. + * @param onEmptyResponse A callback function that is executed if the response is empty. + * @param onServerReturnedSomething A callback function that is executed if the response is not empty. + * @argument errorCode The error code. + * @argument errorString The error string. + * @argument response The response string. + */ + HTTPDownloadThroughPost( + host: string, + path: string, + type: Dynamsoft.EnumDWT_ImageType | number, + onEmptyResponse: () => void, + onServerReturnedSomething: ( + errorCode: number, + errorString: string, + response: string) => void + ): void; + /** + * Download the specified file via a HTTP Get request. + * @param host The HTTP Host. + * @param path Specify the path of the file to download. + * @param localPath Specify where to save the file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + HTTPDownloadDirectly( + host: string, + path: string, + localPath: string, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Upload the specified image(s) via a HTTP Post. + * @param URL The server-side script to receive the post. + * @param indices Specify the image(s). + * @param type The format of the file. + * @param dataFormat Whether to upload the file as binary or a base64 string. + * @param fileName The file name. + * @param onEmptyResponse A callback function that is executed if the response is empty. + * @param onServerReturnedSomething A callback function that is executed if the response is not empty. + * @argument errorCode The error code. + * @argument errorString The error string. + * @argument response The response string. + */ + HTTPUpload( + URL: string, + indices: number[], + type: Dynamsoft.EnumDWT_ImageType | number, + dataFormat: Dynamsoft.EnumDWT_UploadDataFormat | number, + fileName: string, + onEmptyResponse: () => void, + onServerReturnedSomething: ( + errorCode: number, + errorString: string, + response: string) => void + ): void; + HTTPUpload( + URL: string, + indices: number[], + type: Dynamsoft.EnumDWT_ImageType | number, + dataFormat: Dynamsoft.EnumDWT_UploadDataFormat | number, + onEmptyResponse: () => void, + onServerReturnedSomething: ( + errorCode: number, + errorString: string, + response: string) => void + ): void; + HTTPUpload( + URL: string, + onEmptyResponse: () => void, + onServerReturnedSomething: ( + errorCode: number, + errorString: string, + response: string) => void + ): void; + /** + * Upload the specified image via a HTTP Put request. + * @param host The HTTP Host. + * @param index Specify the image. + * @param path Specify the path to put the file. + * @param type The format of the file. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + HTTPUploadThroughPutEx( + host: string, + index: number, + path: string, + type: Dynamsoft.EnumDWT_ImageType | number, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Upload the specified image via a HTTP Post request. + * @param host The HTTP Host. + * @param index Specify the image. + * @param target The target wherethe request is sent. + * @param type The format of the file. + * @param fileName The file name. + * @param onEmptyResponse A callback function that is executed if the response is empty. + * @param onServerReturnedSomething A callback function that is executed if the response is not empty. + * @argument errorCode The error code. + * @argument errorString The error string. + * @argument response The response string. + */ + HTTPUploadThroughPost( + host: string, + index: number, + target: string, + fileName: string, + onEmptyResponse: () => void, + onServerReturnedSomething: ( + errorCode: number, + errorString: string, + response: string) => void + ): void; + /** + * Upload the specified image via a HTTP Post request. + * @param host The HTTP Host. + * @param index Specify the image. + * @param target The target wherethe request is sent. + * @param fileName The file name. + * @param type The format of the file. + * @param onEmptyResponse A callback function that is executed if the response is empty. + * @param onServerReturnedSomething A callback function that is executed if the response is not empty. + * @argument errorCode The error code. + * @argument errorString The error string. + * @argument response The response string. + */ + HTTPUploadThroughPostEx( + host: string, + index: number, + target: string, + fileName: string, + type: Dynamsoft.EnumDWT_ImageType | number, + onEmptyResponse: () => void, + onServerReturnedSomething: ( + errorCode: number, + errorString: string, + response: string) => void + ): void; + /** + * Upload all images in the buffer as a TIFF file via a HTTP Post request. + * @param host The HTTP Host. + * @param target The target wherethe request is sent. + * @param fileName The file name. + * @param onEmptyResponse A callback function that is executed if the response is empty. + * @param onServerReturnedSomething A callback function that is executed if the response is not empty. + * @argument errorCode The error code. + * @argument errorString The error string. + * @argument response The response string. + */ + HTTPUploadAllThroughPostAsMultiPageTIFF( + host: string, + target: string, + fileName: string, + onEmptyResponse: () => void, + onServerReturnedSomething: ( + errorCode: number, + errorString: string, + response: string) => void + ): void; + /** + * Upload all images in the buffer as a PDF file via a HTTP Post request. + * @param host The HTTP Host. + * @param target The target wherethe request is sent. + * @param fileName The file name. + * @param onEmptyResponse A callback function that is executed if the response is empty. + * @param onServerReturnedSomething A callback function that is executed if the response is not empty. + * @argument errorCode The error code. + * @argument errorString The error string. + * @argument response The response string. + */ + HTTPUploadAllThroughPostAsPDF( + host: string, + target: string, + fileName: string, + onEmptyResponse: () => void, + onServerReturnedSomething: ( + errorCode: number, + errorString: string, + response: string) => void + ): void; + /** + * Upload all selected images in the buffer as a PDF file via a HTTP Post request. + * @param host The HTTP Host. + * @param target The target wherethe request is sent. + * @param fileName The file name. + * @param onEmptyResponse A callback function that is executed if the response is empty. + * @param onServerReturnedSomething A callback function that is executed if the response is not empty. + * @argument errorCode The error code. + * @argument errorString The error string. + * @argument response The response string. + */ + HTTPUploadThroughPostAsMultiPagePDF( + host: string, + target: string, + fileName: string, + onEmptyResponse: () => void, + onServerReturnedSomething: ( + errorCode: number, + errorString: string, + response: string) => void + ): void; + /** + * Upload all selected images in the buffer as a TIFF file via a HTTP Post request. + * @param host The HTTP Host. + * @param target The target wherethe request is sent. + * @param fileName The file name. + * @param onEmptyResponse A callback function that is executed if the response is empty. + * @param onServerReturnedSomething A callback function that is executed if the response is not empty. + * @argument errorCode The error code. + * @argument errorString The error string. + * @argument response The response string. + */ + HTTPUploadThroughPostAsMultiPageTIFF( + host: string, + target: string, + fileName: string, + onEmptyResponse: () => void, + onServerReturnedSomething: ( + errorCode: number, + errorString: string, + response: string) => void + ): void; + /** + * Upload the specified file via a HTTP Post request. + * @param host The HTTP Host. + * @param path Specify the file to upload. + * @param target The target wherethe request is sent. + * @param fileName The file name. + * @param onEmptyResponse A callback function that is executed if the response is empty. + * @param onServerReturnedSomething A callback function that is executed if the response is not empty. + * @argument errorCode The error code. + * @argument errorString The error string. + * @argument response The response string. + */ + HTTPUploadThroughPostDirectly( + host: string, + path: string, + target: string, + fileName: string, + onEmptyResponse: () => void, + onServerReturnedSomething: ( + errorCode: number, + errorString: string, + response: string) => void + ): void; + /** + * Load image(s) specified by its absolute path. + * @param fileName The path of the image to load. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + LoadImage( + fileName: string, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string) => void + ): void | boolean; + /** + * Load image(s) specified by its absolute path. + * @param fileName The path of the image to load. + * @param type The format of the image. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + LoadImageEx( + fileName: string, + type: Dynamsoft.EnumDWT_ImageType | number, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string) => void + ): void | boolean; + /** + * Load image(s) from a base64 string. + * @param imageData The image data which is a base64 string without the data URI scheme. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + LoadImageFromBase64Binary( + imageData: string, + imageType: Dynamsoft.EnumDWT_ImageType, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string) => void + ): void | boolean; + /** + * Load image(s) from a binary object (Blob | ArrayBuffer). + * @param imageData The image data. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + LoadImageFromBinary( + imageData: Blob | ArrayBuffer, + successCallback: () => void, + failureCallback: ( + errorCode: number, + errorString: string) => void + ): void; + /** + * Load an image from the system clipboard. The image must be in DIB format. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + LoadDibFromClipboard( + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string) => void + ): void | boolean; + /** + * [Deprecation] Return or set how many threads can be used when you upload files through POST. + */ + MaxInternetTransferThreads: number; + /** + * Return or set the maximum allowed size of a file to upload (in bytes). + */ + MaxUploadImageSize: number; + /** + * Export all image data in the buffer to a new browser window and use the browser's built-in print feature to print the image(s). + * @param useOSPrintWindow Whether to use the print feature of the operating system instead. + */ + Print(useOSPrintWindow?: boolean): boolean; + /** + * Save the specified image as a BMP file. + * @param fileName The name to save to. + * @param index The index which specifies the image to save. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SaveAsBMP( + fileName: string, + index: number, + successCallback?: () => void, + failureCallback?: (errorCode: number, errorString: string) => void + ): void | boolean; + /** + * Save the specified image as a JPEG file. + * @param fileName The name to save to. + * @param index The index which specifies the image to save. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SaveAsJPEG( + fileName: string, + index: number, + successCallback?: () => void, + failureCallback?: (errorCode: number, errorString: string) => void + ): void | boolean; + /** + * Save the specified image as a PDF file. + * @param fileName The name to save to. + * @param index The index which specifies the image to save. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SaveAsPDF( + fileName: string, + index: number, + successCallback?: () => void, + failureCallback?: (errorCode: number, errorString: string) => void + ): void | boolean; + /** + * Save the specified image as a PNG file. + * @param fileName The name to save to. + * @param index The index which specifies the image to save. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SaveAsPNG( + fileName: string, + index: number, + successCallback?: () => void, + failureCallback?: (errorCode: number, errorString: string) => void + ): void | boolean; + /** + * Save the specified image as a TIFF file. + * @param fileName The name to save to. + * @param index The index which specifies the image to save. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SaveAsTIFF( + fileName: string, + index: number, + successCallback?: () => void, + failureCallback?: (errorCode: number, errorString: string) => void + ): void | boolean; + /** + * Saves all the images in buffer as a multi-page TIFF file. + * @param fileName The name to save to. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SaveAllAsMultiPageTIFF( + fileName: string, + successCallback?: () => void, + failureCallback?: (errorCode: number, errorString: string) => void + ): void | boolean; + /** + * Saves all the images in buffer as a multi-page PDF file. + * @param fileName The name to save to. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SaveAllAsPDF( + fileName: string, + successCallback?: () => void, + failureCallback?: (errorCode: number, errorString: string) => void + ): void | boolean; + /** + * Saves all selected images in buffer as a multi-page PDF file. + * @param fileName The name to save to. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SaveSelectedImagesAsMultiPagePDF( + fileName: string, + successCallback?: () => void, + failureCallback?: (errorCode: number, errorString: string) => void + ): void | boolean; + /** + * Saves all selected images in buffer as a multi-page TIFF file. + * @param fileName The name to save to. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SaveSelectedImagesAsMultiPageTIFF( + fileName: string, + successCallback?: () => void, + failureCallback?: ( + errorCode: number, + errorString: string) => void + ): void | boolean; + /** + * [Deprecation] Return an index from the selected indices array. Read SelectedImagesIndices instead. + * [Alternative] Read SelectedImagesIndices instead. + * @param indexOfIndices Specify the index of the specified image. + */ + SaveSelectedImagesToBase64Binary(indexOfIndices: number): number; + /** + * [Deprecation] Saves the selected images in the buffer to a base64 string. + * [Alternative] Use ConvertToBase64 instead. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument result The resulting array of strings. + * @argument errorCode The error code. + * @argument errorString The error string. + */ + SaveSelectedImagesToBase64Binary( + successCallback?: (result: string[]) => void, + failureCallback?: (errorCode: number, errorString: string) => void + ): string | boolean; + /** + * Add a custom field to the HTTP Post Form. + * @param name The name of the field. + * @param value The value of the field. + */ + SetHTTPFormField( + name: string, + value: string + ): boolean; + /** + * Add a binary file to the HTTP Post Form. + * @param name The name of the field. + * @param content The content of the file. + * @param fileName The name of the file. + */ + SetHTTPFormField( + name: string, + content: Blob, + fileName?: string + ): boolean; + /** + * Add a custom header to the HTTP Post Form. + * @param name The name of the field. + * @param value The value of the field. + */ + SetHTTPHeader( + name: string, + value: string + ): boolean; + /** + * Clear the content of all custom tiff tags. + * @param id The id of the custom tag. + * @param content The content of the tag. + * @param useBase64Encoding Whether the content is encoded. + */ + SetTiffCustomTag( + id: number, + content: string, + useBase64Encoding: boolean + ): boolean; + /** + * Set the segmentation threshold and segment size. + * @param threshold Specify the threshold (in MB). + * @param size Specify the segment size (in KB). + */ + SetUploadSegment( + threshold: number, + size: number + ): boolean; + /** + * Show the system's save-file dialog or open-file dialog. + * @param isSave Whether to show a save-file dialog or an open-file dialog + * @param filter The filter pattern like "JPG | *.jpg". + * @param filterIndex The order of the filter. Normally, just put 0. + * @param defaultExtension Extension to be appended to the file name. Only valid in a save-file dialog + * @param initialDirectory The initial directory that the dialog opens. + * @param allowMultiSelect Whether or not multiple files can be selected at the same time. Only valid in an open-file dialog. + * @param showOverwritePrompt Whether or not a prompt shows up when saving a file may overwrite an existing file. + * @param flag If set to 0, bAllowMultiSelect and bShowOverwritePrompt will be effective. Otherwise, these two parameters are ignored. + */ + ShowFileDialog( + isSave: boolean, + filter: string, + filterIndex: number, + defaultExtension: string, + initialDirectory: string, + allowMultiSelect: boolean, + showOverwritePrompt: boolean, + flag: number + ): boolean; + /** + * [Deprecation] Set a cookie string into the Http Header to be used when uploading scanned images through POST. + * @param cookie The cookie. + */ + SetCookie(cookie: string): boolean; +} +export interface Base64Result { + /** + * Return the length of the result string. + */ + getLength(): number; + /** + * Return part of the string. + * @param offset The starting position. + * @param length The length of the expected string. + */ + getData(offset: number, length: number): string; + /** + * Return the MD5 value of the result. + */ + getMD5(): string; +} +/** + * Details for each license + */ +export interface LicenseDetailItem { + readonly Browser: string; + readonly EnumLicenseType: string; + readonly ExpireDate: string; + readonly LicenseType: string; + readonly OS: string; + readonly Trial: string; + readonly Version: string; +} diff --git a/types/dwt/WebTwain.Util.d.ts b/types/dwt/WebTwain.Util.d.ts new file mode 100644 index 0000000000..12af019b4d --- /dev/null +++ b/types/dwt/WebTwain.Util.d.ts @@ -0,0 +1,78 @@ +import { DynamsoftEnums as Dynamsoft } from "./Dynamsoft.Enum"; + +export interface WebTwainUtil { + /** + * Return the error code. + */ + readonly ErrorCode: number; + /** + * Return the error string. + */ + readonly ErrorString: string; + /** + * Return or set the log level for debugging. + */ + LogLevel: number; + /** + * Manufacturer in the identity string of the Dynamic Web TWAIN library. + */ + readonly Manufacturer: string; + /** + * ProductFamily in the identity string of the Dynamic Web TWAIN library. + */ + readonly ProductFamily: string; + /** + * Return or set the ProductKey. + */ + ProductKey: string; + /** + * ProductName in the identity string of the Dynamic Web TWAIN library. + */ + readonly ProductName: string; + /** + * Generate a URL to be used by a FileUpoader instance to fetch the data to upload. + * @param indices Specify the images to upload. + * @param type Specify the file type. + * @param successCallback A callback function that is executed if the request succeeds. + * @param failureCallback A callback function that is executed if the request fails. + * @argument resultURL The generated URL. + * @argument indices The indices of the images. + * @argument type The file type. + */ + GenerateURLForUploadData( + indices: number[], + type: Dynamsoft.EnumDWT_ImageType | number, + successCallback: ( + resultURL: string, + indices: number[], + type: Dynamsoft.EnumDWT_ImageType | number + ) => void, + failureCallback: ( + errorCode: number, + errorString: string + ) => void + ): void; + /** + * Specify an event listener for the specified built-in event. + * @param name Specify the event + * @param callback The event listener + */ + RegisterEvent(name: string, callback: (...arg: any[]) => void): boolean; + /** + * Set the language for the authorization dialogs. + * @param language Specify the language. + */ + SetLanguage( + language: Dynamsoft.EnumDWT_Language | number + ): boolean; + /** + * Remove an event listener from the specified built-in event. + * @param name Specify the event + * @param callback The event listener + */ + UnregisterEvent(name: string, callback: () => void): boolean; + /** + * VersionInfo in the identity string of the Dynamic Web TWAIN library. + */ + readonly VersionInfo: string; +} diff --git a/types/dwt/WebTwain.Viewer.d.ts b/types/dwt/WebTwain.Viewer.d.ts new file mode 100644 index 0000000000..c9b6262e06 --- /dev/null +++ b/types/dwt/WebTwain.Viewer.d.ts @@ -0,0 +1,571 @@ +import { WebTwainAcquire } from "./WebTwain.Acquire"; + +export interface WebTwainViewer extends WebTwainAcquire { + /** + * Create a Dynamsoft Viewer instance and bind it to the WebTwain instance. + * @param elementId Specify an HTML element to create the viewer. + * @param config Configuration of the viewer. + */ + BindViewer( + elementId: string, + config?: BasicViewerConfig + ): boolean; + + /** + * Update the viewer with the new configuration. + * @param config Configuration of the viewer. + */ + UpdateViewer(config: BasicViewerConfig): boolean; + + /** + * Unbind and destroy the viewer. + */ + UnbindViewer(): boolean; + /** + * Return or set the background colour of the viewer. + */ + BackgroundColor: number; + /** + * Return or set the border colour for selected image(s). + */ + SelectionImageBorderColor: number; + /** + * Return or set how the image is fit in the viewer. + */ + FitWindowType: number; + /** + * Return or set the border colour for selected image(s). + */ + IfFitWindow: boolean; + /** + * Return or set the height of the viewer. + */ + Height: number | string; + /** + * Return or set the width of the viewer. + */ + Width: number | string; + /** + * Return the horizontal coordinate of the mouse. + */ + readonly MouseX: number; + /** + * Return the vertical coordinate of the mouse. + */ + readonly MouseY: number; + /** + * Return or set the shape of the cursor. + */ + MouseShape: boolean; + /** + * Return or set whether the thumbnails view scrolls when new images come in. + */ + IfAutoScroll: boolean; + /** + * Return or set whether to show the page numbers. + */ + ShowPageNumber: boolean; + /** + * Return or set the margin between images (in pixels). + */ + ImageMargin: number; + /** + * Return or set the zoom factor. + */ + Zoom: number; + Viewer: DynamsoftViewer; +} +export interface DynamsoftViewer { + /** + * Remove a built-in event handler. + * @param eventName Specify the event. + */ + off(eventName: string): boolean; + /** + * Set the view mode of the viewer. + * @param columns Specify the number of images per row. + * @param rows Specify the number of images per column. + */ + setViewMode( + columns: number, + rows: number + ): boolean; + /** + * Select a rectangular area on the specified image. + * @param left Specify the rectangle (leftmost coordinate). + * @param top Specify the rectangle (topmost coordinate). + * @param width Specify the rectangle (the width). + * @param height Specify the rectangle (the height). + */ + setSelectedImageArea( + left: number, + top: number, + width: number, + height: number + ): boolean; + /** + * Set the CSS class name of the specified button. + * @param name Specify the button. + * @param className Specify the CSS class name. + */ + setButtonClass( + name: string, + className: string + ): boolean; + /** + * The mode of operation. Allowed values are 0(no selection, cursor is pointer), 1 (seleciton, cursor is crosshair) + */ + operationMode: number; + /** + * Return or set whether to show the footer of the viewer. + */ + showFooter: boolean; + /** + * Return or set whether to show the header of the viewer. + */ + showHeader: boolean; + /** + * Zoom in by 6/5. + */ + zoomIn(): boolean; + /** + * Zoom out by 5/6. + */ + zoomOut(): boolean; + /** + * Bind a custom element to the viewer to add extra features. + * @param Id Specify the element by its Id. + * @param priority Specify the importance of the element. + * @param fullScreen Whether to show the element full-screen. + */ + bindCustomElement( + Id: string, + priority: number, + fullScreen: boolean + ): boolean; + /** + * Unbind a custom element from the viewer. + * @param Id Specify the element by its Id. + */ + unBindCustomElement(Id: string): boolean; + /** + * Show the custom element. + * @param name Specify the element by its Id. + */ + showCustomElement(Id: string): boolean; + /** + * Hide the custom element. + * @param name Specify the element by its Id. + */ + hideCustomElement(Id: string): boolean; + /** + * Show or hide the custom element. + * @param name Specify the element by its Id. + */ + toggleCustomElement(Id: string): boolean; + /** + * Whether to only show the thumbnails view. + */ + bOnlyShowThumbnailsView: boolean; + /** + * Set the shape of the cursor over the thumbnails view. + */ + cursorOverThumbnailsView: string; + /** + * Update the viewer with detailed configuration. + * @param config Specify the detailed configuration. + */ + updateUISettings(config: ViewerConfig): boolean; +} +export interface BasicViewerConfig { + /** + * Specify the size of the viewer. + */ + Height: number | string; + Width: number | string; + /** + * Set up the content view. + */ + view: ContentView; +} +export interface ContentView { + /** + * Whether to show the content view or not. + * If set to false, then only thumbnails view is shown. + */ + bShow: boolean; + /** + * Specify the width of the major content view. + */ + Width: number | string; +} +export interface ViewerConfig { + /** + * Specify which components are shown. + */ + component?: { + header?: boolean; + topMenu?: boolean; + asideMenu?: boolean; + bottomMenu?: boolean; + }; + group?: { + global?: { + visibility?: boolean, + location?: string, // Example: 'header' + sequence?: number + }, + tabName?: { + visibility?: boolean, + location?: string, // Example: 'header' + sequence?: number + }, + viewerCorner?: { + visibility?: boolean, + location?: string, // Example: 'header' + sequence?: number + }, + viewMenuBlock?: { + visibility?: boolean, + location?: string, // Example: 'topMenu' + sequence?: number + }, + viewMenu?: { + visibility?: boolean, + location?: string, // Example: 'topMenu' + sequence?: number + }, + topMenuRight?: { + visibility?: boolean, + location?: string, // Example: 'topMenu' + sequence?: number + }, + pager?: { + visibility?: boolean, + location?: string, // Example: 'bottomMenu' + sequence?: number + }, + viewChange?: { + visibility?: boolean, + location?: string, // Example: 'header' + sequence?: number + } + }; + buttons?: { + // loadImage button + loadImage?: { + visibility?: boolean, + location?: string, // Example: 'viewerCorner' + iconClass?: string, // Example: 'icon-file' + sequence?: number, + onButtonClick?: string // Example: onLoadImage' + }, + currentTab?: { + visibility?: boolean, + location?: string, // Example: 'tabName', + sequence?: number + }, + // panelChange button (thumbnail, dir tree, tags) + panelChange?: { + visibility?: boolean, + location?: string, // Example: 'global' + iconClass?: string, // Example: 'icon-list' + sequence?: number, + onButtonClick?: string // Example: onPanelChange' + }, + // readDirection change button (vertical ,horizontal) + readDirection?: { + visibility?: boolean, + location?: string, // Example: 'global' + iconClass?: string, // Example: 'icon-readType' + sequence?: number, + onButtonClick?: string // Example: onReadDirection' + }, + // readDirection change button (vertical ,horizontal) + blank1?: { + visibility?: boolean, + location?: string, // Example: 'global' + sequence?: number + }, + // flip button + flip?: { + visibility?: boolean, + location?: string, // Example: 'viewMenu' + iconClass?: string, // Example: 'icon-flip' + sequence?: number, + onButtonClick?: string // Example: onFlip' + }, + // mirror button + mirror?: { + visibility?: boolean, + location?: string, // Example: 'viewMenu' + iconClass?: string, // Example: 'icon-mirror' + sequence?: number, + onButtonClick?: string // Example: onMirror' + }, + // rotate button + rotate?: { + visibility?: boolean, + location?: string, // Example: 'viewMenu' + iconClass?: string, // Example: 'icon-rotateLeft' + sequence?: number, + onButtonClick?: string // Example: onRotate' + }, + // rotateAll button + rotateAll?: { + visibility?: boolean, + location?: string, // Example: 'viewMenu' + iconClass?: string, // Example: 'icon-rotateAll' + sequence?: number, + onButtonClick?: string // Example: onRotateAll' + }, + // crop button + crop?: { + visibility?: boolean, + location?: string, // Example: 'viewMenu' + iconClass?: string, // Example: 'icon-crop' + sequence?: 5, + onButtonClick?: string // Example: onCrop' + }, + // wipe button + wipe?: { + visibility?: boolean, + location?: string, // Example: 'viewMenu' + iconClass?: string, // Example: 'icon-wipe' + sequence?: 6, + onButtonClick?: string // Example: onWipe' + }, + // undo button + undo?: { + visibility?: boolean, + location?: string, // Example: 'viewMenu' + iconClass?: string, // Example: 'icon-undo' + sequence?: 7, + onButtonClick?: string // Example: onUndo' + }, + // redo button + redo?: { + visibility?: boolean, + location?: string, // Example: 'viewMenu' + iconClass?: string, // Example: 'icon-redo' + sequence?: 8, + onButtonClick?: string // Example: onRedo' + }, + // magnifyCanvas button + zoomIn?: { + visibility?: boolean, + location?: string, // Example: 'viewMenu' + iconClass?: string, // Example: 'icon-magnifyImage' + sequence?: 9, + onButtonClick?: string // Example: onZoomIn' + }, + // shrinkCanvas button + zoomOut?: { + visibility?: boolean, + location?: string, // Example: 'viewMenu' + iconClass?: string, // Example: 'icon-shrinkImage' + sequence?: 10, + onButtonClick?: string // Example: onZoomOut' + }, + // reset button + reset?: { + visibility?: boolean, + location?: string, // Example: 'viewMenu' + iconClass?: string, // Example: 'icon-reset' + sequence?: 11, + onButtonClick?: string // Example: onReset' + }, + // remove button + remove?: { + visibility?: boolean, + location?: string, // Example: 'topMenuRight' + iconClass?: string, // Example: 'icon-delete' + sequence?: number, + onButtonClick?: string // Example: onRemove' + }, + // print button + print?: { + visibility?: boolean, + location?: string, // Example: 'topMenuRight' + iconClass?: string, // Example: 'icon-print' + sequence?: number, + onButtonClick?: string // Example: onPrint' + }, + // save button + save?: { + visibility?: boolean, + location?: string, // Example: 'topMenuRight' + iconClass?: string, // Example: 'icon-save' + sequence?: number, + onButtonClick?: string // Example: onSave' + }, + // firstPage button + firstPage?: { + visibility?: boolean, + location?: string, // Example: 'pager' + iconClass?: string, // Example: 'icon-pageStart' + sequence?: number, + onButtonClick?: string // Example: onFirstPage' + }, + // previousPage button + previousPage?: { + visibility?: boolean, + location?: string, // Example: 'pager' + iconClass?: string, // Example: 'icon-pagePre' + sequence?: number, + onButtonClick?: string // Example: onPreviousPage' + }, + // pagination show + pagination?: { + visibility?: boolean, + location?: string, // Example: 'pager' + }, + // nextPage button + nextPage?: { + visibility?: boolean, + location?: string, // Example: 'pager' + iconClass?: string, // Example: 'icon-pageNext' + sequence?: number, + onButtonClick?: string // Example: onNextPage' + }, + // lastPage button + lastPage?: { + visibility?: boolean, + location?: string, // Example: 'pager' + iconClass?: string, // Example: 'icon-pageEnd' + sequence?: 5, + onButtonClick?: string // Example: onLastPage' + }, + // autoFit button + autoFit?: { + visibility?: boolean, + location?: string, // Example: 'viewChange' + iconClass?: string, // Example: 'icon-autoFit' + sequence?: number, + onButtonClick?: string // Example: onAutoFit' + }, + // fitHeight button + fitHeight?: { + visibility?: boolean, + location?: string, // Example: 'viewChange' + iconClass?: string, // Example: 'icon-fitHeight' + sequence?: number, + onButtonClick?: string // Example: onFitHeight' + }, + // fitWidth button + fitWidth?: { + visibility?: boolean, + location?: string, // Example: 'viewChange' + iconClass?: string, // Example: 'icon-fitWidth' + sequence?: number, + onButtonClick?: string // Example: onFitWidth' + }, + // fullScreenToWebPage button + fullPage?: { + visibility?: boolean, + location?: string, // Example: 'viewChange' + iconClass?: string, // Example: 'icon-fullWeb' + sequence?: number, + onButtonClick?: string // Example: onFullPage' + }, + // fullScreenToDevice + fullScreen?: { + visibility?: boolean, + location?: string, // Example: 'viewChange' + iconClass?: string, // Example: 'icon-fullDevice' + sequence?: number, + onButtonClick?: string // Example: onFullScreen' + } + }; + tipsConfig?: { + loadImage?: string, // Example 'loadImage' + panelChange?: string, // Example 'panelChange' + readDirection?: string, // Example 'readDirection' + flip?: string, // Example 'flip' + mirror?: string, // Example 'mirror' + rotate?: string, // Example 'rotate' + rotateAll?: string, // Example 'rotateAll' + crop?: string, // Example 'crop' + wipe?: string, // Example 'wipe' + undo?: string, // Example 'undo' + redo?: string, // Example 'redo' + zoomIn?: string, // Example 'zoomIn' + zoomOut?: string, // Example 'zoomOut' + reset?: string, // Example 'reset' + remove?: string, // Example 'remove' + print?: string, // Example 'print' + save?: string, // Example 'save' + firstPage?: string, // Example 'firstPage' + previousPage?: string, // Example 'previousPage' + pagination?: string, // Example 'pagination' + nextPage?: string, // Example 'nextPage' + lastPage?: string, // Example 'lastPage' + autoFit?: string, // Example 'fitWindow' + fitHeight?: string, // Example 'fitHeight' + fitWidth?: string, // Example 'fitWidth' + fullPage?: string, // Example 'fullPage' + fullScreen?: string, // Example 'fullScreen' + }; + content?: { + visibility?: boolean, + besides?: { + visibility?: boolean, + sequence?: number + }, + viewPort?: { + visibility?: boolean, + sequence?: number + }, + allImage?: { + visibility?: boolean, + displayName?: string // Example: 'All Images' + } + }; + thumbnail?: { + visibility?: boolean, + iconClass?: string // Example: 'icon-thumbnail' + selectedBorderColor?: string // Example: 'red' + selectedBackgroundColor?: string // Example: 'rgb(127, 133, 251)' + imageBackgroundColor?: string // Example: 'transparent' + imageBorderColor?: string // Example: 'gray' + hoverBackgroundColor?: string // Example: '#c4faf8' + hoverBorderColor?: string // Example: 'yellow' + blockBackgroundColor?: string // Example: 'pink' + backgroundColor?: string // Example: 'rgba(67, 66, 70, 1)' + imageSpace?: number, // Example: 10 + showPageNumber?: boolean, + showThumbnailControl?: boolean, + mouseShape?: string // Example: 'pointer' + }; + tree?: { + visibility?: boolean, + iconClass?: string // Example: 'icon-tree', + selectedColor?: string // Example: '#0000ff', + goToThumbnail?: boolean + }; + tag?: { + visibility?: boolean, + iconClass?: string // Example: 'icon-tags', + selectedColor?: string // Example: '#0000ff', + goToThumbnail?: boolean, + displayMode?: string // Example: ''// icon or text + }; + cropStyle?: { + ratios?: any, // Example [[1, 1], [3, 2], [4, 3], [5, 4], [7, 5], [16, 9]], + cropMask?: boolean, + cropBar?: boolean + }; + buttonResize?: { + ifResize?: boolean, + maxSize?: number, // Example: 26, + minSize?: number, // Example: 14 + }; + skinColor?: { + topMenuBackground?: string // Example: '#000000' + asideBackground?: string // Example: '#ffffff' + canvasBackground?: string // Example: 'rgba(67,66,70,1)' + bottomMenuBackground?: string // Example: '#000000' + }; + presetMode?: string; // Example: 'basic' + theme?: string; // Example: 'basic' +} diff --git a/types/dwt/WebTwain.d.ts b/types/dwt/WebTwain.d.ts new file mode 100644 index 0000000000..f7a8a3e4d6 --- /dev/null +++ b/types/dwt/WebTwain.d.ts @@ -0,0 +1,49 @@ +import { DynamsoftEnums as Dynamsoft } from "./Dynamsoft.Enum"; +import { WebTwainViewer } from "./WebTwain.Viewer"; +import { BarcodeReader } from "./Addon.BarcodeReader"; +import { OCR } from "./Addon.OCR"; +import { OCRPro } from "./Addon.OCRPro"; +import { PDF } from "./Addon.PDF"; +import { Webcam } from "./Addon.Webcam"; + +export interface WebTwain extends WebTwainViewer { + /** + * Addons to WebTwain instances. + */ + Addon: Addon; + /** + * [Deprecation] This API is no longer needed. + */ + AllowMultiSelect: boolean; + /** + * [Deprecation] This API is no longer needed. + */ + AllowPluginAuthentication: boolean; + /** + * [Deprecation] This API is no longer needed. + */ + AsyncMode: boolean; + /** + * [Deprecation] This API is no longer needed. + */ + BorderStyle: Dynamsoft.EnumDWT_BorderStyle | number; + /** + * Return whether a WebTwain instance is ready to use. + */ + readonly bReady: boolean; + /** + * [Deprecation] This API is no longer needed. + */ + BrokerProcessType: number; + /** + * [Deprecation] This API is no longer needed. + */ + EnableInteractiveZoom: boolean; +} +export interface Addon { + BarcodeReader: BarcodeReader; + OCR: OCR; + OCRPro: OCRPro; + PDF: PDF; + Webcam: Webcam; +} diff --git a/types/dwt/addon.ocr.d.ts b/types/dwt/addon.ocr.d.ts deleted file mode 100644 index 582087fda5..0000000000 --- a/types/dwt/addon.ocr.d.ts +++ /dev/null @@ -1,204 +0,0 @@ -// 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 2020, 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 DynamsoftWebTwainAddon { - OCR: OCR; -} diff --git a/types/dwt/addon.ocrp.d.ts b/types/dwt/addon.ocrp.d.ts deleted file mode 100644 index 27a849626c..0000000000 --- a/types/dwt/addon.ocrp.d.ts +++ /dev/null @@ -1,174 +0,0 @@ -// 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 2020, 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; -} diff --git a/types/dwt/addon.pdf.d.ts b/types/dwt/addon.pdf.d.ts deleted file mode 100644 index 1d08bd77c8..0000000000 --- a/types/dwt/addon.pdf.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -// 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 2020, 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. - - * [Deprecated] Starting in v14.2, the PDF module is installed with Dynamsoft Service. - * @method Dynamsoft.WebTwain.Addon.PDF#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; - - Write: PDFWrite; -} - -interface PDFWrite { - /** - * Configures how the PDF generating is done - * @method Dynamsoft.WebTwain.Addon.PDF.Write#jsonWriteSetting - * @param {any} jsonWriteSetting detailed settings for PDF writing. - * @return {boolean} - */ - Setup(jsonWriteSetting: any): void; -} - -interface DynamsoftWebTwainAddon { - PDF: PDF; -} diff --git a/types/dwt/addon.webcam.d.ts b/types/dwt/addon.webcam.d.ts deleted file mode 100644 index 2ce29cec65..0000000000 --- a/types/dwt/addon.webcam.d.ts +++ /dev/null @@ -1,346 +0,0 @@ -// 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 2020, 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 The 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 DynamsoftWebTwainAddon { - Webcam: Webcam; -} diff --git a/types/dwt/dbr.d.ts b/types/dwt/dbr.d.ts deleted file mode 100644 index ba720aa438..0000000000 --- a/types/dwt/dbr.d.ts +++ /dev/null @@ -1,227 +0,0 @@ -// 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 2020, Dynamsoft Corporation -* Author: Dynamsoft Support Team -*/ - -interface Region { - left: number; - top: number; - right: number; - bottom: number; - measuredByPercentage: number; -} - -interface RunTimeSetting { - barcodeFormatIds: number; - binarizationModes: number[]; - deblurLevel: number; - expectedBarcodesCount: number; - localizationModes: number[]; - minBarcodeTextLength: number; - minResultConfidence: number; - region: Region; - resultCoordinateType: number; - scaleDownThreshold: number; - textResultOrderModes: number[]; - timeout: number; -} - -interface dbrEnv { - bAutoConnectService: boolean; - logLevel: number; - productKey: string; - resourcesPath: string; - hideDWASInstallDialog: boolean; - disableAutoDownloadModule: boolean; - onAutoConnectServiceSuccess(): void; - 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 { - namespace BarcodeReader { - /** Barcode Formats */ - enum EnumBarcodeFormat { - All = 503317503, - OneD = 0x3FF, - CODE_39 = 0x1, - CODE_128 = 0x2, - CODE_93 = 0x4, - CODABAR = 0x8, - ITF = 0x10, - EAN_13 = 0x20, - EAN_8 = 0x40, - UPC_A = 0x80, - UPC_E = 0x100, - INDUSTRIAL_25 = 0x200, - PDF417 = 0x2000000, - QR_CODE = 0x4000000, - DATAMATRIX = 0x8000000, - AZTEC = 0x10000000 - } - - enum EnumErrorCode { - DBR_SYSTEM_EXCEPTION = 1, - DBR_SUCCESS = 0, - DBR_UNKNOWN = -10000, - DBR_NO_MEMORY = -10001, - DBR_NULL_REFERENCE = -10002, - DBR_LICENSE_INVALID = -10003, - DBR_LICENSE_EXPIRED = -10004, - DBR_FILE_NOT_FOUND = -10005, - DBR_FILETYPE_NOT_SUPPORTED = -10006, - DBR_BPP_NOT_SUPPORTED = -10007, - DBR_INDEX_INVALID = -10008, - DBR_BARCODE_FORMAT_INVALID = -10009, - DBR_CUSTOM_REGION_INVALID = -10010, - DBR_MAX_BARCODE_NUMBER_INVALID = -10011, - DBR_IMAGE_READ_FAILED = -10012, - DBR_TIFF_READ_FAILED = -10013, - DBR_QR_LICENSE_INVALID = -10016, - DBR_1D_LICENSE_INVALID = -10017, - DBR_DIB_BUFFER_INVALID = -10018, - DBR_PDF417_LICENSE_INVALID = 10019, - DBR_DATAMATRIX_LICENSE_INVALID = -10020, - DBR_PDF_READ_FAILED = -10021, - DBR_PDF_DLL_MISSING = -10022, - DBR_PAGE_NUMBER_INVALID = -10023, - DBR_CUSTOM_SIZE_INVALID = -10024, - DBR_CUSTOM_MODULESIZE_INVALID = -10025, - DBR_RECOGNITION_TIMEOUT = -10026, - DBR_JSON_PARSE_FAILED = -10030, - DBR_JSON_TYPE_INVALID = -10031, - DBR_JSON_KEY_INVALID = -10032, - DBR_JSON_VALUE_INVALID = -10033, - DBR_JSON_NAME_KEY_MISSING = -10034, - DBR_JSON_NAME_VALUE_DUPLICATED = -10035, - DBR_TEMPLATE_NAME_INVALID = -10036, - DBR_JSON_NAME_REFERENCE_INVALID = -10037, - DBR_PARAMETER_VALUE_INVALID = 10038, - DBR_DOMAIN_NOT_MATCHED = -10039, - 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, - IPF_GrayScaled = 2, - IPF_NV21 = 3, - IPF_RGB_565 = 4, - IPF_RGB_555 = 5, - 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; - static name: string; - static length: number; - static version: string; - - /** - * Append a new template string to current runtime settings. - * @method BarcodeReader#decode - * @param {string} content A JSON string that represents the content of the settings. - * @param {number} emSettingPriority The parameter setting mode, which decides to inherit parameters from previous template setting or overwrite previous settings and replace by new template. - * @return {void} - */ - appendTplStringToRuntimeSettings(content: string, emSettingPriority: number): void; - /** - * Read barcode from the source image. - * @method BarcodeReader#decode - * @param {string} source specifies the image to read on - * @return {Promise} - * @example - ```javascript - // dwtUrl: HTML5 Edition only - reader.decode('dwt://dwt_trial_13000404/img?id=306159652&index=0&t=1502184632022').then( - results=>{ - for(var i = 0; i < results.length; ++i){ - console.log(results[i].BarcodeText); - // Confidence >= 30 is reliable - console.log(results[i].LocalizationResult.ExtendedResultArray[0].Confidence); - } - }); - // dcsUrl - reader.decode('dcs://dcs_trial_6110531/img?id=306159652&index=0&t=1502184632022').then( - function(results){ - // ie6-7 does not support console.log - var messageArr = []; - for(var i = 0; i < results.length; ++i){ - messageArr.push(results[i].BarcodeText); - // Confidence >= 30 is reliable - messageArr.push(results[i].LocalizationResult.ExtendedResultArray[0].Confidence); - } - alert(messageArr.join('')); - })['catch'](function(ex){ - // ie6-9 does not support '.catch(function(ex){...})' - if(ex){alert(ex.message||ex);} - }); - ``` - - */ - decode(source: string): Promise; - - /** - * Read barcode from base64 string - */ - decodeBase64String(base64String: string): Promise; - getAllLocalizationResults(): any; - getAllParameterTemplateNames(): any; - getRuntimeSettings(): RunTimeSetting; - initRuntimeSettingsWithString(): any; - outputSettingsToString(): any; - resetRuntimeSettings(): void; - updateRuntimeSettings(setting: RunTimeSetting): void; - } - - let TaskQueue: TaskQueue; - let dbrEnv: dbrEnv; - /**dbrMasterPage20170526 */ - let dcp: { - ifCheck64bitServiceFirst: boolean; - }; - /**dwtDbrDemo20170613 */ - let initOrder: any; - let lib: any; - let managerEnv: any; - let navInfo: any; -} diff --git a/types/dwt/dwt-tests.ts b/types/dwt/dwt-tests.ts index a6a68933f5..64b33e9535 100644 --- a/types/dwt/dwt-tests.ts +++ b/types/dwt/dwt-tests.ts @@ -2,108 +2,99 @@ // tslint:disable:max-line-length // tslint:disable:no-irregular-whitespace -import * as Dynamsoft from 'dwt'; +import Dynamsoft from 'dwt'; +import { DeviceConfiguration } from 'dwt/WebTwain.Acquire'; -function dwtOnReady() { - const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer' +function Dynamsoft_OnReady() { + const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { - let count = DWObject.SourceCount; - if (count === 0) { - DWObject.CloseSourceManager(); - DWObject.ImageCaptureDriverType = 0; - DWObject.OpenSourceManager(); - count = DWObject.SourceCount; - } - } + 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(); }); - } + 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({}, () => { }, (settings: DeviceConfiguration, 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; - }); - } + const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + DWObject.RegisterEvent("OnPostTransfer", function () { }); + DWObject.RegisterEvent("OnPostLoad", function () { }); + DWObject.RegisterEvent("OnMouseClick", function () { }); + 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); - } + 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(); - } + 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) => {}); - } + 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. - } + 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) => {}); - } + 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) => {}); - } + const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + DWObject.HTTPPort = 80; + DWObject.HTTPDownload("www.dynamsoft.com", "img.png", () => { }, (errorCode: number, errorString: string) => { }); + } } function loadPDF() { diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts index 273d14afc2..060f4d0558 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for dwt 15.3 +// Type definitions for dwt 16.0 // Project: https://www.dynamsoft.com/products/webtwain_overview.aspx // Definitions by: Xiao Ling // Josh Hall @@ -8,23 +8,13 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.1 -/// -/// -/// -/// -/// -/// -/// - /*! -* Based on Dynamsoft WebTwain JavaScript Intellisense * Product: Dynamsoft Web Twain * Web Site: http://www.dynamsoft.com * * Copyright 2020, Dynamsoft Corporation * Author: Dynamsoft Support Team -* Version: 15.3 +* Version: 16.0 */ - -declare const Dynamsoft: DynamsoftStatic; -export = Dynamsoft; +import Dynamsoft from "./Dynamsoft"; +export default Dynamsoft; diff --git a/types/dwt/mbc.d.ts b/types/dwt/mbc.d.ts deleted file mode 100644 index d932edbd39..0000000000 --- a/types/dwt/mbc.d.ts +++ /dev/null @@ -1,1046 +0,0 @@ -// 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 2020, 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'); -``` -*/ - -// export = KPainter; - -declare class MBC { - /** - * Tell this painter the directory where you place`cv-wasm.js` and`cv-wasm.wasm`. - - * Syntax:* `MBC.cvFolder = 'js';` - */ - cvFolder: string; - - /** - * You should call`MBC.loadCvScriptAsync()` first before use`Free Transform` and`Brush` module. - - * Syntax:* `MBC.loadCvScriptAsync(callback)` - - | parameter | type | description | - | | | | - | callback | `function(boolean bSuccess)` | | - - @example -```javascript -MBC.loadCvScriptAsync(function(bSuccess){ - if(bSuccess){ - console.log('load cv script success.'); - painter.enterFreeTransformModeAsync(); - }else{ - console.log('load cv script fail.'); - } -}); -``` - */ - loadCvScriptAsync: () => void; -} - -interface rectangle { - left: number; - top: number; - right: number; - bottom: number; -} - -interface point { - x: number; - y: number; -} - -interface cornerPoints { - leftTop: point; - rightTop: point; - leftBottom: point; - rightBottom: point; -} - -interface TaskQueue { - push(task: (bLoadingWhenPush: boolean) => void, context?: any, args?: []): void; - unshift(task: (bLoadingWhenPush: boolean) => void, context?: any, args?: []): void; - next(): void; -} - -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); -``` - * - */ - getHtmlElement(): HTMLDivElement; - - /** - * Get the current showing image index a in MBC instance. - */ - getCurIndex(): number; - - /** - * Get the image count in a MBC instance. - */ - getCount(): number; - - /** - * Identify whether the MBC instance is in `Editing` mode. - */ - isEditing(): boolean; - - /** - * -@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; - - /** - * Binding a function that would be called when starting an expensive operation. - * Syntax:* `function(){}` -@example```javascript -painter.onStartLoading = function(){ - document.getElementById('animation').show(); -}; -``` - */ - onStartLoading: () => void; - - /** - * Binding a function that would be called when finishing an expensive operation. - - * Syntax:* `function(){}` - - @example```javascript - painter.onFinishLoading = function(){ - document.getElementById('animation').hide(); - }; - ``` - */ - onFinishLoading: () => void; - - // # 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(); -}); -``` - */ - showFileChooseWindow(): boolean; - - /** - * @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; -``` - */ - defaultFileInput: HTMLInputElement; - - /** - * Binding a function that would be called when`defaultFileInput` change by`showFileChooseWindow()`. - - * Syntax:* `function(event, callback){}` - - @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); - } - }); - } -}; -``` - */ - beforeAddImgFromFileChooseWindow: () => void; - - /** - * Binding a function that would be called after adding image from`defaultFileInput`. - - * Syntax:* `function(){}` - - @example -```javascript -painter.afterAddImgFromFileChooseWindow = function(bSuccess){ - if(bSuccess){console.log('The new image(s) has been added from file choose window.');} -}; -``` - */ - afterAddImgFromFileChooseWindow: () => void; - - /*** - * 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); - } - }); - } -}; -``` - */ - beforeAddImgFromDropFile: () => any; - - /** - * - * Syntax:* `function(){}` - - @example -```javascript -painter.afterAddImgFromDropFile = function(bSuccess){ - if(bSuccess){console.log('The new image(s) has been added from dropping.');} -}; -``` - * - */ - afterAddImgFromDropFile: () => void; - - /** - * Syntax:* `.addImageAsync(imgData, callback)` - - | parameter | type | description | - | | | | - | imgData | `Blob`, `HTMLCanvasElement`, `HTMLImageElement`, `String` * (url) *, `Array` * (a array of source)*, `FileList` | | - | callback * (optional) * | `function(bSuccess)` | | - - @example -```javascript -painter.addImageAsync(image, function(bSuccess){ - console.log('Add success'); -}); -``` - */ - addImageAsync(imgData: Blob | HTMLCanvasElement | HTMLImageElement | string | string[], callback?: () => void): void; - - /** - The image whose width or height larger than`addedImageMaxWH` would be compressed when adding. - - * Syntax:* `.addedImageMaxWH = 4096;` - */ - addedImageMaxWH: number; - - /** - * Whether`changePage` to the new added image. - - * Syntax:* `.isShowNewImgWhenAdd = true;` - */ - isShowNewImgWhenAdd: boolean; - - /** - * Update the`htmlElement` of a MBC instance.Should call it manually when the`htmlElement` resize. - - * Syntax:* `.updateUIOnResize(isLazy, callback)` - - | parameter | type | description | - | | | | - | isLazy * (optional) *| `boolean` | Default false.Set true to avoid to update too frequently. | - | callback | `function()` | Callback of finish updating.Might abort the earlier callback when`isLazy` is true. | - - @example -```javascript -window.addEventListener('resize',function(){ - painter.updateUIOnResize(true, function(){ - console.log('painter update'); - }); -}); -``` - */ - updateUIOnResize(isLazy?: boolean, callback?: () => void): void; - - /** - * Binding a function that would be called when current image index or total length change. - - * Syntax:* `function(Number curIndex, Number length){}` - - @example -```javascript -painter.onNumChange = function(curIndex, length){ - console.log('curIndex: '+curIndex+', length:'+length); -}; -``` - */ - onNumChange: (curIndex: number, length: number) => void; - - /** - * Change index of the current page.Can only process in `Viewing` mode. - - * Syntax:* `.changePage(cmd)` - - | parameter | type | description | - | | | | - | * (return value)* | `boolean` | | - | cmd | `Number` * (index) *, `String` * ('f', 'p', 'n', 'l') * | Index number, or command string of 'f'(first), 'p'(pre), 'n'(next), 'l'(last). | - - @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)); -}); -``` - */ - changePage(cmd: number | string): boolean; - - /** - * Delete a image.Can only process in `Viewing` mode. - - * Syntax:* `.del(index)` - - | parameter | type | description | - | | | | - | * (return value)* | `boolean` | | - | index * (optional) * | `Number` | Default current index. | - - */ - del(index: number): boolean; - - /** - * Get width of current image in the MBC instance. - - * Syntax:* `.getWidth(index)` - - | parameter | type | description | - | | | | - | * (return value)* | `Number` | | - | index * (optional) * | `Number` | Default current index. | - */ - getWidth(index: number): number; - - /** - * Get height of current image in the MBC instance. - - * Syntax:* `.getHeight(index)` - - | parameter | type | description | - | | | | - | * (return value)* | `Number` | | - | index * (optional) * | `Number` | Default current index. | - */ - getHeight(index: number): number; - - /** - * Get the image data in `Blob` type. - - * Syntax:* `.getBlob(index)` - - | parameter | type | description | - | | | | - | * (return value)* | `Number` | | - | index * (optional) * | `Number` | Default current index. | - */ - getBlob(index: number): Blob; - - /** - * Download the image to users' local system. The function should be invoked directly by the user. Async invoking may have problems. - - * Syntax:* `.download(filename, index)` - - | parameter | type | description | - | | | | - | * (return value)* | `Number` | | - | filename * (optional) * | `String` | | - | index * (optional) * | `Number` | Default current index. | - - @example -```javascript -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; - - /** - * Syntax:* `.bindThumbnailBox(container, funWrap, maxWH)` - - | parameter | type | description | - | | | | - | * (return value)* | `boolean` | | - | container | `HTMLElement` | | - | funWrap * (optional) * | `HTMLElement function(HTMLCanvasElement cvs)` | | - | maxWH * (optional) * | `Number` | Default 256. | - - @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; -}); -``` - */ - bindThumbnailBox(container: HTMLElement, funWrap?: () => HTMLElement, maxWH?: number): boolean; - - /** - * Syntax:* `.unbindThumbnailBox(container)` - - | parameter | type | description | - | | | | - | * (return value)* | `boolean` | | - | container | `HTMLElement` | | - - @example -```javascript -painter.bindThumbnailBox(document.getElementById('div-thumbnailContainer')); -``` - */ - unbindThumbnailBox(container: HTMLElement): boolean; - - // # Gesture - /** - * - Set the zoom rate when user left double click. - - * Syntax:* `.leftDoubleClickZoomRate = 2;` - - */ - leftDoubleClickZoomRate: number; - - /** - * Set the zoom rate when user right double click. - - * Syntax:* `.rightDoubleClickZoomRate = 0.5;` - */ - rightDoubleClickZoomRate: number; - - /** - * Whether allow switch from last to first or from first to last by`touchmove` gesture. - - * Syntax:* `.allowedTouchMoveSwitchImgOverBoundary = true;` - */ - allowedTouchMoveSwitchImgOverBoundary: boolean; - - /** - * Binding a function that would be called when the performence of the current image or canvas(in `Editing` mode) update. - - * Syntax:* `function(){}` - - @example -```javascript -painter.onUpdateImgPosZoom(function(){ - console.log(painter.getZoom()); - console.log(painter.getEditWidth()); - console.log(painter.getEditHeight()); -}); -``` - */ - onUpdateImgPosZoom: () => void; - - /** - * Get the zoom of current image or canvas(in `Editing` mode). - - * Syntax:* `.getZoom()` - - | parameter | type | description | - | | | | - | * (return value)* | `Number` | | - */ - getZoom(): number; - - /** - * Set the zoom of current image or canvas(in `Editing` mode). - - * Syntax:* `.setZoom(num, isRate)` - - | parameter | type | description | - | | | | - | * (return value)* | `Number` | The finally effective zoom. | - | num | `Number` | | - | isRate | `boolean` | | - */ - setZoom(num: number, isRate: boolean): number; - - // # 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. - - * Syntax:* `.stepImgsGCThreshold = 10;` - */ - stepImgsGCThreshold: number; - - /** - * Add a protected step.Then this step would not be GC.Can only process in `Editing` mode. - - * Syntax:* `.addProtectedStep(index)` - - | parameter | type | description | - | | | | - | index | `Number` | | - - @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-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); - }); -}); -``` - */ - addProtectedStep(index: number): boolean; - - /** - * Remove a protected step.Then this step can be GC.Can only process in `Editing` mode. - - * Syntax:* `.removeProtectedStep(index)` - - | parameter | type | description | - | | | | - | index | `Number` | | - - */ - removeProtectedStep(index: number): boolean; - - /** - * Get All protected steps.Can only process in `Editing` mode. - - * Syntax:* `.getProtectedSteps()` - - | parameter | type | description | - | | | | - | * (return value)* | `Array` | A array of the protected numbers. | - */ - getProtectedSteps(): number[]; - - /** - * Undo an editing step.Can only process in `Editing` mode. - - * Syntax:* `.undo(callback)` - - | parameter | type | description | - | | | | - | callback | `function(boolean bSuccess)` | | - */ - undo(callback: () => void): void; - - /** - * Redo an editing step.Can only process in `Editing` mode. - - * Syntax:* `.redo(callback)` - - | parameter | type | description | - | | | | - | callback | `function(boolean bSuccess)` | | - */ - redo(callback: () => void): void; - - /** - * Get count of editing steps.Can only process in `Editing` mode. - - * Syntax:* `.getStepCount()` - - | parameter | type | description | - | | | | - | * (return value)* | `Number` | | - */ - getStepCount(): number; - - /** - * Get current editing step.Can only process in `Editing` mode. - - * Syntax:* `.getCurStep()` - - | parameter | type | description | - | | | | - | * (return value)* | `Number` | | - */ - getCurStep(): number; - - /** - * Set current editing step.Can only process in `Editing` mode. - - * Syntax:* `.setCurStepAsync(index, callback)` - - | parameter | type | description | - | | | | - | index | `Number` | | - | callback | `function(boolean bSuccess)` | | - */ - setCurStepAsync(index: number, callback: () => void): void; - - /** - * Enter the`Editing` mode. - - * Syntax:* `.enterEditAsync(callback)` - - | parameter | type | description | - | | | | - | callback | `function(boolean bSuccess)` | | - */ - enterEditAsync(callback: () => void): void; - - /** - * Leave the`Editing` mode without saving change. - - * Syntax:* `.cancelEdit(callback)` - - | parameter | type | description | - | | | | - | * (return value)* | `boolean` | | - */ - cancelEdit(callback: () => void): boolean; - - /** - * Save change and leave the`Editing` mode. - - * Syntax:* `.saveEditAsync(callback, isCover)` - - | parameter | type | description | - | | | | - | callback | `function(boolean bSuccess)` | | - | isCover | `boolean` | | - */ - saveEditAsync(callback: () => void, isCover: boolean): void; - - /** - * Rotate right.Can only process in `Editing` mode. - - * Syntax:* `.rotateRight()` - - | parameter | type | description | - | | | | - | * (return value)* | `boolean` | | - */ - rotateRight(): boolean; - - /** - * Rotate left.Can only process in `Editing` mode. - - * Syntax:* `.rotateLeft()` - - | parameter | type | description | - | | | | - | * (return value)* | `boolean` | | - */ - rotateLeft(): boolean; - - /** - * Mirror.Can only process in `Editing` mode. - - * Syntax:* `.mirror()` - - | parameter | type | description | - | | | | - | * (return value)* | `boolean` | | - */ - mirror(): boolean; - - /** - * Flip.Can only process in `Editing` mode. - - * Syntax:* `.flip()` - - | parameter | type | description | - | | | | - | * (return value)* | `boolean` | | - */ - flip(): boolean; - - /** - * Resize.Can only process in `Editing` mode. - - * Syntax:* `.resizeAsync(newWidth, newHeight, callback)` - - | parameter | type | description | - | | | | - | newWidth | `Number` | | - | newHeight | `Number` | | - | callback | `function(boolean bSuccess)` | | - */ - resizeAsync(newWidth: number, newHeight: number, callback: () => void): void; - - /** - * Get width of current editing canvas. - - * Syntax:* `.getEditWidth()` - - | parameter | type | description | - | | | | - | * (return value)* | `Number` | | - */ - getEditWidth(): number; - - /** - * Get height of current editing canvas. - - * Syntax:* `.getEditHeight()` - - | parameter | type | description | - | | | | - | * (return value)* | `Number` | | - */ - getEditHeight(): number; - - // # Crop - /** - * Whether show`Crop Rect` UI when enter`Editing` mode - - * Syntax:* `.isAutoShowCropUI = true;` - */ - isAutoShowCropUI: boolean; - - /** - Show`Crop Rect`.Can only process in `Editing` mode. - - * Syntax:* `.showCropRect()` - */ - showCropRect(): void; - - /** - * Hide`Crop Rect`.Can only process in `Editing` mode. - - * Syntax:* `.hideCropRect()` - */ - hideCropRect(): void; - - /** - * Default 0. - 0: touch / click moving inside`Crop Rect` will move the back canvas. - 1: touch / click moving inside`Crop Rect` will move the`Crop Rect`. - - * Syntax:* `.setCropRectStyle(styleNo)` - - | parameter | type | description | - | | | | - | * (return value)* | `boolean` | | - | styleNo | `Number` | 0, 1 | - */ - setCropRectStyle(styleNo: number): boolean; - - /** - * `Crop Rect` min width. - - * Syntax:* `.cropRectMinW = 50;` - */ - cropRectMinW: number; - - /** - `Crop Rect` min height. - - * Syntax:* `.cropRectMinH = 50;` - */ - cropRectMinH: number; - - /** - * Binding a function that would be called when the`Crop Rect` change. - - * Syntax:* `function(){}` - - @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]; -}; -``` - */ - onCropRectChange: () => void; - - /** - * - * Syntax:* `.setCropRectArea(left, top, right, bottom)` - `Crop Rect` select an area. - - | parameter | type | description | - | | | | - | * (return value)* | `boolean` | | - | left * (optional) * | `Number` | -0.5 ~0.5, default -0.5. | - | top * (optional) * | `Number` | -0.5 ~0.5, default -0.5. | - | right * (optional) * | `Number` | -0.5 ~0.5, default 0.5. | - | bottom * (optional) * | `Number` | -0.5 ~0.5, default 0.5. | - */ - setCropRectArea(left: number, top: number, right: number, bottom: number): boolean; - - /** - * Syntax:* `.getCropRectArea(isAbsolute)` - - | parameter | type | description | - | | | | - | * (return value)* | `Array` | A array of[left, top, right, bottom]. | - | isAbsolute | `boolean` | Default`false`, get precentage(-50 % ~50 %) array. | - - */ - getCropRectArea(isAbsolute: boolean): rectangle[]; - - /** - * Crop the selected area.Can only process in `Editing` mode. - - * Syntax:* `.cropAsync(callback, array)` - - | parameter | type | description | - | | | | - | callback * (optional) * | `function([left, top, right, bottom])` | | - | array * (optional) * | `Array` | A array of[left, top, right, bottom]\(each - 0.5 ~0.5\).Default use an area accroding to`Crop Rect`. | - - */ - cropAsync(callback?: () => void, array?: rectangle[]): void; - - // # 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. - - * Syntax:* `.documentDetectAsync(callback, importSrc)` - - | parameter | type | description | - | | | | - | callback * (optional) * | `function([[x0,y0], [x1,y1], [x2,y2], [x3,y3]])` | x0, y0...is from - 0.5 to 0.5. | - | importSrc * (optional) * | | TUDO.Not easy enough to use now. | - */ - documentDetectAsync(callback?: () => void, importSrc?: any): void; - - /** - * Set the`FreeTransform` corner position.Can only process in `FreeTransform` mode. - - * Syntax:* `.setFreeTransformCornerPos(cornerPoints)` - - | parameter | type | description | - | | | | - | cornerPoints | `Array` | A array of[[x0, y0], [x1, y1], [x2, y2], [x3, y3]].x0, y0...is from - 0.5 to 0.5. | - - */ - setFreeTransformCornerPos(cornerPoints: cornerPoints): any; - - /** - * Get the`FreeTransform` corner position. - - * Syntax:* `.getFreeTransformCornerPos()` - - | parameter | type | description | - | | | | - | * (return value)* | `Array` | A array of[[x0, y0], [x1, y1], [x2, y2], [x3, y3]].x0, y0...is from - 0.5 to 0.5.| - - */ - getFreeTransformCornerPos(): cornerPoints[]; - - /** - * Binding a function that would be called when the`FreeTransform` corner position change. - - * Syntax:* `function()` - - @example -```javascript -painter.onFreeTransformCornerPosChange = function(){ - console.log(painter.getFreeTransformCornerPos()); -}; -``` - */ - onFreeTransformCornerPosChange: () => void; - - /** - * - * `freeTransformAsync()` is a really expensive operation. `freeTransformMaxWH` would limit the max width and height of the result. - - * Syntax:* `.freeTransformMaxWH = 2048;` - */ - freeTransformMaxWH: number; - - /** - * - Transform the quadrilateral surround by the`FreeTransform` corner into a rectangle.Can only process in `FreeTransform` mode. - - * Syntax:* `.freeTransformAsync(callback, cornerPoints, importSrc)` - - | parameter | type | description | - | | | | - | callback * (optional) * | `function(boolean bSuccess)` | | - | cornerPoints * (optional) * | `Array` | A array of[[x0, y0], [x1, y1], [x2, y2], [x3, y3]].x0, y0...is from - 0.5 to 0.5. | - | importSrc * (optional) * | | TUDO.Not show for user. | - */ - freeTransformAsync(callback?: () => void, cornerPoints?: cornerPoints[], importSrc?: any): any; - - /** - * - Enter`FreeTransform` mode.Can only process in `Editing` mode. - - * Syntax:* `.enterFreeTransformModeAsync(callback)` - - | parameter | type | description | - | | | | - | callback * (optional) * | `function(boolean bSuccess)` | | - */ - enterFreeTransformModeAsync(callback: () => void): any; - - /** - * Exist`FreeTransform` mode. - - * Syntax:* `.exitFreeTransformModeAsync(callback)` - - | parameter | type | description | - | | | | - | callback * (optional) * | `function(boolean bSuccess)` | | - */ - exitFreeTransformModeAsync(callback?: () => void): any; - - // # Video - videoSettings: MediaStreamConstraints; - - // ## `MediaStreamConstraints`.videoSettings - /** - A[MediaStreamConstraints](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints). - - * reference:* [getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) - - * Syntax:* `.showVideo(callback, videoSettings)` - - | parameter | type | description | - | | | | - | callback * (optional) * | `function(boolean bSuccess)` | | - | videoSettings * (optional) * | `MediaStreamConstraints` | A[MediaStreamConstraints](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints). *reference:* [getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) | - */ - showVideo(callback?: () => void, videoSettings?: MediaStreamConstraints): boolean; - - /** - * Syntax:* `.grabVideo()` - - Grab a image from the video and return the image. - - | parameter | type | description | - | | | | - | * (return value)* | `HTMLCanvasElement` | | - * Syntax:* `.grabVideo(true, callback)` - - Grab a image from the video and auto add image to the painter.Can only process in `Viewing` mode. - - | parameter | type | description | - | | | | - | callback * (optional) * | `function(boolean bSuccess)` | | - */ - grabVideo(isAutoAdd?: boolean, callback?: () => void): HTMLCanvasElement | void; - - /** - * Syntax:* `.hideVideo()` - */ - hideVideo(): boolean; - - /** - * Syntax:* `function(canvas, callback){}` - - @example -```javascript -painter.beforeAddImgFromGrabVideoBtn = function(canvas, callback){ - doSomeWorkToGetNewSrc(canvas, function(srcValidForAddImage){ - callback(srcValidForAddImage); - }); -}; -``` - */ - beforeAddImgFromGrabVideoBtn: () => void; - - /** - * Syntax:* `function(){}` - - @example -```javascript -painter.afterAddImgFromGrabVideoBtn = function(bSuccess){ - if(bSuccess){console.log('The new image(s) has been added from video.');} -}; -``` - */ - afterAddImgFromGrabVideoBtn: () => void; -}