@@ -345,10 +345,12 @@ DWObject.AcquireImage(successCallback,failureCallback);
345345
346346function successCallback () {
347347 console .log (" successful" );
348+ DWObject .CloseSource ();
348349}
349350
350351function failureCallback (errorCode , errorString ) {
351352 alert (errorString);
353+ DWObject .CloseSource ();
352354}
353355```
354356
@@ -558,7 +560,7 @@ OpenSource(): boolean;
558560** Example**
559561
560562``` javascript
561- DWObject .GetSourceNames () // for example ['PaperStream IP fi-7300NX Net', 'TWAIN2 FreeImage Software Scanner']
563+ DWObject .GetSourceNames (); // for example ['PaperStream IP fi-7300NX Net', 'TWAIN2 FreeImage Software Scanner']
562564DWObject .SelectSourceByIndex (0 ); // choose scanner with the name "PaperStream IP fi-7300NX Net"
563565DWObject .OpenSource ();
564566DWObject .AcquireImage ();
@@ -841,7 +843,6 @@ SelectSourceAsync(deviceType?: Dynamsoft.DWT.EnumDWT_DeviceType | number): Promi
841843
842844</table >
843845</div >
844- ---
845846
846847** Example**
847848
@@ -856,6 +857,8 @@ DWObject.SelectSourceAsync()
856857 });
857858```
858859
860+ ---
861+
859862## SelectSourceByIndex
860863
861864Select a data source by its index.
@@ -897,7 +900,8 @@ SelectSourceByIndex(index: number): boolean;
897900** Example**
898901
899902``` javascript
900- DWObject .SelectSourceByIndex (0 );
903+ DWObject .GetSourceNames (); // for example ['PaperStream IP fi-7300NX Net', 'TWAIN2 FreeImage Software Scanner']
904+ DWObject .SelectSourceByIndex (0 ); // choose scanner with the name "PaperStream IP fi-7300NX Net"
901905DWObject .OpenSource ();
902906DWObject .AcquireImage ();
903907```
@@ -998,7 +1002,7 @@ SetOpenSourceTimeout(duration: number): boolean;
9981002
9991003``` javascript
10001004DWObject .SelectSource (function () {
1001- DWObject .SetOpenSourceTimeout (3000 );
1005+ DWObject .SetOpenSourceTimeout (3000 ); // stop the opening process if the source cannot be opened within 3000 ms.
10021006 DWObject .OpenSource ();
10031007 DWObject .AcquireImage ();
10041008});
@@ -1382,6 +1386,13 @@ CloseSourceManager(): boolean;
13821386
13831387</table >
13841388</div >
1389+
1390+ ** Example**
1391+
1392+ ``` javascript
1393+ DWObject .CloseSourceManager ();
1394+ ```
1395+
13851396---
13861397
13871398## CloseSourceManagerAsync
@@ -1538,10 +1549,15 @@ GetCustomDSData(fileName: string): boolean;
15381549</table >
15391550</div >
15401551
1552+ ** Usage notes**
1553+
1554+ Typically, the data source data file is set by the method [ SetCustomDSData()] ( #setcustomdsdata ) .
1555+
15411556** Example**
15421557
15431558``` javascript
1544- DWObject .GetCustomDSData (" C:\\ customDSData" );
1559+ // Please note, the API only works for TWAIN driver.
1560+ DWObject .GetCustomDSData (" C:\\ Users\\ UserName\\ Desktop\\ ProfileName" );
15451561```
15461562
15471563---
@@ -1580,6 +1596,17 @@ GetCustomDSDataEx(): string;
15801596</table >
15811597</div >
15821598
1599+ ** Usage notes**
1600+
1601+ Typically, the data source data file is set by the method [ SetCustomDSDataEx()] ( #setcustomdsdataex ) .
1602+
1603+ ** Example**
1604+
1605+ ``` javascript
1606+ // Please note, the API only works for TWAIN driver.
1607+ DWObject .GetCustomDSDataEx (); // Return a base64 string
1608+ ```
1609+
15831610---
15841611
15851612## GetSourceNameItems
@@ -1620,6 +1647,13 @@ GetSourceNameItems(index: number): string;
16201647</table >
16211648</div >
16221649
1650+ ** Example**
1651+
1652+ ``` javascript
1653+ DWObject .GetSourceNames (); // [scanner 1, scanner 2, scanner 3...]
1654+ DWObject .GetSourceNameItems (0 ); // return the name of scanner 1
1655+ ```
1656+
16231657---
16241658
16251659## OpenSourceManager
@@ -1660,6 +1694,12 @@ OpenSourceManager(): boolean;
16601694
16611695If application identification needs to be set, it should be set before this API.
16621696
1697+ ** Example**
1698+
1699+ ``` javascript
1700+ DWObject .OpenSourceManager ();
1701+ ```
1702+
16631703---
16641704
16651705## OpenSourceManagerAsync
@@ -1823,6 +1863,13 @@ SetCustomDSData(fileName: string): boolean;
18231863
18241864Typically, the data source data file is created by the method [ GetCustomDSData()] ( #getcustomdsdata ) .
18251865
1866+ ** Example**
1867+
1868+ ``` javascript
1869+ // Please note, the API only works for TWAIN driver.
1870+ DWObject .SetCustomDSData (" C:\\ Users\\ UserName\\ Desktop\\ ProfileName" );
1871+ ```
1872+
18261873---
18271874
18281875## SetCustomDSDataEx
@@ -1867,6 +1914,11 @@ SetCustomDSDataEx(dsDataString: string): boolean;
18671914
18681915Typically the data source data string is created by the method [ GetCustomDSDataEx()] ( #getcustomdsdataex )
18691916
1917+ ``` javascript
1918+ // Please note, the API only works for TWAIN driver.
1919+ DWObject .SetCustomDSData (" the base64 string of your profile" );
1920+ ```
1921+
18701922---
18711923
18721924## SetFileXferInfo
0 commit comments