Skip to content

Commit ec767e1

Browse files
authored
Merge pull request #93 from dynamsoft-docs/preview
update to internal commit 7148a361
2 parents dc1171f + 64a8a01 commit ec767e1

File tree

4 files changed

+175
-82
lines changed

4 files changed

+175
-82
lines changed

api/document-scanner.md

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Starts the **document scanning workflow**.
6565

6666
#### Syntax
6767
```typescript
68-
launch(): Promise<DocumentResult>
68+
async launch(file?: File): Promise<DocumentResult>
6969
```
7070

7171
#### Returns
@@ -155,8 +155,16 @@ Configures the scanner view for capturing documents.
155155
#### Syntax
156156
```typescript
157157
interface DocumentScannerViewConfig {
158+
templateFilePath?: string;
158159
cameraEnhancerUIPath?: string;
159-
container?: HTMLElement;
160+
container?: HTMLElement | string;
161+
utilizedTemplateNames?: UtilizedTemplateNames;
162+
enableAutoCropMode?: boolean;
163+
enableSmartCaptureMode?: boolean;
164+
scanRegion: ScanRegion;
165+
minVerifiedFramesForAutoCapture: number;
166+
showSubfooter?: boolean;
167+
showPoweredByDynamsoft?: boolean;
160168
}
161169
```
162170

@@ -170,8 +178,10 @@ interface DocumentScannerViewConfig {
170178
| `utilizedTemplateNames` | `UtilizedTemplateNames` | Capture Vision template names for detection and correction. |
171179
| `enableAutoCropMode` | `boolean` | The default auto-crop mode state. |
172180
| `enableSmartCaptureMode` | `boolean` | The default smart capture mode state. |
173-
| `scanRegion` | `ScanRegion` | Defines the region within the viewport to detect documents. |
181+
| `scanRegion` | [`ScanRegion`](#scanregion) | Defines the region within the viewport to detect documents. |
174182
| `minVerifiedFramesForAutoCapture` | `number` | The minimum number of camera frames to detect document boundaries on Smart Capture mode. |
183+
| `showSubfooter` | `boolean` | Mode selector menu visibility. |
184+
| `showPoweredByDynamsoft` | `boolean` | Visibility of the Dynamsoft branding message. |
175185

176186
#### Example
177187

@@ -279,6 +289,60 @@ interface DocumentResult {
279289
| `correctedImageResult` | `NormalizedImageResultItem \| DSImageData` | The processed (corrected) image. |
280290
| `detectedQuadrilateral` | `Quadrilateral` | The detected document boundaries. |
281291

292+
### `ScanRegion`
293+
294+
Describes the scan region within the viewfinder for document scanning:
295+
296+
1. Use the `ratio` property to set the height-to-width of the rectangular scanning region, then scale the rectangle up to fit within the viewfinder.
297+
2. Translate the rectangular up by the number of pixels specified by `regionBottomMargin`.
298+
3. Create a visual border for the scanning region boundary on the viewfinder with a given stroke width in pixels, and a stroke color.
299+
300+
#### Syntax
301+
302+
```typescript
303+
interface ScanRegion {
304+
ratio: {
305+
width: number;
306+
height: number;
307+
};
308+
regionBottomMargin: number; // Bottom margin calculated in pixel
309+
style: {
310+
strokeWidth: number;
311+
strokeColor: string;
312+
};
313+
}
314+
```
315+
316+
#### Properties
317+
318+
| Property | Type | Description |
319+
| -------------------- | -------- | ---------------------------------------------------------- |
320+
| `ratio` | `object` | The aspect ratio of the rectangular scan region. |
321+
| »`height` | `number` | The height of the rectangular scan region. |
322+
| »`width` | `number` | The width of the rectangular scan region. |
323+
| `regionBottomMargin` | `number` | Bottom margin below the scan region measured in pixels. |
324+
| »`strokeWidth` | `number` | The pixel width of the outline of the scan region. |
325+
| »`strokeColor` | `string` | The color of the outline of the scan region. |
326+
| `style` | `object` | The styling for the scan region outline in the viewfinder. |
327+
328+
#### Example
329+
330+
Create a scan region with a height-to-width ratio of 3:2, translated upwards by 20 pixels, with a green, 3 pixel-wide border in the viewfinder:
331+
332+
```javascript
333+
scanRegion {
334+
ratio: {
335+
width: 2;
336+
height: 3;
337+
};
338+
regionBottomMargin: 20;
339+
style: {
340+
strokeWidth: 3;
341+
strokeColor: "green";
342+
};
343+
}
344+
```
345+
282346
## Toolbar Button Configurations
283347

284348
### `ToolbarButtonConfig`

api/mobile-web-capture.md

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ constructor(config: MobileWebCaptureConfig)
4545

4646
#### Parameters
4747

48-
| Parameter | Type | Description |
49-
| --------- | ------------------------ | ---------------------------------------------------- |
50-
| `config` | `MobileWebCaptureConfig` | The configuration settings for **MobileWebCapture**. |
48+
| Parameter | Type | Description |
49+
| --------- | --------------------------------------------------- | ---------------------------------------------------- |
50+
| `config` | [`MobileWebCaptureConfig`](#mobilewebcaptureconfig) | The configuration settings for **MobileWebCapture**. |
5151

5252
#### Example
5353
```javascript
@@ -73,14 +73,15 @@ Starts the **Mobile Web Capture** workflow.
7373

7474
#### Syntax
7575
```typescript
76-
launch(file?: File | string): Promise<void>
76+
async launch(file?: File | string, view?: EnumMWCStartingViews)
7777
```
7878

7979
#### Parameters
8080

81-
| Parameter | Type | Description |
82-
| --------- | --------------------------- | ------------------------------------------ |
83-
| `file` | `File \| string` (optional) | A file or document name to open at launch. |
81+
| Parameter | Type | Description |
82+
| --------- | --------------------------------- | ------------------------------------------ |
83+
| `file` | `File \| string` (optional) | A file or document name to open at launch. |
84+
| `view` | `EnumMWCStartingViews` (optional) | The first View to display upon launch. |
8485

8586
#### Throws
8687
- An error if **MWC** is already running.
@@ -122,7 +123,7 @@ dispose(): Promise<void>
122123
```
123124

124125
#### Example
125-
```typescript
126+
```javascript
126127
await mobileWebCapture.dispose();
127128
console.log("MWC resources released.");
128129
```
@@ -166,7 +167,7 @@ document.getElementById("initialFile").onchange = async function () {
166167
interface MobileWebCaptureConfig {
167168
license?: string;
168169
container?: HTMLElement | string;
169-
exportConfig?: ExportConffig;
170+
exportConfig?: ExportConfig;
170171
showLibraryView?: boolean;
171172
onClose?: () => void;
172173

@@ -184,23 +185,25 @@ interface MobileWebCaptureConfig {
184185

185186
#### Properties
186187

187-
| Property | Type | Description |
188-
| ----------------------- | ----------------------- | -------------------------------------------------------------------------------- |
189-
| `license` | `string` | The license key for using **Mobile Web Capture (MWC)**. |
190-
| `container` | `HTMLElement \| string` | The container element or selector for rendering the `MobileWebCapture` instance. |
191-
| `exportConfig` | `ExportConfig` | Configuration for exporting captured documents. |
192-
| `showLibraryView` | `boolean` | Determines if the **LibraryView** is shown (default: `true`). |
193-
| `onClose` | `() => void` | Callback function triggered when the `MobileWebCapture` instance is closed. |
194-
| `libraryViewConfig` | `LibraryViewConfig` | Configuration for the **LibraryView**. |
195-
| `documentViewConfig` | `DocumentViewConfig` | Configuration for the **DocumentView**. |
196-
| `pageViewConfig` | `PageViewConfig` | Configuration for the **PageView**. |
197-
| `transferViewConfig` | `TransferViewConfig` | Configuration for the **TransferView**. |
198-
| `historyViewConfig` | `HistoryViewConfig` | Configuration for the **HistoryView**. |
199-
| `documentScannerConfig` | `DocumentScannerConfig` | Configuration for the built-in **DocumentScanner**. |
188+
| Property | Type | Description |
189+
| ----------------------- | ------------------------------------------- | -------------------------------------------------------------------------------- |
190+
| `license` | `string` | The license key for using **Mobile Web Capture (MWC)**. |
191+
| `container` | `HTMLElement \| string` | The container element or selector for rendering the `MobileWebCapture` instance. |
192+
| `ddvResourcePath` | `string` | File path to DDV resources. |
193+
| `exportConfig` | [`ExportConfig`](#exportconfig) | Configuration for exporting captured documents. |
194+
| `showLibraryView` | `boolean` | Determines if the **LibraryView** is shown (default: `true`). |
195+
| `onClose` | `() => void` | Callback function triggered when the `MobileWebCapture` instance is closed. |
196+
| `libraryViewConfig` | [`LibraryViewConfig`](#libraryviewconfig) | Configuration for the **LibraryView**. |
197+
| `documentViewConfig` | [`DocumentViewConfig`](#documentviewconfig) | Configuration for the **DocumentView**. |
198+
| `pageViewConfig` | [`PageViewConfig`](#pageviewconfig) | Configuration for the **PageView**. |
199+
| `transferViewConfig` | [`TransferViewConfig`](#transferviewconfig) | Configuration for the **TransferView**. |
200+
| `transferViewConfig` | [`TransferViewConfig`](#transferviewconfig) | Configuration for the **TransferView**. |
201+
| `scanner` | [`MWCScanner`](#mwcscanner) | Configured document scanner module (uses DDS by default). |
202+
| `documentScannerConfig` | `DocumentScannerConfig` | Configuration for the built-in **DocumentScanner**. |
200203

201204
##### See Also
202205

203-
- [DocumentScannerConfig](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig)
206+
- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig)
204207

205208
#### Example
206209

@@ -236,10 +239,10 @@ interface LibraryViewConfig {
236239

237240
#### Properties
238241

239-
| Property | Type | Description |
240-
| ---------------------- | ----------------------------- | ---------------------------------------------------------------------------- |
241-
| `emptyContentConfig` | `EmptyContentConfig` | Configuration for the content displayed on the empty **LibraryView** screen. |
242-
| `toolbarButtonsConfig` | `LibraryToolbarButtonsConfig` | Configuration for the toolbar buttons in **LibraryView**. |
242+
| Property | Type | Description |
243+
| ---------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------- |
244+
| `emptyContentConfig` | `EmptyContentConfig` | Configuration for the content displayed on the empty **LibraryView** screen. |
245+
| `toolbarButtonsConfig` | [`LibraryToolbarButtonsConfig`](#librarytoolbarbuttonsconfig) | Configuration for the toolbar buttons in **LibraryView**. |
243246

244247
#### Example 1: Display A Message In An Empty Library
245248

@@ -293,10 +296,10 @@ interface DocumentViewConfig {
293296

294297
#### Properties
295298

296-
| Property | Type | Description |
297-
| ---------------------- | ------------------------------ | ----------------------------------------------------------------------------- |
298-
| `emptyContentConfig` | `EmptyContentConfig` | Configuration for the content displayed on the empty **DocumentView** screen. |
299-
| `toolbarButtonsConfig` | `DocumentToolbarButtonsConfig` | Configuration for the toolbar buttons in **DocumentView**. |
299+
| Property | Type | Description |
300+
| ---------------------- | --------------------------------------------------------------- | ----------------------------------------------------------------------------- |
301+
| `emptyContentConfig` | `EmptyContentConfig` | Configuration for the content displayed on the empty **DocumentView** screen. |
302+
| `toolbarButtonsConfig` | [`DocumentToolbarButtonsConfig`](#documenttoolbarbuttonsconfig) | Configuration for the toolbar buttons in **DocumentView**. |
300303

301304
#### Example 1: Display A Message In An Empty Document
302305

@@ -418,10 +421,10 @@ interface HistoryViewConfig {
418421

419422
#### Properties
420423

421-
| Property | Type | Description |
422-
| ---------------------- | ----------------------------- | ---------------------------------------------------------------------------- |
423-
| `emptyContentConfig` | `EmptyContentConfig` | Configuration for the content displayed on the empty **HistoryView** screen. |
424-
| `toolbarButtonsConfig` | `HistoryToolbarButtonsConfig` | Configuration for the toolbar buttons in **HistoryView**. |
424+
| Property | Type | Description |
425+
| ---------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------- |
426+
| `emptyContentConfig` | `EmptyContentConfig` | Configuration for the content displayed on the empty **HistoryView** screen. |
427+
| `toolbarButtonsConfig` | [`HistoryToolbarButtonsConfig`](#historytoolbarbuttonsconfig) | Configuration for the toolbar buttons in **HistoryView**. |
425428

426429
### `TransferViewConfig`
427430

@@ -434,9 +437,9 @@ interface TransferViewConfig {
434437

435438
#### Properties
436439

437-
| Property | Type | Description |
438-
| ---------------------- | ------------------------------ | ---------------------------------------------------------- |
439-
| `toolbarButtonsConfig` | `TransferToolbarButtonsConfig` | Configuration for the toolbar buttons in **TransferView**. |
440+
| Property | Type | Description |
441+
| ---------------------- | --------------------------------------------------------------- | ---------------------------------------------------------- |
442+
| `toolbarButtonsConfig` | [`TransferToolbarButtonsConfig`](#transfertoolbarbuttonsconfig) | Configuration for the toolbar buttons in **TransferView**. |
440443

441444
## Toolbar Button Configurations
442445

@@ -458,7 +461,7 @@ export type ToolbarButtonConfig = Pick<"icon" | "label" | "isHidden">;
458461
| `isHidden` | `boolean` (optional) | Determines if the button is hidden. |
459462

460463
#### Example
461-
```typescript
464+
```javascript
462465
const mobileWebCapture = new Dynamsoft.MobileWebCapture({
463466
license: "YOUR_LICENSE_KEY_HERE", // Replace this with your actual license key
464467
documentViewConfig: {

guides/document-scanner.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,14 @@ interface ScanRegion {
540540
}
541541
```
542542
543+
API Reference:
544+
545+
[`ScanRegion`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#scanregion)
546+
543547
Here is how the scanning region is set:
544548
545-
1. The `ratio` property sets the height-to-width of the scanning region rectangle, then scales the rectangle up to fit within the viewfinder.
546-
2. Translate this rectangle up by the number of pixels specified by `regionBottomMargin`.
549+
1. Use the `ratio` property to set the height-to-width of the rectangular scanning region, then scale the rectangle up to fit within the viewfinder.
550+
2. Translate the rectangular up by the number of pixels specified by `regionBottomMargin`.
547551
3. Create a visual border for the scanning region boundary on the viewfinder with a given stroke width in pixels, and a stroke color.
548552
549553
For example:

0 commit comments

Comments
 (0)