# Interface: DocumentScannerConfig

[Mobile Document Scanner API Reference](../index.md) / DocumentScannerConfig

# Interface: DocumentScannerConfig

Defined in: [src/DocumentScanner.ts:104](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L104)

The `DocumentScannerConfig` interface passes settings to the [DocumentScanner](../classes/DocumentScanner.md) constructor to apply a comprehensive set of UI and business logic customizations.

## Remarks

Only advanced scenarios require editing the UI template or MDS source code. [DocumentScannerConfig.license](#license) is the only property required to instantiate a [DocumentScanner](../classes/DocumentScanner.md) object. MDS uses sensible default values for all other omitted properties.

## Example

```typescript
const config = {
    license: "YOUR_LICENSE_KEY_HERE",
    scannerViewConfig: {
        cameraEnhancerUIPath: "./dist/document-scanner.ui.xml", // Use the local file
    },
    engineResourcePaths: {
        std: "./dist/libs/dynamsoft-capture-vision-std/dist/",
        dip: "./dist/libs/dynamsoft-image-processing/dist/",
        core: "./dist/libs/dynamsoft-core/dist/",
        license: "./dist/libs/dynamsoft-license/dist/",
        cvr: "./dist/libs/dynamsoft-capture-vision-router/dist/",
        ddn: "./dist/libs/dynamsoft-document-normalizer/dist/",
    },
};
```

## Properties

### container?

> `optional` **container?**: `string` \| `HTMLElement`

Defined in: [src/DocumentScanner.ts:119](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L119)

The container element or selector for the [DocumentScanner](../classes/DocumentScanner.md) UI.

***

### correctionViewConfig?

> `optional` **correctionViewConfig?**: `Omit`\<[`DocumentCorrectionViewConfig`](DocumentCorrectionViewConfig.md), `"templateFilePath"` \| `"utilizedTemplateNames"` \| `"_showCorrectionView"`\>

Defined in: [src/DocumentScanner.ts:174](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L174)

***

### enableContinuousScanning?

> `optional` **enableContinuousScanning?**: `boolean`

Defined in: [src/DocumentScanner.ts:206](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L206)

Enable continuous scanning mode where the scanner can loop back to capture more documents instead of exiting after a single scan. [DocumentScanner.launch](../classes/DocumentScanner.md#launch) only resolves to the last scanned result. Use [onDocumentScanned](#ondocumentscanned) callback to get scan results.

#### Remarks

When enabled:
- The result view shows a "Scan More" button alongside "Done"; tapping "Scan More" loops back to capture another document, while "Done" ends the session
- The [onDocumentScanned](#ondocumentscanned) callback triggers after each scan with the result; this is the only way to get the scanned results as [DocumentScanner.launch](../classes/DocumentScanner.md#launch) only returns the last scanned result
- Users can also exit by clicking the close button (X) or by calling [DocumentScanner.stopContinuousScanning](../classes/DocumentScanner.md#stopcontinuousscanning)
- The DocumentScanner only retains the most recent scan result
- A thumbnail preview of the last scan appears in the camera view, but only when both [showCorrectionView](#showcorrectionview) and [showResultView](#showresultview) are disabled (otherwise scans route through those views instead). See [onThumbnailClicked](#onthumbnailclicked) to make it clickable.

#### Default Value

```ts
false
@public
```

***

### enableFrameVerification?

> `optional` **enableFrameVerification?**: `boolean`

Defined in: [src/DocumentScanner.ts:272](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L272)

Enable automatic frame verification for best quality capture.

#### Remarks

When enabled, uses clarity detection and cross-filtering to automatically find the clearest frame.
This uses the same algorithm as the React reference implementation.

#### Default Value

```ts
true
@public
```

***

### engineResourcePaths?

> `optional` **engineResourcePaths?**: `EngineResourcePaths`

Defined in: [src/DocumentScanner.ts:152](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L152)

Paths to the necessary engine resources (such as `.wasm` files) for the scanning engine.

#### Remarks

The default paths point to CDNs so this may be left unset. You may set custom paths to self-host resources or fully self-host MDS.

#### See

[Self-hosting resources](https://www.dynamsoft.com/mobile-document-scanner/docs/web/guide/index.html#self-host-resources)

***

### license?

> `optional` **license?**: `string`

Defined in: [src/DocumentScanner.ts:113](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L113)

The license key for using the [DocumentScanner](../classes/DocumentScanner.md).

#### Remarks

This is the only required property to instantiate a [DocumentScanner](../classes/DocumentScanner.md) object.

***

### onDocumentScanned?

> `optional` **onDocumentScanned?**: (`result`) => `void` \| `Promise`\<`void`\>

Defined in: [src/DocumentScanner.ts:230](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L230)

Callback invoked after each successful scan in continuous scanning mode.

#### Parameters

##### result

[`DocumentResult`](DocumentResult.md)

The [DocumentResult](DocumentResult.md) of the scan

#### Returns

`void` \| `Promise`\<`void`\>

#### Remarks

This callback is only called when [enableContinuousScanning](#enablecontinuousscanning) is true, after each scan the user keeps (via either "Scan More" or "Done"). The callback receives a [DocumentResult](DocumentResult.md) containing the original image, corrected image, detected boundaries, and scan status.

#### Example

```javascript
const documentScanner = new Dynamsoft.DocumentScanner({
    license: "YOUR_LICENSE_KEY_HERE",
    enableContinuousScanning: true,
    onDocumentScanned: async (result) => {
        // Process each scanned document
        const canvas = result.correctedImageResult.toCanvas();
        document.getElementById("results").appendChild(canvas);
    }
});
```

***

### onThumbnailClicked?

> `optional` **onThumbnailClicked?**: (`result`) => `void` \| `Promise`\<`void`\>

Defined in: [src/DocumentScanner.ts:261](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L261)

Callback invoked when the thumbnail preview is clicked in continuous scanning mode.

#### Parameters

##### result

[`DocumentResult`](DocumentResult.md)

The [DocumentResult](DocumentResult.md) of the last scanned document

#### Returns

`void` \| `Promise`\<`void`\>

#### Remarks

The thumbnail preview itself only appears (and this callback only fires) when:
- [enableContinuousScanning](#enablecontinuousscanning) is enabled
- [showCorrectionView](#showcorrectionview) is disabled
- [showResultView](#showresultview) is disabled

The thumbnail displays the most recently scanned document. Defining this callback also gives it a primary-coloured border and pointer cursor; without it, clicking does nothing. Use it to implement custom behaviour such as re-editing the image.

#### Example

```javascript
const documentScanner = new Dynamsoft.DocumentScanner({
    license: "YOUR_LICENSE_KEY_HERE",
    enableContinuousScanning: true,
    showCorrectionView: false,
    showResultView: false,
    onThumbnailClicked: async (result) => {
        // Handle thumbnail click event
        console.log('Thumbnail clicked', result);
        // Could open a custom editor, display metadata, etc.
    }
});
```

***

### resultViewConfig?

> `optional` **resultViewConfig?**: [`DocumentResultViewConfig`](DocumentResultViewConfig.md)

Defined in: [src/DocumentScanner.ts:173](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L173)

Configuration settings for the [DocumentResultView](../classes/DocumentResultView.md).

#### Remarks

#### See

[Workflow customization](https://www.dynamsoft.com/mobile-document-scanner/docs/web/guide/index.html#workflow-customization)

***

### scannerViewConfig?

> `optional` **scannerViewConfig?**: `Omit`\<[`DocumentScannerViewConfig`](DocumentScannerViewConfig.md), `"templateFilePath"` \| `"utilizedTemplateNames"` \| `"_showCorrectionView"`\>

Defined in: [src/DocumentScanner.ts:161](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L161)

Configuration settings for the [DocumentScannerView](../classes/DocumentScannerView.md).

#### Remarks

#### See

[Workflow customization](https://www.dynamsoft.com/mobile-document-scanner/docs/web/guide/index.html#workflow-customization)

***

### showCorrectionView?

> `optional` **showCorrectionView?**: `boolean`

Defined in: [src/DocumentScanner.ts:191](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L191)

Sets the visibility of the [DocumentCorrectionView](../classes/DocumentNormalizerView.md).

#### Default Value

```ts
true
@public
```

***

### showResultView?

> `optional` **showResultView?**: `boolean`

Defined in: [src/DocumentScanner.ts:184](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L184)

Sets the visibility of the [DocumentResultView](../classes/DocumentResultView.md).

#### Default Value

```ts
true
@public
```

***

### stringConfig?

> `optional` **stringConfig?**: [`StringConfig`](StringConfig.md)

Defined in: [src/DocumentScanner.ts:323](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L323)

Override the default user-facing strings (loading messages, share dialog
title, download filename prefix, alert text, etc.).

#### Remarks

Toolbar button labels (Re-take, Apply, Done, Share, Upload, Correction, Full
Image, Detect Borders) are not configured here — use
[DocumentCorrectionViewConfig.toolbarButtonsConfig](DocumentCorrectionViewConfig.md#toolbarbuttonsconfig) and
[DocumentResultViewConfig.toolbarButtonsConfig](DocumentResultViewConfig.md#toolbarbuttonsconfig) for those.

The resolved string config is process-global: instantiating a new
[DocumentScanner](../classes/DocumentScanner.md) replaces any previously applied config. Running two
scanners with different `stringConfig` values in the same page is not
supported — the most recently constructed scanner wins for all of them.

#### See

[StringConfig](StringConfig.md) for the full list of customizable strings.

#### Example

```typescript
new Dynamsoft.DocumentScanner({
    license: "YOUR_LICENSE_KEY_HERE",
    stringConfig: {
        loadingMsg: "Cargando...",
        continuousScanDoneBtn: "Listo ({count})",
        downloadFilenamePrefix: "invoice",
    }
});
```

***

### templateFilePath?

> `optional` **templateFilePath?**: `string`

Defined in: [src/DocumentScanner.ts:129](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L129)

The file path to the Capture Vision template used for document scanning.

#### Remarks

You may set custom paths to self-host the template or fully self-host MDS.

#### See

[Self-hosting resources](https://www.dynamsoft.com/mobile-document-scanner/docs/web/guide/index.html#self-host-resources)

***

### themeColor?

> `optional` **themeColor?**: [`ThemeColor`](ThemeColor.md)

Defined in: [src/DocumentScanner.ts:291](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L291)

Override the default colors used across all views and the loading screen.

#### See

[ThemeColor](ThemeColor.md) for the full list of themeable fields.

#### Example

```typescript
new Dynamsoft.DocumentScanner({
    license: "YOUR_LICENSE_KEY_HERE",
    themeColor: {
        primary: "#0066cc",
        backgroundView: "#1a1a1a",
    }
});
```

***

### utilizedTemplateNames?

> `optional` **utilizedTemplateNames?**: [`UtilizedTemplateNames`](UtilizedTemplateNames.md)

Defined in: [src/DocumentScanner.ts:142](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/DocumentScanner.ts#L142)

Capture Vision template names for document detection and normalization.

#### Remarks

This typically does not need to be set as MDS provides a default template for general use. You may set custom names to self-host resources or fully self-host MDS.

#### See

 - [Self-hosting resources](https://www.dynamsoft.com/mobile-document-scanner/docs/web/guide/index.html#self-host-resources)
 - [DCV templates](https://www.dynamsoft.com/capture-vision/docs/core/parameters/file/capture-vision-template.html?lang=javascript)

#### Default Value

`DEFAULT_TEMPLATE_NAMES`
