From c760a5bd2e67fe00e36fedcd7b7ac8ba0959adf9 Mon Sep 17 00:00:00 2001 From: ztyyLV <97287824+ztyyLV@users.noreply.github.com> Date: Fri, 31 Mar 2023 18:28:18 +0800 Subject: [PATCH 1/3] Update WebTwain_Acquire.md --- info/api/WebTwain_Acquire.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/info/api/WebTwain_Acquire.md b/info/api/WebTwain_Acquire.md index 58d20e3e..68c22fc3 100644 --- a/info/api/WebTwain_Acquire.md +++ b/info/api/WebTwain_Acquire.md @@ -336,6 +336,22 @@ CloseSource(): boolean; +**Example** + +```javascript +// Close the scanner source in the success/failure callback after all images are acquired. In this case, the source can be freed and used by others. +DWObject.OpenSource(); +DWObject.AcquireImage(successCallback,failureCallback); + +function successCallback() { + console.log("successful"); +} + +function failureCallback(errorCode, errorString) { + alert(errorString); +} +``` + --- ## CloseSourceAsync @@ -539,6 +555,15 @@ OpenSource(): boolean; +**Example** + +```javascript +DWObject.GetSourceNames() // for example ['PaperStream IP fi-7300NX Net', 'TWAIN2 FreeImage Software Scanner'] +DWObject.SelectSourceByIndex(0); // choose scanner with the name "PaperStream IP fi-7300NX Net" +DWObject.OpenSource(); +DWObject.AcquireImage(); +``` + --- ## OpenSourceAsync @@ -666,6 +691,12 @@ interface Version { +**Example** + +```javascript +DWObject.GetSourceNames(); // return a list of scanner sources such as ['PaperStream IP fi-7300NX Net', 'TWAIN2 FreeImage Software Scanner'] +``` + --- ## GetSourceNamesAsync From 95f5bd8ce20463d35cd9c857c10598d47c15fd2d Mon Sep 17 00:00:00 2001 From: ztyyLV <97287824+ztyyLV@users.noreply.github.com> Date: Tue, 4 Apr 2023 14:40:50 +0800 Subject: [PATCH 2/3] Update WebTwain_Acquire.md --- info/api/WebTwain_Acquire.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/info/api/WebTwain_Acquire.md b/info/api/WebTwain_Acquire.md index 68c22fc3..c63e2b4f 100644 --- a/info/api/WebTwain_Acquire.md +++ b/info/api/WebTwain_Acquire.md @@ -345,10 +345,12 @@ DWObject.AcquireImage(successCallback,failureCallback); function successCallback() { console.log("successful"); + DWObject.CloseSource(); } function failureCallback(errorCode, errorString) { alert(errorString); + DWObject.CloseSource(); } ``` @@ -558,7 +560,7 @@ OpenSource(): boolean; **Example** ```javascript -DWObject.GetSourceNames() // for example ['PaperStream IP fi-7300NX Net', 'TWAIN2 FreeImage Software Scanner'] +DWObject.GetSourceNames(); // for example ['PaperStream IP fi-7300NX Net', 'TWAIN2 FreeImage Software Scanner'] DWObject.SelectSourceByIndex(0); // choose scanner with the name "PaperStream IP fi-7300NX Net" DWObject.OpenSource(); DWObject.AcquireImage(); @@ -841,7 +843,6 @@ SelectSourceAsync(deviceType?: Dynamsoft.DWT.EnumDWT_DeviceType | number): Promi ---- **Example** @@ -856,6 +857,8 @@ DWObject.SelectSourceAsync() }); ``` +--- + ## SelectSourceByIndex Select a data source by its index. @@ -897,7 +900,8 @@ SelectSourceByIndex(index: number): boolean; **Example** ```javascript -DWObject.SelectSourceByIndex(0); +DWObject.GetSourceNames(); // for example ['PaperStream IP fi-7300NX Net', 'TWAIN2 FreeImage Software Scanner'] +DWObject.SelectSourceByIndex(0); // choose scanner with the name "PaperStream IP fi-7300NX Net" DWObject.OpenSource(); DWObject.AcquireImage(); ``` @@ -998,7 +1002,7 @@ SetOpenSourceTimeout(duration: number): boolean; ```javascript DWObject.SelectSource(function () { - DWObject.SetOpenSourceTimeout(3000); + DWObject.SetOpenSourceTimeout(3000); // stop the opening process if the source cannot be opened within 3000 ms. DWObject.OpenSource(); DWObject.AcquireImage(); }); @@ -1382,6 +1386,12 @@ CloseSourceManager(): boolean; + +**Example** + +DWObject.CloseSource(); +DWObject.CloseSourceManager(); + --- ## CloseSourceManagerAsync From 11a7d2458e2df2bf308df210a051619886d61d46 Mon Sep 17 00:00:00 2001 From: ztyyLV <97287824+ztyyLV@users.noreply.github.com> Date: Thu, 6 Apr 2023 18:51:14 +0800 Subject: [PATCH 3/3] Update WebTwain_Acquire.md --- info/api/WebTwain_Acquire.md | 46 ++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/info/api/WebTwain_Acquire.md b/info/api/WebTwain_Acquire.md index c63e2b4f..445b83ea 100644 --- a/info/api/WebTwain_Acquire.md +++ b/info/api/WebTwain_Acquire.md @@ -1389,8 +1389,9 @@ CloseSourceManager(): boolean; **Example** -DWObject.CloseSource(); +```javascript DWObject.CloseSourceManager(); +``` --- @@ -1548,10 +1549,15 @@ GetCustomDSData(fileName: string): boolean; +**Usage notes** + +Typically, the data source data file is set by the method [SetCustomDSData()](#setcustomdsdata). + **Example** ```javascript -DWObject.GetCustomDSData("C:\\customDSData"); +// Please note, the API only works for TWAIN driver. +DWObject.GetCustomDSData("C:\\Users\\UserName\\Desktop\\ProfileName"); ``` --- @@ -1590,6 +1596,17 @@ GetCustomDSDataEx(): string; +**Usage notes** + +Typically, the data source data file is set by the method [SetCustomDSDataEx()](#setcustomdsdataex). + +**Example** + +```javascript +// Please note, the API only works for TWAIN driver. +DWObject.GetCustomDSDataEx(); // Return a base64 string +``` + --- ## GetSourceNameItems @@ -1630,6 +1647,13 @@ GetSourceNameItems(index: number): string; +**Example** + +```javascript +DWObject.GetSourceNames(); // [scanner 1, scanner 2, scanner 3...] +DWObject.GetSourceNameItems(0); // return the name of scanner 1 +``` + --- ## OpenSourceManager @@ -1670,6 +1694,12 @@ OpenSourceManager(): boolean; If application identification needs to be set, it should be set before this API. +**Example** + +```javascript +DWObject.OpenSourceManager(); +``` + --- ## OpenSourceManagerAsync @@ -1833,6 +1863,13 @@ SetCustomDSData(fileName: string): boolean; Typically, the data source data file is created by the method [GetCustomDSData()](#getcustomdsdata). +**Example** + +```javascript +// Please note, the API only works for TWAIN driver. +DWObject.SetCustomDSData("C:\\Users\\UserName\\Desktop\\ProfileName"); +``` + --- ## SetCustomDSDataEx @@ -1877,6 +1914,11 @@ SetCustomDSDataEx(dsDataString: string): boolean; Typically the data source data string is created by the method [GetCustomDSDataEx()](#getcustomdsdataex) +```javascript +// Please note, the API only works for TWAIN driver. +DWObject.SetCustomDSData("the base64 string of your profile"); +``` + --- ## SetFileXferInfo