Skip to content

Commit b620550

Browse files
authored
Merge pull request #604 from dynamsoft-docs/preview
Preview
2 parents 7a3734a + cfb3ebd commit b620550

File tree

2 files changed

+66
-182
lines changed

2 files changed

+66
-182
lines changed

info/api/WebTwain_Acquire.md

Lines changed: 60 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,23 +1974,23 @@ Example argument for the parameter `fileName`
19741974
- "C:\\webtwain" + <> + ".jpg": The scanned images will result in "C:\\webtwain1.jpg", "C:\\webtwain2.jpg", "C:\\webtwain3.jpg", etc.
19751975
- "C:\\webtwain" + <%06d> + ".jpg": The scanned images will result in "C:\\webtwain000001.jpg", "C:\\webtwain000002.jpg", "C:\\webtwain000003.jpg", etc.
19761976

1977-
Check out the available formats [Dynamsoft.DWT.EnumDWT_FileFormat]({{site.info}}api/Dynamsoft_Enum.html#dynamsoftdwtenumdwt_fileformat-).
1977+
Check out the available formats [Dynamsoft.DWT.EnumDWT_FileFormat]({{site.info}}api/Dynamsoft_Enum.html#dynamsoftdwtenumdwt_fileformat).
19781978

19791979
**Example**
19801980

19811981
```javascript
19821982
DWObject.OpenSource();
19831983
DWObject.TransferMode = Dynamsoft.DWT.EnumDWT_TransferMode.TWSX_FILE;
19841984
if (DWObject.TransferMode === Dynamsoft.DWT.EnumDWT_TransferMode.TWSX_FILE) {
1985-
if (
1986-
DWObject.SetFileXferInfo(
1987-
"C:\\Temp\\WebTWAIN<%06d>.bmp",
1988-
Dynamsoft.DWT.EnumDWT_FileFormat.TWFF_BMP
1989-
)
1990-
) {
1991-
DWObject.IfShowUI = true;
1992-
DWObject.AcquireImage();
1993-
}
1985+
if (
1986+
DWObject.SetFileXferInfo(
1987+
"C:\\Temp\\WebTWAIN<%06d>.bmp",
1988+
Dynamsoft.DWT.EnumDWT_FileFormat.TWFF_BMP
1989+
)
1990+
) {
1991+
DWObject.IfShowUI = true;
1992+
DWObject.AcquireImage();
1993+
}
19941994
}
19951995
```
19961996

@@ -2154,6 +2154,8 @@ The value of this property defaults to `true` , which means that the newly acqui
21542154

21552155
If it's set to `false` , the images will be inserted before the current image. The important thing to note is that, by design, the current image is always the last acquired one which means that the images acquired after setting `IfAppendImage` to `false` will be displayed / retained in the reverse order.
21562156

2157+
Here is an [article]({{site.faq}}insert-new-pages-to-existing-document.html#can-i-insert-newly-scanned-pages-to-an-existing-document) to demonstrate how to insert new images to a specified index.
2158+
21572159
---
21582160

21592161
## IfDisableSourceAfterAcquire
@@ -2194,6 +2196,23 @@ IfDisableSourceAfterAcquire: boolean;
21942196

21952197
This property only makes sense when `IfShowUI` is set to `true` .
21962198

2199+
**Example**
2200+
2201+
```javascript
2202+
DWObject.OpenSource();
2203+
DWObject.IfDisableSourceAfterAcquire = true; // Close the scanner UI after images acquired.
2204+
DWObject.IfShowUI = true;
2205+
DWObject.AcquireImage(successCallback,failureCallback);
2206+
2207+
function successCallback() {
2208+
DWObject.CloseSource();
2209+
}
2210+
2211+
function failureCallback(errorCode, errorString) {
2212+
DWObject.CloseSource();
2213+
}
2214+
```
2215+
21972216
---
21982217

21992218
## IfDuplexEnabled
@@ -2236,6 +2255,18 @@ Set this property after `OpenSource()` and before `AcquireImage()` .
22362255

22372256
Not all scanners support duplex scanning. To confirm, check the user manual of the device or check the value of `Duplex` after `OpenSource()` .
22382257

2258+
**Example**
2259+
2260+
```javascript
2261+
DWObject.OpenSource();
2262+
2263+
if (DWObject.Duplex != 0) { // Note: DWObject.Duplex doesn't support Linux.
2264+
DWObject.IfDuplexEnabled = true;
2265+
}
2266+
2267+
DWObject.AcquireImage();
2268+
```
2269+
22392270
---
22402271

22412272
## IfFeederEnabled
@@ -2278,6 +2309,14 @@ Set this property after `OpenSource()` and before `AcquireImage()` .
22782309

22792310
If the property is set to `true` , the data source will try acquiring images from the document feeder first. If the data source doesn't have a document feeder, the flatbed will be used.
22802311

2312+
**Example**
2313+
2314+
```javascript
2315+
DWObject.OpenSource();
2316+
DWObject.IfFeederEnabled = true;
2317+
DWObject.AcquireImage();
2318+
```
2319+
22812320
---
22822321

22832322
## IfShowUI
@@ -2317,7 +2356,15 @@ IfShowUI: boolean;
23172356

23182357
If the property is set to `true` , the data source will display its user interface when `AcquireImage()` is called. Otherwise, the UI will not be displayed and the scan will start immediately.
23192358

2320-
It's recommended to use this API after OpenSource() is called.
2359+
It's recommended to use this API after `OpenSource()` is called.
2360+
2361+
**Example**
2362+
2363+
```javascript
2364+
DWObject.OpenSource();
2365+
DWObject.IfShowUI = true; // display the scanner UI before acquiring image
2366+
DWObject.AcquireImage();
2367+
```
23212368

23222369
---
23232370

@@ -2346,7 +2393,7 @@ ImageCaptureDriverType: Dynamsoft.DWT.EnumDWT_Driver | number;
23462393

23472394
<tr>
23482395
<td align="center">not supported</td>
2349-
<td align="center">not supported</td>
2396+
<td align="center">v11.0+</td>
23502397
<td align="center">v11.0+</td>
23512398
<td align="center">v11.0+</td>
23522399
<td align="center">not supported</td>
@@ -3907,7 +3954,7 @@ TWSX_NATIVE and TWSX_MEMORY are required by all TWAIN data sources while TWSX_FI
39073954

39083955
## Unit
39093956

3910-
Return or set the unit of measure for all quantities. Note that this setting is only effective for TWAIN (hardware) related operations.
3957+
Return or set the unit of measure for all quantities. Note that this setting is only effective for TWAIN/ICA (hardware) related operations.
39113958

39123959
**Syntax**
39133960

info/api/WebTwain_Viewer.md

Lines changed: 6 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ permalink: /info/api/WebTwain_Viewer.html
3737

3838
| |
3939
| :------------------------------ | :---------------------------- | --------------------------------------- | ------------------------------------------- |
40-
| [`click`](#click) | [`contextmenu`](#contextmenu) | [`dblclick`](#dblclick) | [`mousemove`](#mousemove) |
41-
| [`mousedown`](#mousedown) | [`mouseup`](#mouseup) | [`mouseout`](#mouseout) | [`mouseover`](#mouseover) |
42-
| [`keydown`](#keydown) | [`keyup`](#keyup) | [`pageAreaSelected`](#pageareaselected) | [`pageAreaUnselected`](#pageareaunselected) |
43-
| [`pageRendered`](#pagerendered) | [`resize`](#resize) |
40+
| [`Events`](#events) |
4441

4542
---
4643

@@ -426,16 +423,7 @@ Generate a independent ThumbnailViewer object.
426423

427424
**Syntax**
428425

429-
<div class="sample-code-prefix template2"></div>
430-
431-
>- 17.3+
432-
>- 17.2.5
433-
>
434426
```typescript
435-
/**
436-
*
437-
* @param thumbnailViewerSettings Configure the ThumbnailViewer object
438-
*/
439427
createThumbnailViewer(
440428
thumbnailViewerSettings?: ThumbnailViewerSettings
441429
): ThumbnailViewer;
@@ -635,165 +623,13 @@ interface ViewMode {
635623
scrollDirection?: string;
636624
}
637625
```
638-
```typescript
639-
/**
640-
 * Generate a independent ThumbnailViewer object.
641-
 * @param thumbnailViewerSettings Configure the ThumbnailViewer object
642-
*/
643-
createThumbnailViewer(
644-
thumbnailViewerSettings?: thumbnailViewerSettings
645-
): ThumbnailViewer;
646-
interface ThumbnailViewer {
647-
/**
648-
* Show the ThumbnailViewer object.
649-
*/
650-
show(): boolean;
651-
/**
652-
* Hide the ThumbnailViewer object.
653-
*/
654-
hide(): boolean;
655-
/**
656-
* Remove the ThumbnailViewer object.
657-
*/
658-
dispose(): boolean;
659-
/**
660-
* Change the view mode of the thumbnail viewer.
661-
* @param viewMode Specify the new mode.
662-
*/
663-
updateViewMode(viewMode: ViewMode): void;
664-
/**
665-
* Bind a listner to the specified event. You can bind one or multiple listeners to the same event.
666-
* @param eventName Specify the event name.
667-
* @param callback Specify the listner.
668-
*/
669-
on(eventName: string, callback: (event: ThumbnailViewerEvent | KeyboardEvent, domEvent?: MouseEvent) => void): void;
670-
/**
671-
* Unbind event listener(s) from the specified viewer event.
672-
* @param eventName Specify the event.
673-
* @param callback Specify the listener to remove
674-
*/
675-
off(eventName: string, callback?: () => void): void;
676-
/**
677-
* Whether to allow keyboard control. Default: true.
678-
*/
679-
allowKeyboardControl: boolean;
680-
/**
681-
* Whether to allow page dragging to reorder the pages.
682-
* Default: true.
683-
*/
684-
allowPageDragging: boolean;
685-
/**
686-
* Whether to allow resizing of the thumbnail viewer.
687-
* Default: false.
688-
*/
689-
allowResizing: boolean;
690-
/**
691-
* Set or return the CSS rule for the background of the thumbnail viewer.
692-
* Default: "rgb(255, 255, 255)".
693-
*/
694-
background: string;
695-
/**
696-
* Set or return the CSS rule for the border of the thumbnail viewer.
697-
* Default: "".
698-
*/
699-
border: string;
700-
/**
701-
* Set or return the CSS rule for the background of the page the mouse hovers over in the thumbnail viewer.
702-
* Default: "rgb(239, 246, 253)".
703-
*/
704-
hoverPageBackground: string;
705-
/**
706-
* Set or return the CSS rule for the border of the page the mouse hovers over in the thumbnail viewer.
707-
* Default: "1px solid rgb(238, 238, 238)".
708-
*/
709-
hoverPageBorder: string;
710-
/**
711-
* Set or return the location of the thumbnail viewer. Allowed values are "left", "right", "top", "bottom".
712-
* Default: "left".
713-
*/
714-
location: string;
715-
/**
716-
* Set or return the CSS rule for the background of a normal page in the thumbnail viewer.
717-
* Default: "transparent".
718-
*/
719-
pageBackground: string;
720-
/**
721-
* Set or return the CSS rule for the border of a normal page in the thumbnail viewer.
722-
* Default: "1px solid rgb(238, 238, 238)".
723-
*/
724-
pageBorder: string;
725-
/**
726-
* Set or return the margin between two adjacent images and the margin between an image and the border of the thumbnail viewer. The value can either be in pixels or percentage.
727-
* Default: 10.
728-
*/
729-
pageMargin: number | string;
730-
/**
731-
* Set or return the CSS rule for the background of the placeholder which appears when you drag page(s) to reorder them in the thumbnail viewer.
732-
* Default: "rgb(251, 236, 136)".
733-
*/
734-
placeholderBackground: string;
735-
/**
736-
* Set or return whether the pages are arranged vertically or horizontally.
737-
* Default: "vertical". Allowed values are "vertical" and "horizontal".
738-
*/
739-
scrollDirection: string;
740-
/**
741-
* Set or return the CSS rule for the background of the selected page(s) in the thumbnail viewer.
742-
* Default: "rgb(199, 222, 252)".
743-
*/
744-
selectedPageBackground: string;
745-
/**
746-
* Set or return the CSS rule for the border of the selected page(s) in the thumbnail viewer.
747-
* Default: "1px solid rgb(125,162,206)".
748-
*/
749-
selectedPageBorder: string;
750-
/**
751-
* Set or return whether page numbers are shown.
752-
* Default: false.
753-
*/
754-
showPageNumber: boolean;
755-
/**
756-
* Set or return the size of the thumbnail viewer. The value can either be in pixels or percentage (based on the width or height of the entire viewer).
757-
* Default: "30%".
758-
*/
759-
size: number | string;
760-
/**
761-
* Set whether to select the index in the upper left corner of the viewer when scrolling.
762-
* Default: false.
763-
*/
764-
autoChangeIndex: boolean;
765-
/**
766-
* Show checkbox on image(s).
767-
*/
768-
showCheckbox: boolean;
769-
};
770-
interface ThumbnailViewerEvent {
771-
// The index of the current page.
772-
index: number;
773-
// The x-coordinate of the browser page.
774-
pageX: number;
775-
// The y-coordinate of the browser page.
776-
pageY: number;
777-
};
778-
interface ViewMode {
779-
/**
780-
* Specify the number of images per row.
781-
*/
782-
columns: number;
783-
/**
784-
* Specify the number of images per column.
785-
*/
786-
rows: number;
787-
/**
788-
* Set or return whether the pages are arranged vertically or horizontally.
789-
* Default: "vertical". Allowed values are "vertical" and "horizontal".
790-
*/
791-
scrollDirection: string;
792-
}
793-
```
794626

627+
**Parameters**
628+
629+
`thumbnailViewerSettings`: Configure the ThumbnailViewer object
795630

796631
**Availability**
632+
797633
<div class="availability">
798634
<table>
799635

@@ -1230,6 +1066,7 @@ Viewer.on(
12301066
**Parameters**
12311067

12321068
`eventName`: Specify the event name.
1069+
12331070
`callback`: Specify the listner.
12341071

12351072
**Availability**

0 commit comments

Comments
 (0)