From 0a0c9ab97a8df9b30f9165c18a57a8746dfdf89d Mon Sep 17 00:00:00 2001 From: DMGithubPublisher Date: Fri, 23 May 2025 06:43:51 +0800 Subject: [PATCH] update to internal commit ad4881c7 --- api/document-scanner-v3.0.md | 32 ++--- api/document-scanner.md | 134 +++++++++++------- api/mobile-web-capture-v3.0.md | 36 ++--- api/mobile-web-capture.md | 108 +++++++++++--- guides/document-scanner.md | 74 +++++----- guides/index.md | 4 +- guides/mobile-web-capture-customization.md | 14 +- guides/mobile-web-capture.md | 14 +- introduction/index.md | 6 +- release-notes/document-scanner.md | 13 ++ .../mobile-web-capture.md | 6 +- web.config | 5 + 12 files changed, 284 insertions(+), 162 deletions(-) create mode 100644 release-notes/document-scanner.md rename releasenotes/index.md => release-notes/mobile-web-capture.md (93%) diff --git a/api/document-scanner-v3.0.md b/api/document-scanner-v3.0.md index 70c530c..6ea94ed 100644 --- a/api/document-scanner-v3.0.md +++ b/api/document-scanner-v3.0.md @@ -116,16 +116,16 @@ interface DocumentScannerConfig { #### Properties -| Property | Type | Description | -| ----------------------- | ------------------------------ | --------------------------------------------------------------- | -| `license` | `string` | The license key for using the `DocumentScanner`. | -| `container` | `HTMLElement \| string` | The container element or selector for the `DocumentScanner` UI. | -| `scannerViewConfig` | `DocumentScannerViewConfig` | Configuration settings for the scanner view. | -| `resultViewConfig` | `DocumentResultViewConfig` | Configuration settings for the result view. | -| `correctionViewConfig` | `DocumentCorrectionViewConfig` | Configuration settings for the correction view. | -| `templateFilePath` | `string` | The file path to the document template used for scanning. | -| `utilizedTemplateNames` | `UtilizedTemplateNames` | Specifies detection and correction templates. | -| `engineResourcePaths` | `EngineResourcePaths` | Paths to the necessary resources for the scanning engine. | +| Property | Type | Description | +| ----------------------- | ------------------------------ | --------------------------------------------------------- | +| `license` | `string` | The license key for using the `DocumentScanner`. | +| `container` | ``HTMLElement | string`` | The container element or selector for the `DocumentScanner` UI. | +| `scannerViewConfig` | `DocumentScannerViewConfig` | Configuration settings for the scanner view. | +| `resultViewConfig` | `DocumentResultViewConfig` | Configuration settings for the result view. | +| `correctionViewConfig` | `DocumentCorrectionViewConfig` | Configuration settings for the correction view. | +| `templateFilePath` | `string` | The file path to the document template used for scanning. | +| `utilizedTemplateNames` | `UtilizedTemplateNames` | Specifies detection and correction templates. | +| `engineResourcePaths` | `EngineResourcePaths` | Paths to the necessary resources for the scanning engine. | #### Example ```typescript @@ -263,12 +263,12 @@ interface DocumentResult { #### Properties -| Property | Type | Description | -| ----------------------- | ------------------------------------------ | ------------------------------------------------------------ | -| `status` | `ResultStatus` | The status of the document scan (success, failed, canceled). | -| `originalImageResult` | `OriginalImageResultItem["imageData"]` | The original captured image before correction. | -| `correctedImageResult` | `NormalizedImageResultItem \| DSImageData` | The processed (corrected) image. | -| `detectedQuadrilateral` | `Quadrilateral` | The detected document boundaries. | +| Property | Type | Description | +| ----------------------- | -------------------------------------- | ------------------------------------------------------------ | +| `status` | `ResultStatus` | The status of the document scan (success, failed, canceled). | +| `originalImageResult` | `OriginalImageResultItem["imageData"]` | The original captured image before correction. | +| `correctedImageResult` | ``NormalizedImageResultItem | DSImageData`` | The processed (corrected) image. | +| `detectedQuadrilateral` | `Quadrilateral` | The detected document boundaries. | ## Toolbar Button Configurations diff --git a/api/document-scanner.md b/api/document-scanner.md index ecb4577..1fbb98f 100644 --- a/api/document-scanner.md +++ b/api/document-scanner.md @@ -32,7 +32,7 @@ The `DocumentScanner` class handles the document scanning process, including ima ## Constructor -### DocumentScanner +### `DocumentScanner` #### Syntax ```typescript @@ -69,7 +69,7 @@ async launch(file?: File): Promise ``` #### Returns -- A `Promise` resolving to a `DocumentResult` object. +- A `Promise` resolving to a [`DocumentResult`](#documentresult) object. #### Example ```typescript @@ -119,16 +119,16 @@ interface DocumentScannerConfig { #### Properties -| Property | Type | Description | -| ----------------------- | ------------------------------ | --------------------------------------------------------------- | -| `license` | `string` | The license key for using the `DocumentScanner`. | -| `container` | `HTMLElement \| string` | The container element or selector for the `DocumentScanner` UI. | -| `scannerViewConfig` | `DocumentScannerViewConfig` | Configuration settings for the scanner view. | -| `resultViewConfig` | `DocumentResultViewConfig` | Configuration settings for the result view. | -| `correctionViewConfig` | `DocumentCorrectionViewConfig` | Configuration settings for the correction view. | -| `templateFilePath` | `string` | The file path to the document template used for scanning. | -| `utilizedTemplateNames` | `UtilizedTemplateNames` | Specifies detection and correction templates. | -| `engineResourcePaths` | `EngineResourcePaths` | Paths to the necessary resources for the scanning engine. | +| Property | Type | Description | +| ----------------------- | --------------------------------------------------------------- | --------------------------------------------------------- | +| `license` | `string` | The license key for using the `DocumentScanner`. | +| `container` | ``HTMLElement | string`` | The container element or selector for the `DocumentScanner` UI. | +| `scannerViewConfig` | [`DocumentScannerViewConfig`](#documentscannerconfig) | Configuration settings for the scanner view. | +| `resultViewConfig` | [`DocumentResultViewConfig`](#documentresultviewconfig) | Configuration settings for the result view. | +| `correctionViewConfig` | [`DocumentCorrectionViewConfig`](#documentcorrectionviewconfig) | Configuration settings for the correction view. | +| `templateFilePath` | `string` | The file path to the document template used for scanning. | +| `utilizedTemplateNames` | [`UtilizedTemplateNames`](#utilizedtemplatenames) | Specifies detection and correction templates. | +| `engineResourcePaths` | [`EngineResourcePaths`](#engineresourcepaths) | Paths to the necessary resources for the scanning engine. | #### Example ```typescript @@ -170,18 +170,18 @@ interface DocumentScannerViewConfig { #### Properties -| Property | Type | Description | -| --------------------------------- | ----------------------- | ---------------------------------------------------------------------------------------- | -| `templateFilePath` | `string` | Path to a Capture Vision template for scanning configuration. | -| `cameraEnhancerUIPath` | `string` | Path to the UI (`.html` template file) for the scanner view. | -| `container` | `HTMLElement` | The container element for the scanner view. | -| `utilizedTemplateNames` | `UtilizedTemplateNames` | Capture Vision template names for detection and correction. | -| `enableAutoCropMode` | `boolean` | The default auto-crop mode state. | -| `enableSmartCaptureMode` | `boolean` | The default smart capture mode state. | -| `scanRegion` | [`ScanRegion`](#scanregion) | Defines the region within the viewport to detect documents. | -| `minVerifiedFramesForAutoCapture` | `number` | The minimum number of camera frames to detect document boundaries on Smart Capture mode. | -| `showSubfooter` | `boolean` | Mode selector menu visibility. | -| `showPoweredByDynamsoft` | `boolean` | Visibility of the Dynamsoft branding message. | +| Property | Type | Description | +| --------------------------------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `templateFilePath` | `string` | Path to a Capture Vision template for scanning configuration. | +| `cameraEnhancerUIPath` | `string` | Path to the UI (`.html` template file) for the scanner view. | +| `container` | `HTMLElement` | The container element for the scanner view. | +| `utilizedTemplateNames` | `[`UtilizedTemplateNames`](#utilizedtemplatenames)` | Capture Vision template names for detection and correction. | +| `enableAutoCropMode` | `boolean` | The default auto-crop mode state. | +| `enableSmartCaptureMode` | `boolean` | The default smart capture mode state. | +| `scanRegion` | [`ScanRegion`](#scanregion) | Defines the region within the viewport to detect documents. | +| `minVerifiedFramesForAutoCapture` | `number` | The minimum number of camera frames to detect document boundaries on Smart Capture mode. | +| `showSubfooter` | `boolean` | Mode selector menu visibility. | +| `showPoweredByDynamsoft` | `boolean` | Visibility of the Dynamsoft branding message. | #### Example @@ -209,11 +209,11 @@ interface DocumentCorrectionViewConfig { #### Properties -| Property | Type | Description | -| ---------------------- | -------------------------------------------- | --------------------------------------------------------- | -| `container` | `HTMLElement` | The container element for the correction view. | -| `toolbarButtonsConfig` | `DocumentCorrectionViewToolbarButtonsConfig` | Configuration for toolbar buttons in the correction view. | -| `onFinish` | `(result: DocumentResult) => void` | Callback function triggered when correction is finished. | +| Property | Type | Description | +| ---------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------- | +| `container` | `HTMLElement` | The container element for the correction view. | +| `toolbarButtonsConfig` | [`DocumentCorrectionViewToolbarButtonsConfig`](#documentcorrectionviewtoolbarbuttonsconfig) | Configuration for toolbar buttons in the correction view. | +| `onFinish` | `(result: DocumentResult) => void` | Callback function triggered when correction is finished. | #### Example @@ -245,12 +245,12 @@ interface DocumentResultViewConfig { #### Properties -| Property | Type | Description | -| ---------------------- | ------------------------------------------- | ----------------------------------------------------------- | -| `container` | `HTMLElement` | The container element for the result view. | -| `toolbarButtonsConfig` | `DocumentResultViewToolbarButtonsConfig` | Configuration for toolbar buttons in the result view. | -| `onDone` | `(result: DocumentResult) => Promise` | Callback function triggered when scanning is done. | -| `onUpload` | `(result: DocumentResult) => Promise` | Callback function triggered when uploading the scan result. | +| Property | Type | Description | +| ---------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------- | +| `container` | `HTMLElement` | The container element for the result view. | +| `toolbarButtonsConfig` | [`DocumentResultViewToolbarButtonsConfig`](#documentresultviewtoolbarbuttonsconfig) | Configuration for toolbar buttons in the result view. | +| `onDone` | `(result: DocumentResult) => Promise` | Callback function triggered when scanning is done. | +| `onUpload` | `(result: DocumentResult) => Promise` | Callback function triggered when uploading the scan result. | #### Example ```javascript @@ -282,12 +282,12 @@ interface DocumentResult { #### Properties -| Property | Type | Description | -| ----------------------- | ------------------------------------------ | ------------------------------------------------------------ | -| `status` | `ResultStatus` | The status of the document scan (success, failed, canceled). | -| `originalImageResult` | `OriginalImageResultItem["imageData"]` | The original captured image before correction. | -| `correctedImageResult` | `NormalizedImageResultItem \| DSImageData` | The processed (corrected) image. | -| `detectedQuadrilateral` | `Quadrilateral` | The detected document boundaries. | +| Property | Type | Description | +| ----------------------- | ------------------------------------------- | ------------------------------------------------------------ | +| `status` | `ResultStatus` | The status of the document scan (success, failed, canceled). | +| `originalImageResult` | `OriginalImageResultItem["imageData"]` | The original captured image before correction. | +| `correctedImageResult` | ``NormalizedImageResultItem | DSImageData`` | The processed (corrected) image. | +| `detectedQuadrilateral` | `Quadrilateral` | The detected document boundaries. | ### `ScanRegion` @@ -383,15 +383,8 @@ const documentScanner = new Dynamsoft.DocumentScanner({ ### Configurable Buttons Per Each View #### DocumentCorrectionViewToolbarButtonsConfig -```typescript -interface DocumentCorrectionViewToolbarButtonsConfig { - fullImage?: ToolbarButtonConfig; - detectBorders?: ToolbarButtonConfig; - apply?: ToolbarButtonConfig; -} -``` -#### DocumentCorrectionViewToolbarButtonsConfig +##### Syntax ```typescript interface DocumentCorrectionViewToolbarButtonsConfig { @@ -403,6 +396,8 @@ interface DocumentCorrectionViewToolbarButtonsConfig { #### DocumentResultViewToolbarButtonsConfig +##### Syntax + ```typescript interface DocumentResultViewToolbarButtonsConfig { retake?: ToolbarButtonConfig; @@ -413,3 +408,44 @@ interface DocumentResultViewToolbarButtonsConfig { } ``` +## Assisting Interfaces + +### `UtilizedTemplateNames` + +[Dynamsoft Capture Vision template](https://www.dynamsoft.com/capture-vision/docs/core/parameters/file/capture-vision-template.html?lang=javascript) names for detection and correction. This typically does not need to be set, as DDS uses the default template. + +#### Syntax + +```typescript +interface UtilizedTemplateNames { + detect: string; + normalize: string; +} +``` + +### `EngineResourcePaths` + +Paths to extra resources such as `.wasm` engine files. The default paths point to CDNs and so may be left unset. You may set custom paths for the purpose of [self-hosting resources]({{ site.guides }}mobile-web-capture-customization.html#self-hosting-resource-files). + +#### Syntax + +```typescript +interface EngineResourcePaths { + "rootDirectory"?: string; + "std"?: string | PathInfo; + "dip"?: string | PathInfo; + "dnn"?: string | PathInfo; + "core"?: string | PathInfo; + "license"?: string | PathInfo; + "cvr"?: string | PathInfo; + "utility"?: string | PathInfo; + "dbr"?: string | PathInfo; + "dlr"?: string | PathInfo; + "ddn"?: string | PathInfo; + "dcp"?: string | PathInfo; + "dce"?: string | PathInfo; + "dlrData"?: string | PathInfo; + "ddv"?: string | PathInfo; + "dwt"?: string | DwtInfo; +} +``` \ No newline at end of file diff --git a/api/mobile-web-capture-v3.0.md b/api/mobile-web-capture-v3.0.md index d72ff75..263bdf2 100644 --- a/api/mobile-web-capture-v3.0.md +++ b/api/mobile-web-capture-v3.0.md @@ -78,9 +78,9 @@ launch(file?: File | string): Promise #### Parameters -| Parameter | Type | Description | -| --------- | --------------------------- | ------------------------------------------ | -| `file` | `File \| string` (optional) | A file or document name to open at launch. | +| Parameter | Type | Description | +| --------- | ----------------------------- | ------------------------------------------ | +| `file` | ``File \| string`` (optional) | A file or document name to open at launch. | #### Throws - An error if **MWC** is already running. @@ -166,7 +166,7 @@ document.getElementById("initialFile").onchange = async function () { interface MobileWebCaptureConfig { license?: string; container?: HTMLElement | string; - exportConfig?: ExportConffig; + exportConfig?: ExportConfig; showLibraryView?: boolean; onClose?: () => void; @@ -184,19 +184,19 @@ interface MobileWebCaptureConfig { #### Properties -| Property | Type | Description | -| ----------------------- | ----------------------- | -------------------------------------------------------------------------------- | -| `license` | `string` | The license key for using **Mobile Web Capture (MWC)**. | -| `container` | `HTMLElement \| string` | The container element or selector for rendering the `MobileWebCapture` instance. | -| `exportConfig` | `ExportConfig` | Configuration for exporting captured documents. | -| `showLibraryView` | `boolean` | Determines if the **LibraryView** is shown (default: `true`). | -| `onClose` | `() => void` | Callback function triggered when the `MobileWebCapture` instance is closed. | -| `libraryViewConfig` | `LibraryViewConfig` | Configuration for the **LibraryView**. | -| `documentViewConfig` | `DocumentViewConfig` | Configuration for the **DocumentView**. | -| `pageViewConfig` | `PageViewConfig` | Configuration for the **PageView**. | -| `transferViewConfig` | `TransferViewConfig` | Configuration for the **TransferView**. | -| `historyViewConfig` | `HistoryViewConfig` | Configuration for the **HistoryView**. | -| `documentScannerConfig` | `DocumentScannerConfig` | Configuration for the built-in **DocumentScanner**. | +| Property | Type | Description | +| ----------------------- | ----------------------- | --------------------------------------------------------------------------- | +| `license` | `string` | The license key for using **Mobile Web Capture (MWC)**. | +| `container` | ``HTMLElement | string`` | The container element or selector for rendering the `MobileWebCapture` instance. | +| `exportConfig` | `ExportConfig` | Configuration for exporting captured documents. | +| `showLibraryView` | `boolean` | Determines if the **LibraryView** is shown (default: `true`). | +| `onClose` | `() => void` | Callback function triggered when the `MobileWebCapture` instance is closed. | +| `libraryViewConfig` | `LibraryViewConfig` | Configuration for the **LibraryView**. | +| `documentViewConfig` | `DocumentViewConfig` | Configuration for the **DocumentView**. | +| `pageViewConfig` | `PageViewConfig` | Configuration for the **PageView**. | +| `transferViewConfig` | `TransferViewConfig` | Configuration for the **TransferView**. | +| `historyViewConfig` | `HistoryViewConfig` | Configuration for the **HistoryView**. | +| `documentScannerConfig` | `DocumentScannerConfig` | Configuration for the built-in **DocumentScanner**. | ##### See Also @@ -605,7 +605,7 @@ const uploadToServer = async (fileName, blob) => { formData.append("uploadFile", blob, fileName); // Upload file const response = await fetch( - `${host}/upload`, // Change this to your actul upload URL + `${host}/upload`, // Change this to your actual upload URL { method: "POST", body: formData, diff --git a/api/mobile-web-capture.md b/api/mobile-web-capture.md index fbe6fff..a5d9056 100644 --- a/api/mobile-web-capture.md +++ b/api/mobile-web-capture.md @@ -78,10 +78,10 @@ async launch(file?: File | string, view?: EnumMWCStartingViews) #### Parameters -| Parameter | Type | Description | -| --------- | --------------------------------- | ------------------------------------------ | -| `file` | `File \| string` (optional) | A file or document name to open at launch. | -| `view` | `EnumMWCStartingViews` (optional) | The first View to display upon launch. | +| Parameter | Type | Description | +| --------- | ---------------------------------------------------------- | ------------------------------------------ | +| `file` | ``File | string`` (optional) | A file or document name to open at launch. | +| `view` | [`EnumMWCStartingViews`](#enummwcstartingviews) (optional) | The first View to display upon launch. | #### Throws - An error if **MWC** is already running. @@ -188,7 +188,7 @@ interface MobileWebCaptureConfig { | Property | Type | Description | | ----------------------- | ------------------------------------------- | -------------------------------------------------------------------------------- | | `license` | `string` | The license key for using **Mobile Web Capture (MWC)**. | -| `container` | `HTMLElement \| string` | The container element or selector for rendering the `MobileWebCapture` instance. | +| `container` | ``HTMLElement | string`` | The container element or selector for rendering the `MobileWebCapture` instance. | | `ddvResourcePath` | `string` | File path to DDV resources. | | `exportConfig` | [`ExportConfig`](#exportconfig) | Configuration for exporting captured documents. | | `showLibraryView` | `boolean` | Determines if the **LibraryView** is shown (default: `true`). | @@ -203,7 +203,7 @@ interface MobileWebCaptureConfig { ##### See Also -- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) +- [`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) #### Example @@ -241,16 +241,16 @@ interface LibraryViewConfig { | Property | Type | Description | | ---------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `emptyContentConfig` | `EmptyContentConfig` | Configuration for the content displayed on the empty **LibraryView** screen. | +| `emptyContentConfig` | [`EmptyContentConfig`](#emptycontentconfig) | Configuration for the content displayed on the empty **LibraryView** screen. | | `toolbarButtonsConfig` | [`LibraryToolbarButtonsConfig`](#librarytoolbarbuttonsconfig) | Configuration for the toolbar buttons in **LibraryView**. | #### Example 1: Display A Message In An Empty Library By default, the `LibraryView` displays the following when empty: -![Empty Library View](https://www.dynamsoft.com/mobile-web-capture/docs/assets/imgs/empty-library-view.png) +![Empty Library View]({{ site.assets }}imgs/empty-library-view.png) -You can customize its appearance using the `emptyContentConfig` property. +You can customize its appearance using the [`emptyContentConfig`](#emptycontentconfig) property. ```html
Create Your First Document!
@@ -298,7 +298,7 @@ interface DocumentViewConfig { | Property | Type | Description | | ---------------------- | --------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `emptyContentConfig` | `EmptyContentConfig` | Configuration for the content displayed on the empty **DocumentView** screen. | +| `emptyContentConfig` | [`EmptyContentConfig`](#emptycontentconfig) | Configuration for the content displayed on the empty **DocumentView** screen. | | `toolbarButtonsConfig` | [`DocumentToolbarButtonsConfig`](#documenttoolbarbuttonsconfig) | Configuration for the toolbar buttons in **DocumentView**. | #### Example 1: Display A Message In An Empty Document @@ -307,7 +307,7 @@ By default, the `DocumentView` displays the following when empty: ![Empty Document View](https://www.dynamsoft.com/mobile-web-capture/docs/assets/imgs/empty-document-view.png) -You can customize its appearance using the `emptyContentConfig` property. +You can customize its appearance using the [`emptyContentConfig`](#emptycontentconfig) property. ```html
Start Your Document!
@@ -372,10 +372,10 @@ interface PageViewConfig { #### Properties -| Property | Type | Description | -| ------------------------------ | --------------------------------- | -------------------------------------------------- | -| `toolbarButtonsConfig` | `PageViewToolbarButtonsConfig` | Configuration for toolbar buttons in **PageView**. | -| `annotationToolbarLabelConfig` | `DDVAnnotationToolbarLabelConfig` | Configuration for annotation toolbar labels. | +| Property | Type | Description | +| ------------------------------ | ---------------------------------------------------------------------- | -------------------------------------------------- | +| `toolbarButtonsConfig` | [`PageViewToolbarButtonsConfig`](#pageviewtoolbarbuttonsconfig) | Configuration for toolbar buttons in **PageView**. | +| `annotationToolbarLabelConfig` | [`DDVAnnotationToolbarLabelConfig`](#ddvannotationstoolbarlabelconfig) | Configuration for annotation toolbar labels. | #### Example 1: Disable Upload in PageView @@ -423,7 +423,7 @@ interface HistoryViewConfig { | Property | Type | Description | | ---------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `emptyContentConfig` | `EmptyContentConfig` | Configuration for the content displayed on the empty **HistoryView** screen. | +| `emptyContentConfig` | [`EmptyContentConfig`](#emptycontentconfig) | Configuration for the content displayed on the empty **HistoryView** screen. | | `toolbarButtonsConfig` | [`HistoryToolbarButtonsConfig`](#historytoolbarbuttonsconfig) | Configuration for the toolbar buttons in **HistoryView**. | ### `TransferViewConfig` @@ -552,6 +552,31 @@ interface TransferToolbarButtonsConfig { } ``` +#### `DDVAnnotationsToolbarLabelConfig` + +```typescript +interface DDVAnnotationToolbarLabelConfig { + Undo: string; + Redo: string; + SelectAnnotation: string; + EraseAnnotation: string; + RectAnnotation: string; + EllipseAnnotation: string; + PolygonAnnotation: string; + PolylineAnnotation: string; + LineAnnotation: string; + InkAnnotation: string; + TextBoxAnnotation: string; + TextTypewriterAnnotation: string; + StampIconAnnotation: string; + StampImageAnnotation: string; + BringForward: string; + BringToFront: string; + SendBackward: string; + SendToBack: string; +} +``` + ## Assisting Interfaces ### `ExportConfig` @@ -565,7 +590,7 @@ The `ExportConfig` interface defines methods for handling document export functi Uploads a document to the server. The function receives the document's file name and its binary data (`Blob`). It returns a `Promise` that resolves with `void` or an `UploadedDocument` object. > [!IMPORTANT] -> Returning `{ status: "success" }` in this function is required to trigger [onUploadSuccess](#onuploadsuccess) +> Returning `{ status: "success" }` in this function is required to trigger [`onUploadSuccess`](#onuploadsuccess) ###### **Type** ```typescript @@ -592,10 +617,10 @@ Deletes a document from the server. The function receives an `UploadedDocument` ##### `onUploadSuccess` -Called after a successful upload. It receives the file name, file type, the current view (`EnumMWCViews`), and the binary data (`Blob`). The function should return a `Promise` that resolves to `true` if the `MobileWebCapture` instance should close after uploading or `false` if it should remain open. +Called after a successful upload. It receives the file name, file type, the current view ([`EnumMWCViews`](#enummwcviews)), and the binary data (`Blob`). The function should return a `Promise` that resolves to `true` if the `MobileWebCapture` instance should close after uploading or `false` if it should remain open. > [!IMPORTANT] -> Returning `{ status: "success" }` in [uploadToServer](#uploadtoserver) is required to trigger this function. +> Returning `{ status: "success" }` in [`uploadToServer`](#uploadtoserver) is required to trigger this function. ###### **Type** ```typescript @@ -612,7 +637,7 @@ const uploadToServer = async (fileName, blob) => { formData.append("uploadFile", blob, fileName); // Upload file const response = await fetch( - `${host}/upload`, // Change this to your actul upload URL + `${host}/upload`, // Change this to your actual upload URL { method: "POST", body: formData, @@ -686,4 +711,47 @@ Destructor for the scanner object. ```typescript dispose(): void +``` + +### `EmptyContentConfig` + +Configuration for the content displayed on an empty View screen. + +#### Syntax + +```typescript +type EmptyContentConfig = + | string + | HTMLElement + | HTMLTemplateElement + | { + templatePath: string; // Path to HTML template file + }; +``` + +## Enums + +### `EnumMWCViews` + +#### Type + +```typescript +enum EnumMWCViews { + Library = "library", + Page = "page", + Document = "document", + Transfer = "transfer", + History = "history", + Scanner = "Scanner", +} +``` + +### `EnumMWCStartingViews` + +Use with [`MobileWebCaptureConfig`](#mobilewebcaptureconfig) to set which View to show first upon launching MWC. + +#### Type + +```typescript +type EnumMWCStartingViews = EnumMWCViews.Library | EnumMWCViews.Document | EnumMWCViews.Scanner ``` \ No newline at end of file diff --git a/guides/document-scanner.md b/guides/document-scanner.md index 3c7a35e..c73cadd 100644 --- a/guides/document-scanner.md +++ b/guides/document-scanner.md @@ -11,7 +11,7 @@ description: Dynamsoft Document Scanner User Guide # Scan Single-Page Documents with Dynamsoft Document Scanner > [!TIP] -> Prerequisite: Read the [Introduction](https://www.dynamsoft.com/mobile-web-capture/docs/introduction/index.html) before proceeding. +> Prerequisite: Read the [Introduction]({{ site.introduction }}index.html) before proceeding. **Dynamsoft Document Scanner (DDS)** is an SDK designed for scanning single-page documents. It not only captures images of the documents but also enhances their quality to professional standards, making it an ideal tool for mobile document scanning. @@ -209,7 +209,7 @@ const documentScanner = new Dynamsoft.DocumentScanner({ API Reference: -- [`DocumentScanner()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscanner) +- [`DocumentScanner()`]({{ site.api }}document-scanner.html#documentscanner) This step creates the **DDS** UI, which occupies the entire visible area of the browser window by default when launched. If needed, you can specify a container to restrict the UI's size. For more details, refer to [Confine DocumentScanner UI to a Specific Container](#example-1-confine-documentscanner-ui-to-a-specific-container). @@ -224,7 +224,7 @@ const result = await documentScanner.launch(); API Reference: -- [`launch()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#launch) +- [`launch()`]({{ site.api }}document-scanner.html#launch) This step launches the user into the document scanning workflow, beginning in the `DocumentScannerView`, where they can scan a document using one of three methods: @@ -251,7 +251,7 @@ The workflow returns a scanned image object of type `CorrectedImageResult`. To d API Reference: -- [`DocumentResult`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentresult) +- [`DocumentResult`]({{ site.api }}document-scanner.html#documentresult) The following code clears the result container and displays the scanned result as a canvas: @@ -271,7 +271,7 @@ This section builds on the Hello World sample to demonstrate how to configure ** ### `DocumentScannerConfig` Overview -[`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) is the primary configuration object for customizing **DDS**. It includes the following properties: +[`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) is the primary configuration object for customizing **DDS**. It includes the following properties: 1. `license`: The license key. 2. `container`: The HTML container for the entire workflow. If not specified (like in the Hello World Sample), one is created automatically. @@ -350,8 +350,8 @@ const documentScanner = new Dynamsoft.DocumentScanner({ API Reference: -- [`DocumentScanner()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscanner) -- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) +- [`DocumentScanner()`]({{ site.api }}document-scanner.html#documentscanner) +- [`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) #### Example 2: Only Show `DocumentScannerView` @@ -367,8 +367,8 @@ const documentScanner = new Dynamsoft.DocumentScanner({ API Reference: -- [`DocumentScanner()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscanner) -- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) +- [`DocumentScanner()`]({{ site.api }}document-scanner.html#documentscanner) +- [`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) #### Example 3: Specify Individual View Containers @@ -397,8 +397,8 @@ const documentScanner = new Dynamsoft.DocumentScanner({ API Reference: -- [`DocumentScanner()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscanner) -- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) +- [`DocumentScanner()`]({{ site.api }}document-scanner.html#documentscanner) +- [`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) #### Example 4: Scan Static Image Directly @@ -465,9 +465,9 @@ const documentScanner = new Dynamsoft.DocumentScanner({ API Reference: -- [`DocumentScanner()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscanner) -- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) -- [`DocumentScannerViewConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerviewconfig) +- [`DocumentScanner()`]({{ site.api }}document-scanner.html#documentscanner) +- [`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) +- [`DocumentScannerViewConfig`]({{ site.api }}document-scanner.html#documentscannerviewconfig) ### View-Based Customization @@ -518,9 +518,9 @@ This file defines the UI for `DocumentScannerView`. However, since files on the API Reference: -- [`DocumentScanner()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscanner) -- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) -- [`DocumentScannerViewConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerviewconfig) +- [`DocumentScanner()`]({{ site.api }}document-scanner.html#documentscanner) +- [`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) +- [`DocumentScannerViewConfig`]({{ site.api }}document-scanner.html#documentscannerviewconfig) ##### Customizing the Scanning Region @@ -542,7 +542,7 @@ interface ScanRegion { API Reference: -[`ScanRegion`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#scanregion) +[`ScanRegion`]({{ site.api }}document-scanner.html#scanregion) Here is how the scanning region is set: @@ -616,9 +616,9 @@ const documentScanner = new Dynamsoft.DocumentScanner({ API Reference: -- [`DocumentScanner()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscanner) -- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) -- [`DocumentCorrectionViewConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentcorrectionviewconfig) +- [`DocumentScanner()`]({{ site.api }}document-scanner.html#documentscanner) +- [`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) +- [`DocumentCorrectionViewConfig`]({{ site.api }}document-scanner.html#documentcorrectionviewconfig) ##### Customizing Apply Button Callback @@ -638,9 +638,9 @@ const documentScanner = new Dynamsoft.DocumentScanner({ API Reference: -- [`DocumentScanner()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscanner) -- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) -- [`DocumentCorrectionViewConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentcorrectionviewconfig) +- [`DocumentScanner()`]({{ site.api }}document-scanner.html#documentscanner) +- [`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) +- [`DocumentCorrectionViewConfig`]({{ site.api }}document-scanner.html#documentcorrectionviewconfig) #### `DocumentResultView` Configuration @@ -694,9 +694,9 @@ const documentScanner = new Dynamsoft.DocumentScanner({ API Reference: -- [`DocumentScanner()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscanner) -- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) -- [`DocumentResultViewConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentresultviewconfig) +- [`DocumentScanner()`]({{ site.api }}document-scanner.html#documentscanner) +- [`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) +- [`DocumentResultViewConfig`]({{ site.api }}document-scanner.html#documentresultviewconfig) ##### Customizing the "Done" Button Callback @@ -717,9 +717,9 @@ const documentScanner = new Dynamsoft.DocumentScanner({ API Reference: -- [`DocumentScanner()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscanner) -- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) -- [`DocumentResultViewConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentresultviewconfig) +- [`DocumentScanner()`]({{ site.api }}document-scanner.html#documentscanner) +- [`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) +- [`DocumentResultViewConfig`]({{ site.api }}document-scanner.html#documentresultviewconfig) ##### Customizing the "Upload" Button @@ -755,9 +755,9 @@ const documentScanner = new Dynamsoft.DocumentScanner({ API Reference: -- [`DocumentScanner()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscanner) -- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) -- [`DocumentResultViewConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentresultviewconfig) +- [`DocumentScanner()`]({{ site.api }}document-scanner.html#documentscanner) +- [`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) +- [`DocumentResultViewConfig`]({{ site.api }}document-scanner.html#documentresultviewconfig) ### Self-Hosting Resource Files @@ -789,9 +789,9 @@ const documentScanner = new Dynamsoft.DocumentScanner({ API Reference: -- [`DocumentScanner()`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscanner) -- [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerconfig) -- [`DocumentScannerViewConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/document-scanner.html#documentscannerviewconfig) +- [`DocumentScanner()`]({{ site.api }}document-scanner.html#documentscanner) +- [`DocumentScannerConfig`]({{ site.api }}document-scanner.html#documentscannerconfig) +- [`DocumentScannerViewConfig`]({{ site.api }}document-scanner.html#documentscannerviewconfig) #### Modify the Build Script @@ -842,4 +842,4 @@ Now, all required files will be **served locally** without relying on a CDN. **DDS** is a fully functional, ready-to-use document scanning SDK with built-in UI layouts. However, to extend its capabilities for multi-page and multi-document processing, as well as advanced editing features, we developed **Mobile Web Capture (MWC)**. -Read on to learn how to use this web-based wrapper SDK in the [MWC Getting Started Guide](https://www.dynamsoft.com/mobile-web-capture/docs/guides/mobile-web-capture.html). +Read on to learn how to use this web-based wrapper SDK in the [MWC Getting Started Guide]({{ site.guides }}mobile-web-capture.html). diff --git a/guides/index.md b/guides/index.md index 108e402..3e2f7f7 100644 --- a/guides/index.md +++ b/guides/index.md @@ -12,8 +12,8 @@ description: Mobile Web Capture User Guide Index Since **MWC** is built on **DDS** and shares its core functionality, we recommend first reading the following guide to understand single-page capturing powered by **DDS**: -- [DDS Developer Guide](https://www.dynamsoft.com/mobile-web-capture/docs/guides/document-scanner.html) +- [DDS Developer Guide]({{ site.guides }}document-scanner.html) Once you're familiar with DDS, proceed to the following guide on **MWC** to explore additional features for multi-page document management, editing, and annotation: -- [MWC Developer Guide](https://www.dynamsoft.com/mobile-web-capture/docs/guides/mobile-web-capture.html) +- [MWC Developer Guide]({{ site.guides }}mobile-web-capture.html) diff --git a/guides/mobile-web-capture-customization.md b/guides/mobile-web-capture-customization.md index e3893d0..840887d 100644 --- a/guides/mobile-web-capture-customization.md +++ b/guides/mobile-web-capture-customization.md @@ -11,7 +11,7 @@ description: Mobile Web Capture User Guide # How to Customize Mobile Web Capture > [!TIP] -> Prerequisites: read the [MWC Getting Started Guide](https://www.dynamsoft.com/mobile-web-capture/docs/guides/mobile-web-capture.html) before proceeding. +> Prerequisites: read the [MWC Getting Started Guide]({{ site.guides }}mobile-web-capture.html) before proceeding. This guide expands on the **Hello World** sample from the **MWC Getting Started Guide** and explores the available customization options. @@ -51,7 +51,7 @@ Keep TOC only for npm /github as readme 4. `onUploadSuccess`: Specifies a function that is triggered when the upload operation succeeds. 4. `showLibraryView`: Configures where or not this **MWC** instance starts with the `LibraryView`. 5. `onClose`: Specifies a function that is triggered when the user closes this **MWC** instance. -6. `documentScannerConfig`: Configures the behavior of the built-in `DocumentScanner` instance. See the details in [`DocumentScannerConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/guides/document-scanner.html#documentscannerconfig-overview). +6. `documentScannerConfig`: Configures the behavior of the built-in `DocumentScanner` instance. See the details in [`DocumentScannerConfig`]({{ site.guides }}document-scanner.html#documentscannerconfig-overview). 7. `libraryViewConfig`: Configures the library view with the following properties: 1. `emptyContentConfig`: Specifies the content displayed in the library view when it is empty (no document). 2. `toolbarButtonsConfig`: Configures the buttons in the toolbar of the library view. @@ -68,7 +68,7 @@ Keep TOC only for npm /github as readme 2. `toolbarButtonsConfig`: Configures the button in the toolbar of the history view. 12. `ddvResourcePath`: Paths to extra resources such as `.wasm` engine files and CSS files. -API Reference: [`MobileWebCaptureConfig`](https://www.dynamsoft.com/mobile-web-capture/docs/api/mobile-web-capture.html#mobilewebcaptureconfig) +API Reference: [`MobileWebCaptureConfig`]({{ site.api }}mobile-web-capture.html#mobilewebcaptureconfig) ## Overall UI and Workflow Customization @@ -146,8 +146,8 @@ document.getElementById("initialFile").onchange = async function () { ``` API Reference: -- [`hasLaunched`](https://www.dynamsoft.com/mobile-web-capture/docs/api/mobile-web-capture.html#haslaunched) -- [`dispose`](https://www.dynamsoft.com/mobile-web-capture/docs/api/mobile-web-capture.html#dispose) +- [`hasLaunched`]({{ site.api }}mobile-web-capture.html#haslaunched) +- [`dispose`]({{ site.api }}mobile-web-capture.html#dispose) ### Scan Directly to Document @@ -331,7 +331,7 @@ interface DocumentViewConfig { By default, the `DocumentView` displays the following when empty: -![Empty Document View](https://www.dynamsoft.com/mobile-web-capture/docs/assets/imgs/empty-document-view.png) +![Empty Document View]({{ site.assets }}imgs/empty-document-view.png) You can customize its appearance using the `emptyContentConfig` property. @@ -404,7 +404,7 @@ interface LibraryViewConfig { By default, the `LibraryView` displays the following when empty: -![Empty Library View](https://www.dynamsoft.com/mobile-web-capture/docs/assets/imgs/empty-library-view.png) +![Empty Library View]({{ site.assets }}imgs/empty-library-view.png) You can customize its appearance using the `emptyContentConfig` property. diff --git a/guides/mobile-web-capture.md b/guides/mobile-web-capture.md index 40b37f3..323cf41 100644 --- a/guides/mobile-web-capture.md +++ b/guides/mobile-web-capture.md @@ -11,7 +11,7 @@ description: Mobile Web Capture User Guide # Scan Multi-Page Documents with Mobile Web Capture > [!TIP] -> Prerequisites: read the [Introduction](https://www.dynamsoft.com/mobile-web-capture/docs/introduction/index.html) before proceeding. +> Prerequisites: read the [Introduction]({{ site.introduction }}index.html) before proceeding. **Mobile Web Capture (MWC)** is an SDK designed for scanning multi-page documents. It integrates **Dynamsoft Document Scanner (DDS)** functionality while offering additional features such as multi-document management, annotation, and uploading, making it a comprehensive solution for managing complex document workflows. @@ -21,7 +21,7 @@ description: Mobile Web Capture User Guide This guide walks you through building a web application that scans multi-page documents using **MWC**, with **pre-defined configurations**. > [!TIP] -> If you are looking for a solution that scans single-page documents, please read [Dynamsoft Document Scanner User Guide](https://www.dynamsoft.com/mobile-web-capture/docs/guides/document-scanner.html) instead. +> If you are looking for a solution that scans single-page documents, please read [Dynamsoft Document Scanner User Guide]({{ site.guides }}document-scanner.html) instead.