---
title: Dynamic Web TWAIN SDK Support
description: Dynamic Web TWAIN SDK Documentation Support Page
source_url:
html: https://www.dynamsoft.com/web-twain/docs/about/getsupport.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/about/getsupport.md
---
# How to get support
If you encounter any issues or have any suggestions while using Dynamic Web TWAIN, please feel free to [contact us](https://www.dynamsoft.com/company/contact/) via email, livechat or phone call.
---
title: Dynamic Web TWAIN SDK Resources – Guides & Tools
description: Dynamic Web TWAIN SDK Documentation Resources Page
source_url:
html: https://www.dynamsoft.com/web-twain/docs/about/resources.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/about/resources.md
---
# Resources
## Where to get Dynamic Web TWAIN
* Official installer
> This official package is meant for developers to evaluate the SDK. When the package is installed, you get all the resource files, documentation, and samples. A 30-day free trial is included when evaluating our SDK.
* NPM package
> All the files in the DWT package will help you include `Dynamic Web TWAIN` in your web application both as a regular library and as a module. To try our SDK and included samples, a [trial license](#how-do-i-get-a-trial-license) is required.
* YARN package
> Similar to using NPM, you will get all the files in the DWT package.
## Sample code
* Official samples
> We have many prebuilt samples to demonstrate common user scenarios. All samples contain the resource files required in your application. If a sample is hosted on the Dynamsoft website (not Github), then the sample comes with a 30-day free trial license as well. Otherwise, you can [get a trial license](#how-do-i-get-a-trial-license).
* Github repo
> In our repository, we've shared many samples and other projects related to `Dynamic Web TWAIN` . Some of which may be experimental. To try out these samples, a [trial license](#how-do-i-get-a-trial-license) is required.
## How do I get a trial License
Please visit our customer portal to request for a trial license.
## Online Demo
* Official Demo - See Dynamic Web TWAIN in action
## Useful Links
* Price / Online Store
* Online Videos
## Blogs
* Code Pool
* Company Blog
---
title: Agent Skills | Dynamic Web TWAIN Documentation
description: This post teaches you how to use Dynamic Web TWAIN's official agent skills.
source_url:
html: https://www.dynamsoft.com/web-twain/docs/ai/agent-skills.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/ai/agent-skills.md
---
# Agent Skills
Agent Skills are structured instruction files that teach AI agents how to use Dynamic Web TWAIN in your web apps accurately and efficiently. They work with Claude Code, Cursor, Codex, and other AI agents.
You can run the following command to install the skills:
```bash
npx skills add https://github.com/Dynamsoft/web-twain-samples/
```
## Example Prompts
Try the following prompts after installing. Your AI agent will automatically use the installed skills:
| Prompt | Description |
|--------|-------------|
| Please create a component to use Dynamic Web TWAIN for document scanning in this angular app. Just a scan button to perform scanning and view the document in a viewer. | Use Web TWAIN in an existing Angular project. |
| Please write an html file which loads Web TWAIN via CDN. The page contains a scan button, which triggers scanning with the scanner ui. The scanned images are displayed in Web TWAIN's viewer. | Create a plain JavaScript HTML file to scan documents. |
| What is Dynamic Web TWAIN service? | Ask questions about Web TWAIN. |
## Additional Resources
* [GitHub repo](https://github.com/Dynamsoft/web-twain-samples/tree/main/skills)
* [Agent Skills documentation](https://agentskills.io/home)
---
title: AI Overview | Dynamic Web TWAIN Documentation
description: Overview of Dynamic Web TWAIN and AI.
source_url:
html: https://www.dynamsoft.com/web-twain/docs/ai/overview.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/ai/overview.md
---
# AI Overview
AI can answer questions related to Dynamic Web TWAIN and write codes directly. You can utilize AI in several ways.
## How to Use
1. Use the "Ask AI" buttton to ask questions about the SDK.

2. Use the [agent skills](./agent-skills.md) in your AI agent like Claude Code, Codex and Cursor. Skills teach the agent how to include Web TWAIN in your project and use its APIs correctly.
3. Use [llms.txt](/llms.txt) and [llms-full.txt](/llms-full.txt) to provide documentation for large language models (LLMs) and apps that use them.
---
title: Dynamic Web TWAIN Core Concepts - Dynamic Web TWAIN Service
description: This page gives a general introduction to Dynamic Web TWAIN Service, which makes it possible to access imaging devices in the browser.
source_url:
html: https://www.dynamsoft.com/web-twain/docs/core-concepts/Dynamic-Web-TWAIN-Service.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/core-concepts/Dynamic-Web-TWAIN-Service.md
---
# Dynamic Web TWAIN Service
Dynamic Web TWAIN Service (previously known as Dynamsoft Service prior to version 19) is a local service installed on end-user devices to make it possible to access imaging devices in the browser. It also provides other functions like image processing, caching, barcode reading, OCR and system function calls.

To use Dynamic Web TWAIN in the browser, you have to install the service beforehand.
## Other Ways of Accessing Scanners in the Browser
Previously, technologies like ActiveX for Internet Explorer and NPAPI plugins for older versions of Chrome allowed scanner access directly in the browser. However, these technologies are now deprecated. Modern browsers lack built-in APIs for document scanning. While Chrome offers an experimental WebUSB API, it has limited functionality. Therefore, using a local service is currently the most viable solution.
## Related Articles
* [Setting up Dynamic Web TWAIN Service](/_articles/extended-usage/dynamsoft-service-configuration.md)
* [FAQs Related to Dynamic Web TWAIN Service](/_articles/faq/index.md#project-deployment-and-end-user-installation)
* [End-User Guide](/_articles/end-user/index.md)
---
title: Dynamic Web TWAIN Core Concepts - TWAIN
description: This page gives a general introduction to TWAIN, the document scanning API that Dynamic Web TWAIN exposes to the browser environment.
source_url:
html: https://www.dynamsoft.com/web-twain/docs/core-concepts/TWAIN.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/core-concepts/TWAIN.md
---
# TWAIN
TWAIN is a standard for interacting with image devices, like document scanners and cameras. It was created by a small group of software and hardware companies in response to the need for a proposed specification for the imaging industry. Without TWAIN, we have to program for every device. With TWAIN, we only need to create an application that knows TWAIN and it can have access to thousands of TWAIN-compatible devices.
## Architecture
The architecture of TWAIN consists of four layers:
* Application - Dynamic Web TWAIN executes at this layer.
* Protocol - There is a Source Manager working between the application and the Sources.
* Acquisition - The software elements written to control acquisitions are called Sources and reside
primarily in this layer.
* Device - This is the location of traditional low-level device drivers.
## Files
The following files are required to use TWAIN.
### Source Manager
The implementation of the Source Manager differs between the supported systems:
* On Windows
* The Source Manager is a Dynamic Link Library (TWAINDSM.DLL or twain_32.dll for old TWAIN versions).
* The Source Manager can manage simultaneous sessions between an application and many
Sources.
* On Macintosh: The Source Manager is a Mach-O framework (TWAIN.framework, TWAINDSM.framework).
* On Linux
* The Source Manager is a shared library (/usr/local/lib/libtwaindsm.so).
* The Source Manager can manage simultaneous sessions between an application and many
Sources.
Normally, the system has the libraries built-in. Dynamsoft have the DLLs included in its Windows installer by default.
### Source
The implementation of the Source is the same as the implementation of the Source Manager:
* On Windows: The Source is a Dynamic Link Library (DLL) with a .ds extension. You can find the files after installing the driver under "C:\Windows\twain_32" and "C:\Windows\twain_64".
* On Macintosh: The Source is implemented as a bundle (preferably Mach-O) with a .ds extension.
* On Linux: The Source is a shared library (.so) with a .ds extension.
## TWAIN Capabilities
One of TWAIN's benefits is it allows applications to easily interact with a variety of acquisition
devices. This is done using TWAIN capabilities.
TWAIN capabilities are divided into three groups:
* **CAP_xxxx**: Capabilities whose names begin with CAP are capabilities that could apply to any
general Source. Such capabilities include use of automatic document feeders, identification of
the creator of the data, etc.
* **ICAP_xxxx**: Capabilities whose names begin with ICAP are capabilities that apply to image
devices. The "I" stands for image.
* **ACAP_xxxx**: Capabilities whose names begin with ACAP are capabilities that apply to
devices that support audio. The "A" stands for audio.
Here are some capabilities for example:
* **CAP_DEVICEONLINE**: If TRUE, the physical hardware (e.g., scanner, digital camera, image database, etc.) that represents the image source is attached, powered on, and communicating.
* **CAP_FEEDERENABLED**: If TRUE, Source must acquire data from the document feeder acquire area and other feeder capabilities can be used.
* **ICAP_AUTOMATICBORDERDETECTION**: Turns automatic border detection on and off.
You can use this online demo to get and set the capabilities with Dynamic Web TWAIN: .
You can learn more about TWAIN by reading its specifications: .
## Other Document Scanning APIs
Through time, Dynamic Web TWAIN added support for other APIs as well: WIA, SANE, ICA and eSCL. They can be used with the same set of JavaScript APIs.
Here is a table of the APIs and platforms Dynamic Web TWAIN supports.
| | Windows | macOS | Linux |
|-----------|---------|-----|-------|
| **TWAIN** | X | X | |
| **WIA** | X | | |
| **ICA** | | X | |
| **SANE** | | | X |
| **eSCL** | X | X | X |
---
title: Dynamic Web TWAIN Core Concepts - Resource Files
description: This page gives a general introduction to Dynamic Web TWAIN's resource files.
source_url:
html: https://www.dynamsoft.com/web-twain/docs/core-concepts/resource-files.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/core-concepts/resource-files.md
---
# Resource Files
Resource files are the files your web application needs to use.
There are two formats of resource files.
Format 1 is for the traditional vanilla JavaScript development. You can find the files in the [SDK installer](https://www.dynamsoft.com/web-twain/downloads/) or official samples' zip files.
```
Resources
│ dynamsoft.webtwain.config.js
│ dynamsoft.webtwain.initiate.js
│ dynamsoft.webtwain.install.js
│ Readme.txt
│
├─addon
│ dynamsoft.upload.js
│ dynamsoft.webtwain.addon.barcodereader.js
│ dynamsoft.webtwain.addon.pdf.js
│ dynamsoft.webtwain.addon.webcam.js
│
├─dist
│ DynamicWebTWAINServiceSetup-arm64.deb
│ DynamicWebTWAINServiceSetup.deb
│ DynamicWebTWAINServiceSetup.msi
│ DynamicWebTWAINServiceSetup.pkg
│ DynamicWebTWAINServiceSetup.rpm
│ LICENSE
│
└─src
dynamsoft.lts.js
dynamsoft.webtwain.css
dynamsoft.webtwain.viewer.css
dynamsoft.webtwain.viewer.js
```
Format 2 is for usage with package managers and frameworks or CDN references. You can obtain the files via `npm install dwt`.
```
dwt
│ dwt-openapi.yaml
│ legal.txt
│ LICENSE.txt
│ package.json
│ README.md
│
└─dist
│ dynamsoft.webtwain.min.js
│ dynamsoft.webtwain.min.mjs
│
├─dist
│ DynamicWebTWAINServiceSetup-arm64.deb
│ DynamicWebTWAINServiceSetup.deb
│ DynamicWebTWAINServiceSetup.msi
│ DynamicWebTWAINServiceSetup.pkg
│ DynamicWebTWAINServiceSetup.rpm
│ LICENSE
│
├─src
│ dynamsoft.lts.js
│ dynamsoft.webtwain.css
│ dynamsoft.webtwain.viewer.css
│ dynamsoft.webtwain.viewer.js
│
└─types
Addon.BarcodeReader.d.ts
Addon.OCR.d.ts
Addon.OCRKit.d.ts
Addon.OCRPro.d.ts
Addon.PDF.d.ts
Addon.Webcam.d.ts
Dynamsoft.d.ts
Dynamsoft.Enum.d.ts
Dynamsoft.FileUploader.d.ts
index.d.ts
RemoteScan.d.ts
RemoteScan.Viewer.d.ts
tsconfig.json
tslint.json
WebTwain.Acquire.d.ts
WebTwain.Buffer.d.ts
WebTwain.d.ts
WebTwain.Edit.d.ts
WebTwain.IO.d.ts
WebTwain.Util.d.ts
WebTwain.Viewer.d.ts
```
For more detailed information on these files, please refer to the following articles:
* [Loading Library Resources](/_articles/general-usage/resource-loading.md)
* [What are the Resources files? ](/_articles/faq/what-are-the-resources-files.md)
---
title: Dynamic Web TWAIN Core Concepts - Scanner
description: This page gives a general introduction to document scanners, which Dynamic Web TWAIN interacts with.
source_url:
html: https://www.dynamsoft.com/web-twain/docs/core-concepts/scanner.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/core-concepts/scanner.md
---
# Scanner
Scanners are the major object which Dynamic Web TWAIN interacts with. We are going to give a brief introduction to it, focusing on what matters to Dynamic Web TWAIN.
## Scanner Types
### Flatbed Scanner
A flatbed scanner is a type of scanner that provides a glass bed (platen) on which the object to be scanned lies motionless. The scanning element moves horizontally beneath the glass, capturing either the entirety of the platen or a predetermined portion.

Most flatbed scanners work in a reflective way, which shines white light onto the object and reads the intensity and color of light reflected from it. Some flatbed scanners also have transparency adapters (for scanning films and slides). These work differently: the light passes directly through the scanned object. In the scanning application, you can select whether to use the transparent unit or not.
### Sheetfed Scanner
A sheetfed scanner, also known as a document feeder scanner or ADF (Automatic Document Feeder) scanner, uses motor-driven rollers to move individual sheets of paper past a stationary scanning element (or two for duplex scanning). Unlike flatbed scanners, sheetfed scanners are not designed to scan bound materials such as books or magazines, nor are they suitable for materials thicker than standard paper. Their primary advantage is the ability to scan multiple documents quickly and automatically, making them much faster than flatbed scanners for high-volume tasks.

### All-in-One Scanner
All-in-one scanners, commonly found in Multi-Function Printers (MFPs), integrate both a document feeder and a flatbed, offering the versatility of both scanner types in a single device.

### Camera-Based Scanner
Camera-based scanners use one or more digital cameras to capture a document image all at once, typically with an overhead design.

Unlike traditional scanners that scan line-by-line in a controlled environment, camera-based scanners are faster and can handle various materials, including bound books and fragile documents. However, they may be susceptible to issues like perspective distortion, shadows, and inconsistent lighting.
## Special Scanners
There are also scanners designed for specific use cases.
### Check Scanners
Check scanners are equipped with a Magnetic Ink Character Recognition (MICR) unit, which reads the magnetic ink characters printed on checks.
With Dynamic Web TWAIN, you can not only retrieve the scanned image but also obtain the MICR data from the check.
### Scanners with Imprinter / Endorser
Many production scanners can be integrated with a printer or endorser module. This allows them to print text or barcodes directly onto the scanned documents during the scanning process, which is useful for document routing or post-scan sorting.
## Connectivity
Most modern scanners use USB for connection, while older models may use SCSI or a parallel port. Network connectivity (Wi-Fi or Ethernet) is also common, especially in office environments.
## Application Programming Interface
Standardized Application Programming Interfaces (APIs) enable software to communicate with scanners. The most common ones include:
* **TWAIN** – The industry standard API widely used by scanners, especially on Windows.
* **WIA** (Windows Image Acquisition) – An API provided by Microsoft for image acquisition.
* **SANE** (Scanner Access Now Easy) – A free/open-source API primarily used on Linux and macOS.
* **ImageCaptureCore** – A native API provided by Apple for macOS and iOS.
* **ISIS** (Image and Scanner Interface Specification) – A high-performance API often used with high-speed production scanners in enterprise environments.
* **eSCL** – A vendor-neutral, RESTful-based protocol for driverless scanning over a network, commonly used by modern networked scanners and MFPs.
---
title: A connection with the server could not be established
description: A connection with the server could not be established
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/connection-couldnt-be-established.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/connection-couldnt-be-established.md
---
# Error Troubleshooting
## A connection with the server could not be established
### Symptom
When attempting to upload images to your web server, the upload fails and you see this error message.
### Cause
This usually means the client cannot reach the server.
### Resolution
- Verify the HTTP port in your code matches the server’s listening port. Set it with [`HTTPPort`](/_articles/info/api/WebTwain_IO.md#httpport).
- Confirm the server address is reachable (ping it from a client machine). Use either the machine name or IP with `HTTPUpload`.
> Note:
> Both the machine name and the IP address of the server can be used for the [`HTTPUpload`](/_articles/info/api/WebTwain_IO.md#httpupload) method.
---
title: General failure
description: General failure
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/general-failure.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/general-failure.md
---
# ErrorList
## General failure
- Symptom
When scanning an image with Dynamic Web TWAIN, you may receive the error message "General failure" in the ErrorString property.
- Cause
The problem occurs when the source (scanner) is _not_ disabled completely after a scanning session or the source is currently unavailable.
- Resolution
You can reset the existing connections of the source by calling [CloseSource](/_articles/info/api/WebTwain_Acquire.md#closesource){:target="_blank"} & [CloseSourceManager](/_articles/info/api/WebTwain_Acquire.md#closesourcemanager){:target="_blank"} to close the sources existing connections before calling [SelectSource](/_articles/info/api/WebTwain_Acquire.md#selectsource){:target="_blank"}.
```javascript
function AcquireImage() {
DWTObject.CloseSource();
DWTObject.CloseSourceManager();
DWTObject.SelectSource();
DWTObject.OpenSource();
DWTObject.AcquireImage();
}
```
---
title: The handle is in the wrong state for the requested operation
description: The handle is in the wrong state for the requested operation
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/the-handle-is-in-the-wrong-state-for-the-requested-operation.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/the-handle-is-in-the-wrong-state-for-the-requested-operation.md
---
# Error Troubleshooting
## The handle is in the wrong state for the requested operation
### Symptom
When you upload images in Dynamic Web TWAIN's buffer, you may receive the following error messages returned by the ErrorString property:

### Cause
1. The size of the images you are going to upload goes beyond the maximum transferable data size which is defined by the server.
2. The port number of the HTTP server is not defined in your code.
3. The server name is invalid.
### Solution
1. Please reset the maximum transferable data size:
If you are using IIS 6:
1. Start -> Run , type "cmd"
2. Go to "C:\Inetpub\AdminScripts" by typing: cd C:\Inetpub\AdminScripts
3. To view the max request entity allowed:
cscript adsutil.vbs get w3svc/AspMaxRequestEntityAllowed
If you are using IIS:
1. Start -> Run , type "InetMgr" to open IIS 7 Manager
2. {Your WebSite}->Feature View->ASP->Limit Properties
3. Set "Maximum Requesting Entity Body Limit" to a bigger value like "1000000"
To set the max request entity allowed property:
cscript adsutil.vbs set w3svc/AspMaxRequestEntityAllowed 1000000 (You can change the value by yourself.)
If you are using ASP.NET, you can change the value at the following line in the "Web.Config" file.
```javascript
//You can change the value by yourself.
```
If you are using PHP, you can change the value at the following line in the php.ini file.
```javascript
upload_max_filesize = 2M (You can change the value by yourself.)
```
2. Please set the port number of the HTTP server in your code. You can use the [HTTPPort](/_articles/info/api/WebTwain_IO.md#httpport) property to set the port number. Click here for more information about this property.
3. The problem may occur when you use "localhost" as the server name in the HTTP Upload method, when actually, you specified the address of your server using an IP address. In this case, please modify the server name to an available IP address in your code and then try again.

---
title: What are the Resources files?
description: What are the Resources files?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/what-are-the-resources-files.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/what-are-the-resources-files.md
---
# General
## What are the Resources files?
Resources files help you include Dynamic Web TWAIN in your application. The following shows the purpose of these files.
You can typically find the `Resources` folder inside the following locations depending on your platform after using the [installer](https://www.dynamsoft.com/web-twain/downloads/):
- Windows: `C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN SDK {Version Number}\`
- Linux: Within the decompressed file `Dynamic Web TWAIN SDK {Version Number}/`
- macOS: `/Applications/Dynamsoft/Dynamic Web TWAIN SDK {Version Number}/`
> *Resources* is the default name of the folder that contain these files. In the DWT npm package, it's called *dist*.
- [v19.0+](#19plus)
- [v18.1+](#18plus)
- [From v16.0 to v18.0](#18min)
### Default files
* dynamsoft.webtwain.config.js
> This file is used to make basic configuration of the Dynamic Web TWAIN library. It's where you enter the product key for the product and to change the initial viewer size, etc.
* dynamsoft.webtwain.initiate.js
> This file is the core of the Dynamic Web TWAIN library.
* dynamsoft.webtwain.install.js
> This file is used to configure the dialogs which are shown when the Dynamic Web TWAIN library is not installed or needs to be upgraded. This file is already referenced inside the dynamsoft.webtwain.initiate.js
* Readme.txt
* addon
+ dynamsoft.upload.js
> This file contains the functionalities of the Dynamsoft Upload Module.
+ dynamsoft.webtwain.addon.pdf.js
> This file contains the functionalities of the PDF Rasterizer addon.
+ dynamsoft.webtwain.addon.webcam.js
> This file contains the functionalities of the Webcam addon.
+ dynamsoft.webtwain.addon.barcodereader.js
> This file contains the functionalities of the Barcode addon.
* dist
> Under this directory are the installers for the Dynamic Web TWAIN Service which needs to be manually installed on each client machine that uses the Dynamic Web TWAIN library as a service.
- DynamicWebTWAINServiceSetup.deb
> For Linux (Debian)
- DynamicWebTWAINServiceSetup.rpm
> For Linux (Redhat)
- DynamicWebTWAINServiceSetup.msi
> For Windows
- DynamicWebTWAINServiceSetup.pkg
> For macOS
- LICENSE
* src
> These files contain the following functionalities
> - image input & output
> - image decode & encode
> - PDF read & write
> - Viewer & UI
- dynamsoft.lts.js
- dynamsoft.webtwain.css
- dynamsoft.webtwain.viewer.css
- dynamsoft.webtwain.viewer.js
### Default files
* dynamsoft.webtwain.config.js
> This file is used to make basic configuration of the Dynamic Web TWAIN library. It's where you enter the product key for the product and to change the initial viewer size, etc.
* dynamsoft.webtwain.initiate.js
> This file is the core of the Dynamic Web TWAIN library.
* dynamsoft.webtwain.initiate_cus.js
> This file is the core of the Dynamic Web TWAIN customized library, please do not use it if there is no requirement.
* dynamsoft.webtwain.install.js
> This file is used to configure the dialogs which are shown when the Dynamic Web TWAIN library is not installed or needs to be upgraded. This file is already referenced inside the dynamsoft.webtwain.initiate.js
* Readme.txt
* addon
+ dynamsoft.upload.js
> This file contains the functionalities of the Dynamsoft Upload Module.
+ dynamsoft.webtwain.addon.pdf.js
> This file contains the functionalities of the PDF Rasterizer addon.
+ dynamsoft.webtwain.addon.webcam.js
> This file contains the functionalities of the Webcam addon.
+ dynamsoft.webtwain.addon.barcodereader.js
> This file contains the functionalities of the Barcode addon.
* dist
> Under this directory are the installers for the Dynamsoft Service which needs to be manually installed on each client machine that uses the Dynamic Web TWAIN library as a service.
- DynamsoftServiceSetup.deb
> For Linux (Debian)
- DynamsoftServiceSetup.rpm
> For Linux (Redhat)
- DynamsoftServiceSetup.msi
> For Windows
- DynamsoftServiceSetup.pkg
> For macOS
- LICENSE
* src
> These files contain the following functionalities
> - image input & output
> - image decode & encode
> - PDF read & write
> - Viewer & UI
- dynamsoft.lts.js
- dynamsoft.webtwain.activex.js
- dynamsoft.webtwain.css
- dynamsoft.webtwain.viewer.css
- dynamsoft.webtwain.viewer.js
### Default files
* dynamsoft.webtwain.config.js
> This file is used to make basic configuration of the Dynamic Web TWAIN library. It's where you enter the product key for the product and to change the initial viewer size, etc.
* dynamsoft.webtwain.initiate.js
> This file is the core of the Dynamic Web TWAIN library.
* dynamsoft.webtwain.install.js
> This file is used to configure the dialogs which are shown when the Dynamic Web TWAIN library is not installed or needs to be upgraded. This file is already referenced inside the dynamsoft.webtwain.initiate.js
* Readme.txt
* addon
+ dynamsoft.upload.js
> This file contains the functionalities of the Dynamsoft Upload Module.
+ dynamsoft.webtwain.addon.camera.js
> This file contains the functionalities of the Camera addon.
+ dynamsoft.webtwain.addon.pdf.js
> This file contains the functionalities of the PDF Rasterizer addon.
+ dynamsoft.webtwain.addon.webcam.js
> This file contains the functionalities of the Webcam addon.
+ dynamsoft.webtwain.addon.barcodereader.js
> This file contains the functionalities of the Barcode addon.
+ dbrjs
> These files are meant for the barcode reader addon for using by the Camera addon.
- dbr.js
- dbr-7.4.0.1.full.wasm
- dbr-7.4.0.1.full.wasm.js
- dbr-7.4.0.1.worker.js
* dist
> Under this directory are the installers for the Dynamsoft Service which needs to be manually installed on each client machine that uses the Dynamic Web TWAIN library as a service.
- DynamsoftServiceSetup.deb
> For Linux (Debian)
- DynamsoftServiceSetup.rpm
> For Linux (Redhat)
- DynamsoftServiceSetup.msi
> For Windows
- DynamsoftServiceSetup.pkg
> For macOS
- LICENSE
* src
> These files contain the following functionalities
> - image input & output
> - image decode & encode
> - PDF read & write
> - Viewer & UI
- dynamsoft.imageio.js
- dynamsoft.imageio_wasm-.js
- dynamsoft.imagecore-.wasm
- dynamsoft.imageio-.wasm
- dynamsoft.imageProc-.wasm
- dynamsoft.pdfReader-.wasm
- dynamsoft.pdfWriter-.wasm
- dynamsoft.viewer.css
- dynamsoft.viewer.js
- dynamsoft.webtwain.css
### Other Resources files
The following two files are present in the [Dynamic Web TWAIN package](https://github.com/Dynamsoft/Dynamic-Web-TWAIN).
* dynamsoft.webtwain.min.js
> This is an all-in-one JavaScript file that consists of the files dynamsoft.webtwain.initiate.js , dynamsoft.webtwain.config.js , dynamsoft.webtwain.install.js as well as all the add-on JavaScript files. If you include this file in the application, you no longer need to include these constituent files separately.
* dynamsoft.webtwain.min.mjs
> This file is like dynamsoft.webtwain.min.js but is built by the ECMAScript 6 (ES6) standard. It's used by applications (Angular, React, Vue, etc.) that import the `Dynamic Web TWAIN` package as a module.
---
title: What are the differences between TWAIN and WIA?
description: What are the differences between TWAIN and WIA?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/difference-between-Twain-and-wia.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/difference-between-Twain-and-wia.md
---
# Capture/Image Source
## What are the differences between TWAIN and WIA drivers?
TWAIN is the most widely used protocol for physical document scanners. Almost all scanners in the market come with a TWAIN driver and are supported by TWAIN applications like the Dynamic Web TWAIN SDK.
`WIA` stands for Windows Image Acquisition, which is a Microsoft driver model for capturing digital images from various devices, such as scanners, cameras and other imaging devices. The WIA protocol is built-in and supported by Windows OS, so no extra driver installation is required. WIA offers standardized hardware compatibility and a stable driver environment, making it easier to integrate imaging capabilities into web scanning applications.
Prior to Dynamic Web TWAIN version 18.2, WIA drivers are not officially supported. But `WIA` devices can be used by `TWAIN` applications like `Dynamic Web TWAIN` through a `TWAIN compatibility layer`. This means `WIA` is not supported natively; therefore, when a device supports both `TWAIN` and `WIA`, `TWAIN` is the better option.
As of Dynamic Web TWAIN version 18.2, we officially support WIA 2.0 drivers. To make sure your web application works with WIA scanner drivers, please refer to the article: [How do I support WIA scanner drivers in my application?](/_articles/faq/support-wia-scanner-drivers.md){:target="_blank"}
---
title: Download virtual scanner for testing
description: Download virtual scanner for testing
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/download-virtual-scanner-for-testing.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/download-virtual-scanner-for-testing.md
---
# Capture/Image Source
## Download virtual scanner for testing
If you do not have a TWAIN scanner on hand to test the library, you can download and use a virtual scanner created by the TWAIN Working Group.
- [32-bit virtual scanner](https://www.dynamsoft.com/download/TWAIN/twainds.win32.installer.2.1.3.msi)
- [64-bit virtual scanner](https://www.dynamsoft.com/download/TWAIN/twainds.win64.installer.2.1.3.msi)
---
title: How to test if your camera is DirectShow compliant
description: How to test if your camera is DirectShow compliant
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/how-to-test-if-your-camera-is-DirectShow-compliant.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/how-to-test-if-your-camera-is-DirectShow-compliant.md
---
# Capture/Image Source
## How to test if your camera is DirectShow compliant?
- [Recommended] Take advantage of our official demo page
- Open the demo page on Windows
> If you haven't installed the Dynamic Web TWAIN Service, a dialog will show up for you to download and install it.
- Make sure the camera shows up in the device list

- Try showing the video stream and try capturing a frame to see if it works without any errors
* You can also test with a DirectShow utility such as Amcap (obtainable from third-party sources) to confirm the camera works correctly.
---
title: How to test if your device is SANE compliant
description: How to test if your device is SANE compliant
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/how-to-test-if-your-device-is-SANE-compliant.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/how-to-test-if-your-device-is-SANE-compliant.md
---
# Capture/Image Source
## How to test if your device is SANE compliant?
There are 3 ways to verify whether your scanner is SANE compliant.
* [Recommended & Easiest] Take advantage of our official demo page
- Open the [demo page](https://demo.dynamsoft.com/dwt/online_demo_scan.aspx) on [Linux]({{site.getstarted}}platform.html#browsers-on-linux)
> If you haven't installed the Dynamic Web TWAIN Service, a dialog will show up for you to download and install it.
- Make sure the scanner driver shows up in the scanner list

- Try scanning to make sure it works correctly without any errors
* [Recommended] Try the scanner with the XSane app on Linux. Check out the [official guide](http://www.fifi.org/doc/xsane/html/sane-xsane-doc.html)
> [More info>>](/assets/docs/Scanning_with_XSane.pdf)
* Check out the [official list](http://www.sane-project.org/sane-backends-1.0.25.html) of supported scanners.
---
title: How to test if your scanner supports ICA scanning on Mac OS
description: How to test if your scanner supports ICA scanning on Mac OS
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/how-to-test-if-your-scanner-supports-ICA-scanning-on-Mac-OS.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/how-to-test-if-your-scanner-supports-ICA-scanning-on-Mac-OS.md
---
# Capture/Image Source
## How to test if your scanner supports ICA scanning on Mac OS?

`ICA Scanners` refer to image scanners that have drivers designed in accordance with the [ImageCaptureCore Framework](https://developer.apple.com/documentation/imagecapturecore).
### Facts about ICA
- ICA is a framework from Apple designed to "Browse for media devices and control them programmatically from your app."
- ICA is supported on macOS X.
### Is my Scanner ICA Compliant?
There are 3 ways to verify whether your scanner is ICA compliant.
- [Recommended & Easiest] Take advantage of our official demo page
- Open the [demo page](https://demo.dynamsoft.com/dwt/online_demo_scan.aspx) on [macOS]({{site.getstarted}}platform.html#browsers-on-macos)
> If you haven't installed Dynamic Web TWAIN, a dialog will show up for you to download and install it.
- Make sure the scanner driver shows up in the scanner list.

- Try scanning to make sure it works correctly without any errors
* [Recommended] Try the scanner with the ImageCapture app on macOS.
- Find the Image Capture application

- Open the application

- Acquire an image and see how it works

For more info, please check out the [official guide](https://support.apple.com/en-ca/guide/image-capture/imgcp1004/mac).
- Check out the [official list](https://support.apple.com/en-us/HT201465) of supported ICA scanners on MacOS.
---
title: How to use TWACKER to check if your device is TWAIN Compliant
description: How to use TWACKER to check if your device is TWAIN Compliant
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/how-to-use-TWACKER-to-check-if-your-device-is-TWAIN-Compliant.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/how-to-use-TWACKER-to-check-if-your-device-is-TWAIN-Compliant.md
---
# Capture/Image Source
## How to use TWACKER to check if your device is TWAIN Compliant?
- [Recommended] Use the tool called `Twacker` which is developed by the [TWAIN Working Group](https://www.twain.org/)
- Download and install
> Please download the version of TWACKER that matches your driver architecture, not your operating system architecture. In most cases, this will be 32-bit.
- [32-bit](https://download.dynamsoft.com/tool/Twack_32.msi)
- [64-bit](https://download.dynamsoft.com/tool/Twack_64.msi)
- Open the program

- Select your device

> If your device is not listed, please check if the driver is installed. Or, try running `Twacker` as admin to see if it shows up.
- Choose the settings and click the Acquire to start scanning

> If scanning is successful without any errors, then your device should be TWAIN compliant. You can also try other commands to see how it works. If your scanner doesn't work with `TWACKER` , please check your scanner model online and make sure you have installed the (latest) TWAIN driver from its manufacturer.

- Refer to the official [twain-certified-drivers](https://resource.twain.org/twain-certified-drivers/).
> This list is maintained by hardware vendors and may be incomplete. In this case, try the two ways above instead.
---
title: The connection with the server was terminated abnormally
description: The connection with the server was terminated abnormally
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/the-connection-with-the-server-was-terminated-abnormally.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/the-connection-with-the-server-was-terminated-abnormally.md
---
# Error Troubleshooting
## The connection with the server was terminated abnormally
### Symptom
When you upload images from Dynamic Web TWAIN's buffer, you may receive the following error message returned by the ErrorString property:

### Cause
1. The problem may occur when a connection with the server is not available.
2. The size of images you are going to upload goes beyond the maximum transferable data size which is defined by the server.
### Solution
1. Please make sure the address of the server is available. To check this, you can ping the address from a client machine.
Note: Both the machine name and the IP address of the server can be used for the HTTP Upload method.
2. Please make sure you specify the correct port. The default port is 80. If you are using other port, please use HTTPPort to specify it in code.
We recommend you get the Port and Server value this way:
```javascript
strHTTPServer = location.hostname;
WebTWAIN.HTTPPort = location.port == "" ? 80 : location.port;
```
3. Please reset the maximum transferable data size:
- If you are using ASP.NET, you can change the value at the following line in the Web.Config file.
```javascript
//You can change the value by yourself.
```
- If you are using PHP, you can change the value at the following line in the php.ini file
```javascript
upload_max_filesize = 2M //You can change the value by yourself.
```
- If you are using ASP
Scenario #1: using ASP on IIS 6:
1. Start -> Run, type cmd.
2. Go to C:\Inetpub\AdminScripts by typing: cd C:\Inetpub\AdminScripts
3. To view max request entity allowed: cscript adsutil.vbs set w3svc/AspMaxRequestEntityAllowed
Scenario #2: using ASP on IIS 7:
1. Start -> Run , type InetMgr to open IIS 7 Manager
2. {Your WebSite} -> Feature View -> ASP -> Limit Properties
3. Set a bigger value for Maximum Requesting Entity Body Limit, like "1000000"
---
title: How can I change the reference path to the Dynamsoft's resources in my project?
description: How can I change the reference path to the Dynamsoft's resources in my project?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/change-reference-path.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/change-reference-path.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# How can I change the reference path to the Dynamsoft's resources in my project?
This also applies if you see the following errors in browser console, please make sure that the ResourcesPath is set correctly in *dynamsoft.webtwain.config.js* (Step 3 Below).
>{"code": -2803, "message": "Loading the WebTwain JavaScript source files failed."}
>{"code": -2804, "message": "Loading the WebTwain css files failed."}
Scenario: For customers who are using Dynamic Web TWAIN, to change the location of the 'Resources' folder, or to rename it, please following the steps below:
Steps: In the below example we will assume the original Resources folder is located at '../{Project Directory}/Resources', and you want to change it to '../{Project Directory}/Newfolder/ResourcesTest'.
Step 1. Please make sure the structure inside 'Resources' folder stay unchanged.
Step 2. Change the relative path in your page where you reference the js files, for example:
```html
```
Modify as below:
```html
```
Step 3. The same change needs to be done in *dynamsoft.webtwain.config.js* file. Add/uncomment the following line, then change 'Resources' (to 'New folder/ResourcesTest' as in this case):
```javascript
Dynamsoft.DWT.ResourcesPath = "Resources";
```
Modify as below:
```javascript
Dynamsoft.DWT.ResourcesPath = "Newfolder/ResourcesTest";
```
---
title: Is there an easy way to deploy the end-user components to all users?
description: Is there an easy way to deploy the end-user components to all users?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/deploy-to-all-users.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/deploy-to-all-users.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# Is there an easy way to deploy the end-user components to all users?
Yes. The following are the commands for this purpose
- [v19.0+](#19plus)
- [Versions below 19.0](#19min)
- Windows
```shell
msiexec /i "/path/to/DynamicWebTWAINServiceSetup.msi" /qn
```
- macOS
```shell
// Install
sudo installer -pkg /path/to/DynamicWebTWAINServiceSetup.pkg -target /Applications
// Stop service
sudo launchctl unload /Library/LaunchAgents/com.dynamsoft.dynamicwebtwainservicex64.plist
// Start service
launchctl load /Library/LaunchAgents/com.dynamsoft.dynamicwebtwainservicex64.plist
```
- Linux
```shell
sudo dpkg -i /path/to/DynamicWebTWAINServiceSetup.deb
```
or
```shell
sudo rpm -i path/to/DynamicWebTWAINServiceSetup.rpm
```
- Windows
```shell
msiexec /i "/path/to/DynamsoftServiceSetup.msi" /qn
```
- macOS
```shell
// Install
sudo installer -pkg /path/to/DynamsoftServiceSetup.pkg -target /Applications
// Stop service
sudo launchctl unload /Library/LaunchAgents/com.dynamsoft.dynamsoftservicex64.plist
// Start service
launchctl load /Library/LaunchAgents/com.dynamsoft.dynamsoftservicex64.plist
```
- Linux
```shell
sudo dpkg -i /path/to/DynamsoftServiceSetup.deb
```
or
```shell
sudo rpm -i path/to/DynamsoftServiceSetup.rpm
```
And in a controlled environment, Dynamic Web TWAIN can be distributed to all clients in one go just like other similar programs. [Group Policy](https://docs.microsoft.com/en-us/troubleshoot/windows-server/group-policy/use-group-policy-to-install-software) is one such technology.
---
title: How to uninstall Dynamic Web TWAIN Service?
description: How to uninstall Dynamic Web TWAIN Service?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/how-to-uninstall-dynamsoft-service.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/how-to-uninstall-dynamsoft-service.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# How to uninstall Dynamic Web TWAIN Service?
- [v19.0+](#19plus)
- [Versions below 19.0](#19min)
### On Windows
1.
* Remove Dynamic Web TWAIN Service through Control Panel, if you see anything named along the lines of "Dynamsoft " or "Dynamic Web TWAIN ", remove them as well
* Remove the folder `C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service {version number}`
2.
Run 'Command Prompt' as **administrator**, go to C:\WINDOWS\system32, then execute the following line (Not applicable if you installed Dynamic Web TWAIN Service through personal installer):
``` shell
wmic product where name="Dynamic Web TWAIN Service" call uninstall /nointeractive
```
### On macOS
* Run the file `Uninstall.pkg` . The file can be found in `Go > Applications > Dynamsoft > Dynamic Web TWAIN Service {version number}`
* Remove the folder `Go > Applications > Dynamsoft > Dynamic Web TWAIN Service {version number}`
### On Linux
* Run the file `uninstall.sh` . The file can be found in `opt/dynamsoft/Dynamic Web TWAIN Service {version number}`
* Remove the folder `opt/dynamsoft/Dynamic Web TWAIN Service {version number}`
### On Windows
1.
* Remove Dynamsoft Service through Control Panel, if you see anything named along the lines of "Dynamsoft " or "Dynamic Web TWAIN ", remove them as well
* Remove the folders `C:\Windows\SysWOW64\Dynamsoft\DynamsoftService` and `C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_{version number}`
2.
Run 'Command Prompt' as **administrator**, go to C:\WINDOWS\system32, then execute the following line (Not applicable if you installed Dynamsoft Service through personal installer):
``` shell
wmic product where name="Dynamsoft Service" call uninstall /nointeractive
```

### On macOS
* Run the file `Uninstall.pkg` . The file can be found in `Go > Applications > Dynamsoft > DynamsoftService > {installed version No.}`
* Remove the folder `Go > Applications > Dynamsoft > DynamsoftService > {installed version No.}`
### On Linux
* Run the file `uninstall.sh` . The file can be found in `opt/dynamsoft/DynamsoftService`
* Remove the folder `opt/dynamsoft/DynamsoftService`
---
title: Can the Dynamic Web TWAIN SDK automatically remove blank pages during the document scanning process?
description: Can the Dynamic Web TWAIN SDK automatically remove blank pages during the document scanning process?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/remove-blank-page-automatically.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/remove-blank-page-automatically.md
---
# Capture/Image Source
## Can the Dynamic Web TWAIN SDK automatically remove blank pages during the document scanning process?
### Method One
If the TWAIN driver of your device supports discarding blank pages, you can use the driver's built-in feature.
1. You can set the [ `IfShowUI` ](/_articles/info/api/WebTwain_Acquire.md#ifshowui) property to true to display the User Interface (UI) of the source and you can check the option there (It normally reads 'discard blank'.).
2. If you don't want to show the user interface of the source, you can set [ `IfAutoDiscardBlankpages` ](/_articles/info/api/WebTwain_Acquire.md#ifautodiscardblankpages) to true or negotiate the ICAP_AUTODISCARDBLANKPAGES capability to discard blank pages automatically. Please NOTE that this property or capability only works if the scanner itself supports the feature (on the hardware level).
```javascript
DWTObject.SelectSource();
DWTObject.OpenSource;
DWTObject.IfShowUI = false;
//*Use the property
DWTObject.IfAutoDiscardBlankpages = true;
//*Use capability negotiation
DWTObject.Capability = Dynamsoft.DWT.EnumDWT_Cap.ICAP_AUTODISCARDBLANKPAGES;
DWTObject.CapType = Dynamsoft.DWT.EnumDWT_CapType.TWON_ONEVALUE;
DWTObject.CapValue = -1; //Auto
if (DWTObject.CapSet) {
alert("Successful!");
}
DWTObject.AcquireImage();
```
### Method Two
If the scanner itself doesn't support discarding blank pages, you can also use the [ `IsBlankImageExpress` ](/_articles/info/api/WebTwain_Buffer.md#isblankimageexpress) method to do this as a workaround. To detect and discard blank pages automatically, you can do it in the [ `OnPostTransfer` ](/_articles/info/api/WebTwain_Acquire.md#onposttransfer) event which fires after each transfer.
```javascript
function DWTObject_OnPostTransfer() {
DWTObject.BlankImageMaxStdDev = 20;
if (DWTObject.IsBlankImageExpress(DWTObject.CurrentImageIndexInBuffer)) {
DWTObject.RemoveImage(DWTObject.CurrentImageIndexInBuffer);
}
}
```
NOTE: In many cases, the scanned blank image may come with some noises which would affect the result returned by IsBlankImageExpress. To improve the result, you may adjust the value of the [ `BlankImageMaxStdDev` ](/_articles/info/api/WebTwain_Buffer.md#blankimagemaxstddev) property. The default value is 1 (0 means single-color image). Thus, by increasing the value a little bit (e.g. to 20), noises on images are ignored so a blank image can be detected faster.
---
title: Can I still use Dynamic Web TWAIN on non-HTTPS (insecure HTTP) sites with Chrome?
description: Can I still use Dynamic Web TWAIN on non-HTTPS (insecure HTTP) sites with Chrome?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/http-insecure-websites-in-chromium-browser.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/http-insecure-websites-in-chromium-browser.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# Can I still use Dynamic Web TWAIN on non-HTTPS (insecure HTTP) sites with Chrome?
### Symptom
When users access a public HTTP website that uses the Dynamic Web TWAIN SDK in Chromium-based browsers (for example, Chrome and Edge), they may repeatedly see prompts to install the Dynamic Web TWAIN Service (Dynamsoft Service).
In the browser console, you may see the following **error message**
```javascript
Access to XMLHttpRequest at 'http://127.0.0.1:****' from origin 'http://yourwebsiteURL' has been blocked by CORS policy:
The request client is not a secure context and the resource is in more-private address space `local`.
```
This behavior is primarily tied to Chromium security enforcement and may vary by browser and version.
### Reason
This is caused by browser security policy changes, not by a bug in Dynamic Web TWAIN itself.
Starting from Chrome 94, Chromium introduced stronger Private Network Access restrictions that block requests from insecure public origins (HTTP) to more private addresses such as `localhost` / `127.0.0.1`. More detail can be found at [https://developer.chrome.com/blog/private-network-access-update/](https://developer.chrome.com/blog/private-network-access-update/)
Dynamic Web TWAIN uses a local service to communicate with physical scanners, so your web page must call `localhost` or `127.0.0.1`. When the page itself is served over HTTP, modern Chromium security rules can block that communication path.
When the page cannot connect to the local service, the SDK may trigger the service installation prompt repeatedly, which is the symptom users see.
### Resolution
The long-term direction from browser vendors is stricter security on insecure origins.
Any HTTP workaround should be treated as temporary and may be removed in future browser releases.
#### Update your public website from HTTP to HTTPS
As suggested by Google and Chromium security guidance, the only durable solution is to migrate your public website from HTTP to HTTPS.
Once you update your website to HTTPS, please note that you also need to set [IfSSL](/_articles/info/api/WebTwain_IO.md#ifssl) to 'true' and specify the secure port number for SSL connection via the [HTTPPort](/_articles/info/api/WebTwain_IO.md#httpport) API before calling the HTTP upload method of the SDK.
\*_If you are using an older version of Dynamic Web TWAIN (v12.3 or earlier), you need to upgrade your SDK to newer version, please contact for further assistance._
#### Workarounds if you need to keep HTTP for some time
If you need limited transition time before migrating to HTTPS, you may try one of the following temporary workarounds:
1. [Current / temporary] In current Chrome versions, you can try the `unsafely-treat-insecure-origin-as-secure` flag as a temporary workaround for specific HTTP origins.
Step 1: visit chrome://flags/#unsafely-treat-insecure-origin-as-secure
Step 2: in "Insecure origins treated as secure", add your HTTP website origin (for example: `http://yourwebsiteURL`)
Step 3: relaunch Chrome
> Note: This is a temporary workaround for testing or controlled environments, and this flag may also be deprecated and removed in future Chrome versions. For policy background on insecure origins and powerful features, see Chromium's proposal: [Deprecating Powerful Features on Insecure Origins](https://www.chromium.org/Home/chromium-security/deprecating-powerful-features-on-insecure-origins/).
2. [Archived: Chrome 92-136] If you have administrative control over your end users, older Chrome versions supported re-enabling the deprecated behavior through the following enterprise policies:
[InsecurePrivateNetworkRequestsAllowed](https://chromeenterprise.google/policies/#InsecurePrivateNetworkRequestsAllowed)
[InsecurePrivateNetworkRequestsAllowedForUrls](https://chromeenterprise.google/policies/#InsecurePrivateNetworkRequestsAllowedForUrls)
For more details about managing policies for your users, see Google's [help center article](https://support.google.com/chrome/a/answer/9037717).
> Note: These policy-based workarounds are archived for older Chrome versions only. They were removed beginning with Chrome 137.
3. [Archived: Prior to Chrome 117] In older Chrome versions, end users could disable this block through a browser flag.
Step 1: visit chrome://flags/#block-insecure-private-network-requests
Step 2: set "Block insecure private network requests" to `Disabled`

> Note: This workaround is archived for older Chrome versions only. The [`block-insecure-private-network-requests`](https://developer.chrome.com/blog/private-network-access-update) flag was removed beginning with Chrome 117.
---
title: How can I extend my free trial?
description: How can I extend my free trial?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/extend-free-trial.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/extend-free-trial.md
---
# SDK Download/Free Trial
## How can I extend my free trial?
You can extend your trial license for free on the license page. Each extension is valid for up to 15 days, with a maximum of two extensions allowed.
If you need longer period of trial license, please send your project requirement and timeline to support@dynamsoft.com. You can also contact our support team via the online chat service available on our website.
---
title: Do you provide free trial versions of the Dynamic Web TWAIN SDK?
description: Do you provide free trial versions of the Dynamic Web TWAIN SDK?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/provide-free-trial-version.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/provide-free-trial-version.md
---
# SDK Download/Free Trial
## Do you provide free trial versions of the Dynamic Web TWAIN SDK?
Yes. We provide free trial of the Dynamic Web TWAIN SDK.
You can simply sign up at this page to get the Dynamic Web TWAIN SDK package with a 30-day free trial license included.
If you have downloaded our SDK from an external website like Github, please note it doesn't come with any free trial license. However, you can still request for a 15-day free trial license at the trial license center in the Dynamsoft's customer portal.
Note: The customer portal would allow you to extend your free trial for up to two times with each extension limited to 15 days.
---
title: Do you also provide an SDK download for Linux and Mac developers?
description: Do you also provide an SDK download for Linux and Mac developers?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/sdk-download-for-linux-and-mac.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/sdk-download-for-linux-and-mac.md
---
# SDK Download/Free Trial
## Do you also provide an SDK download for Linux and Mac developers?
Yes. Our Dynamic Web TWAIN SDK package is available for developers who work on Windows, Linux or macOS machines. Please get them from the download center.
---
title: Is the free trial version fully functional?
description: Is the free trial version fully functional?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/trial-fully-functional.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/trial-fully-functional.md
---
# SDK Download/Free Trial
## Is the free trial version fully functional?
Yes. The free trial version of the Dynamic Web TWAIN SDK is fully functional. In other words, there is no feature limitation with the free trial version except that the trial SDK comes with a license expiration date.
Also, please note the trial version includes all core modules as well as addon modules (e.g., Barcode Reader, PDF Rasterizer, etc.) of the Dynamic Web TWAIN SDK. Once you install the free trial version, you can generally find the Resources and Samples for core and addons under C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN SDK {version number}.
---
title: Can I use the Dynamic Web TWAIN SDK to create a PWA application?
description: Can I use the Dynamic Web TWAIN SDK to create a PWA application?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/use-with-PWA.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/use-with-PWA.md
---
# SDK Download/Free Trial
## Can I use the Dynamic Web TWAIN SDK to create a PWA application?
Dynamic Web TWAIN is a JavaScript SDK so it can be integrated to a Progressive Web Application (PWA). If you run into any issue, please send the detail to support@dynamsoft.com.
---
title: Where can I download an older version of the Dynamic Web TWAIN SDK?
description: Where can I download an older version of the Dynamic Web TWAIN SDK?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/download-older-version-sdk.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/download-older-version-sdk.md
---
# SDK Download/Free Trial
## Where can I download an older version of the Dynamic Web TWAIN SDK?
Visit the customer portal and go to the Download Center to access older SDK versions. Release notes for current and past stable versions are in the [Stable Releases](/_articles/info/schedule/Stable.md) page.
Dynamsoft provides maintenance and support for each SDK version for two years from its GA date. If you’re on an older release, plan an upgrade to the latest version. Contact sales@dynamsoft.com with any questions.
---
title: Can I run the scanning service on an ARM-based embedded device, such as Raspberry Pi?
description: Can I run the scanning service on an ARM-based embedded device, such as Raspberry Pi?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/run-on-arm-based-embedded-device.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/run-on-arm-based-embedded-device.md
---
# SDK Download/Free Trial
## Can I run the scanning service on an ARM-based embedded device, such as Raspberry Pi?
Starting from version 17.0, we provide an ARM64 version of the Dynamic Web TWAIN Service (also called "Dynamsoft Service"). It can be found in the SDK package (Normally under C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN SDK {version number}\Resources\dist) of the Dynamic Web TWAIN SDK from Download Center.
So for any ARM64 based devices running on Linux OS, such as Raspberry Pi or Jetson Nano, you can also scan documents from physical scanners to the device's browser clients.
MIPS 64-bit version of the Dynamic Web TWAIN Service is also available in the SDK package, if you need to support any MIPS devices.
---
title: What image and document formats can I save my documents as?
description: What image and document formats can I save my documents as?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/image-document-formats-save.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/image-document-formats-save.md
---
# Document Saving
## What image and document formats can I save my documents as?
Documents can be saved in BMP / JPEG / TIFF / PNG / PDF format.
Notes:
- To reduce the size for JPEG/PDF/TIFF format, please check [this article](/_articles/faq/smallest-size-documents.md).
- Black & white image data which is 1-bit cannot be saved in the JPEG format as this format supports eight-bit grayscale images and 24-bit color images (eight bits each for red, green, and blue).
- Dynamic Web TWAIN can read and write image-based PDF files; however, to read text-based PDF files, the [PDF Rasterizer add-on](/_articles/extended-usage/pdf-processing.md){:target="_blank"} is required.
More details of each file type can be found here
---
title: How can I change the certificate of the Dynamic Web TWAIN Service?
description: How can I change the certificate of the Dynamic Web TWAIN Service?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/change-dynamsoft-service-certificate.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/change-dynamsoft-service-certificate.md
---
# Security
## How can I change the certificate of the Dynamic Web TWAIN Service?
To replace the default certificate, the steps are:
- Generate a certificate for `127.0.0.1` with an RSA private key
- Rename the certificate to `server.pem` and the private key to `server_key.pem`
- Replace the old keys in the `cert` folder in the [service's installation folder](/_articles/extended-usage/dynamsoft-service-configuration.md#installation-folder)
- Restart the service
You can also pack the two files into a zip file and use the [configuration page](/_articles/extended-usage/dynamsoft-service-configuration.md#web-setup) to update.
## Appendix
### How to Generate the Certificate with acme.sh?
Run the following command to apply for an SSL certificate.
```bash
acme.sh --issue -d --keylength 2048
```
Then, you can find the certificate named `fullchain.cer` and the private key named `your-domain.key` in the output folder.
### What are the Files in the cert Folder
* default keys
* server.pem
* server_key.pem
* keys for [local.dynamsoft.com](/_articles/faq/failed-to-load-resource.md) (encrypted, get the latest from [demo site](https://demo.dynamsoft.com/DWT/Resources/dist/cert.zip))
* server.pem.ldsc
* server_key.pem.ldsc
* keys for [Remote Scan](https://www.dynamsoft.com/remote-scan/docs/introduction/)'s proxy server after installation (encrypted, get the latest from the domain binding page)
* server.pem.ldwtc
* server_key.pem.ldwtc
---
title: How can I enable HTTPS support?
description: How can I enable HTTPS support?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/enable-https-support.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/enable-https-support.md
---
# Document Saving
## How can I enable HTTPS support?
Dynamic Web TWAIN provides SSL support.
To enable HTTPS,
- Set [IfSSL](/_articles/info/api/WebTwain_IO.md#ifssl){:target="_blank"} to true to turn on SSL in HTTP requests.
- Set the SSL port with the API [HTTPPort](/_articles/info/api/WebTwain_IO.md#httpport){:target="_blank"}.
- Call the API HTTPUpload to upload the documents.
For more information on how to use HTTPUpload, please check [here](/_articles/info/api/WebTwain_IO.md#httpupload){:target="_blank"}.
Note that if you use this feature, you need to enable HTTPS on the server. For how to enable HTTPS, please check out the manual of your webserver.
---
title: Is the Dynamic Web TWAIN SDK GDPR compliant?
description: Is the Dynamic Web TWAIN SDK GDPR compliant?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/gdpr-compliant.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/gdpr-compliant.md
---
# Security
## Is the Dynamic Web TWAIN SDK GDPR compliant?
Yes. With Dynamic Web TWAIN SDK technologies, all data processing can be done within the client-side devices by using an offline license of the SDK, ensuring full compliance with data protection laws. These include the General Data Protection Regulations (GDPR), effective in Europe from May 2018. You can contact sales@dynamsoft.com for an offline license.
Our SDK provides strong security features and is trusted by many companies in different industries across the globe. Please check out our customer stories and testimonies.
---
title: Is the Dynamic Web TWAIN SDK HIPAA compliant?
description: Is the Dynamic Web TWAIN SDK HIPAA compliant?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/hipaa-compliant.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/hipaa-compliant.md
---
# Security
## Is the Dynamic Web TWAIN SDK HIPAA compliant?
Yes. With Dynamic Web TWAIN SDK technologies, all data processing can be done within the client-side devices by using an offline license of the SDK, ensuring full compliance with any data protection laws. In other words, the HIPAA compliance of your healthcare solution won't change by integrating our SDK. You can contact sales@dynamsoft.com for an offline license.
Dynamsoft is ISO 27001 Certified and our SDK provides strong security features and is trusted by many companies in the Healthcare industry. Please check out our customer stories and testimonies.
See more: What is HIPAA
---
title: What type of HTTP servers do your support? Do you support other server types?
description: What type of HTTP servers do your support? Do you support other server types?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/http-servers-support.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/http-servers-support.md
---
# Document Saving
## What type of HTTP servers do your support? Do you support other server types?
We support any web servers such Apache, NGINX, IIS, Tomcat, Node.js, etc. We also support Mail/FTP/Database servers.
To upload documents via HTTP, we recommend the API [here](/_articles/general-usage/image-export/index.md#upload){:target="_blank"}.
Dynamic Web TWAIN sends an HTTP POST request to the server when doing an upload. You need to write your server-side script to receive and save the uploaded files. On the server side, any scripting language can be used.
For more information and sample server-side scripts, please refer to [Server Scripts](/_articles/general-usage/server-side-scripting.md){:target="_blank"}, which includes sample scripts on how to save the uploaded file to a database such as MS SQL/Oracle, and how to resend the uploaded file by email.
---
title: Can I insert newly scanned pages to an existing document?
description: Can I insert newly scanned pages to an existing document?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/insert-new-pages-to-existing-document.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/insert-new-pages-to-existing-document.md
---
# Document Saving
## Can I insert newly scanned pages to an existing document?
By default, when you scan or load images, they are appended to the end of the image array in buffer. However, in some business scenarios, the user may want to insert these new images to a specified index.
Unfortunately, Dynamic Web TWAIN does not provide a native method for that, but you can utilize the property [IfAppendImage](/_articles/info/api/WebTwain_Acquire.md#ifappendimage){:target="_blank"} to achieve it. You can load some images from your local disk first, and then acquire images from your device with IfAppendImage set to 'false'.
The following code snippet shows how it can be done.
Insert when acquiring
```javascript
function acquireToIndex(index) {
DWTObject.IfAppendImage = false;
DWTObject.CurrentImageIndexInBuffer = index;
DWTObject.RegisterEvent("OnPostTransfer", function () {
DWTObject.CurrentImageIndexInBuffer++;
});
DWTObject.RegisterEvent("OnPostAllTransfers", function () {
DWTObject.IfAppendImage = true;
});
DWTObject.AcquireImage();
}
```
Insert when loading
```javascript
function loadToIndex(index) {
var oldCount = DWTObject.HowManyImagesInBuffer;
DWTObject.RegisterEvent("OnPostLoad", function () {
var newCount = DWTObject.HowManyImagesInBuffer;
for (var j = 0; j < newCount - oldCount; j++)
DWTObject.MoveImage(oldCount + j, index + j);
});
DWTObject.LoadImageEx("", 5);
}
```
---
title: Is the Dynamic Web TWAIN SDK ISO 27001 compliant?
description: Is the Dynamic Web TWAIN SDK ISO 27001 compliant?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/iso-27001-compliant.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/iso-27001-compliant.md
---
# Security
## Is the Dynamic Web TWAIN SDK ISO 27001 compliant?
Yes, since April 9, 2021, Dynamsoft has successfully passed the audit and become ISO 27001 certified.
We understand the importance of [information security](https://www.dynamsoft.com/Products/Dynamsoft_Security_Whitepaper.pdf) and are committed to remaining one of the most security-compliant companies in the industry.
For more information, please check out our blog: Dynamsoft is now ISO 27001 certified! - Dynamsoft Blog
---
title: The license key is set in JavaScript. How can I protect it?
description: The license key is set in JavaScript. How can I protect it?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/license-key-protection.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/license-key-protection.md
---
# Security
## The license key is set in JavaScript. How can I protect it?
If you are using Per Client Device or Per Page license of Dynamic Web TWAIN SDK, your license is either the organization ID (which links to the default Handshake Code), the handshake code or both. Therefore, you can simply protect your license by adding security settings to your handshake code in the license portal.
- You can set a session password.
- You can add your website domain as a validation field.
If you are using an offline/non-trackable license, you can configure your license to enable domain binding before activating your license. When you do this, you must make sure your application is deployed to the bound domain, otherwise you will receive an error.
> Note - that this a static characteristic of your application, and it cannot be changed after it's configured.
---
title: Can I limit the size of documents to be uploaded to my server?
description: Can I limit the size of documents to be uploaded to my server?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/limit-upload-size-to-server.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/limit-upload-size-to-server.md
---
# Security
## Can I limit the size of documents to be uploaded to my server?
Yes. You can use the API [MaxUploadImageSize](/_articles/info/api/WebTwain_IO.md#maxuploadimagesize){:target="_blank"}.
Note that your web server may also impose maximum file upload size. For example, the default maximum file upload size in IIS6 is 4 MB and 28.6 MB for IIS7. You can change the maxAllowedContentLength value in web.config, IIS Manager, or ApplicationHost.config file.
---
title: When are the locally cached images destroyed?
description: When are the locally cached images destroyed?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/local-cached-images-destroyed.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/local-cached-images-destroyed.md
---
# Security
## When are the locally cached images destroyed?
Dynamic Web TWAIN introduced a disk caching feature to allow saving image data to the local disk.
The disk caching feature is enabled by default and can be disabled by setting [IfAllowLocalCache](/_articles/info/api/WebTwain_Buffer.md#ifallowlocalcache){:target="_blank"} to false. You can also set how much memory Dynamic Web TWAIN can use before images start to be cached. By default, 800MB is used. You can change it using the property [BufferMemoryLimit](/_articles/info/api/WebTwain_Buffer.md#buffermemorylimit){:target="_blank"}.
All cached data is encrypted, can only be accessed by Dynamic Web TWAIN, and is destroyed when Dynamic Web TWAIN is unloaded. If the SDK exits unexpectedly, all cached data will also be destroyed.
For more information on buffer management and local caching, please check here: [Dynamic Web TWAIN Features - Buffer (dynamsoft.com)](/_articles/extended-usage/buffer-caching.md){:target="_blank"}.
---
title: Can I prompt the end-user when the Dynamic Web TWAIN SDK attempts to visit any local resources (scanner, camera, or disk drive)?
description: Can I prompt the end-user when the Dynamic Web TWAIN SDK attempts to visit any local resources (scanner, camera, or disk drive)?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/prompt-end-user-when-local-resources-used.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/prompt-end-user-when-local-resources-used.md
---
# Security
## Can I prompt the end-user when the Dynamic Web TWAIN SDK attempts to visit any local resources (scanner, camera, or disk drive)?
Yes, Dynamic Web TWAIN supports authorization for accessing local files, scanners, or webcams.
1. Stop the Dynamic Web TWAIN Service.
2. Add the following three lines to the file `C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service {version number}\DSConfiguration.ini` (for versions below 19.0, the path is `C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_{version number}\DSConfiguration.ini`):
```javascript
EnableScannerAccessAuth=TRUE
EnableFileAccessAuth=TRUE
EnableWebcamAccessAuth=TRUE
```
3. Restart the Dynamic Web TWAIN Service.
---
title: How can I get a response string from my HTTP Server if the upload succeeds or fails?
description: How can I get a response string from my HTTP Server if the upload succeeds or fails?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/response-string-from-server-on-upload.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/response-string-from-server-on-upload.md
---
# Document Saving
## How can I get a response string from my HTTP Server if the upload succeeds or fails?
```javascript
Every HTTP upload method has two callbacks with signatures like this
onEmptyResponse: () => void,
onServerReturnedSomething: (
errorCode: number,
errorString: string,
response: string) => void
```
The 1st callback onEmptyResponse is triggered when the server returns no response string. Generally, if an error has occurred on the server, the server will return some information to indicate what went wrong. Therefore, if nothing is returned, you can treat it as a successful upload.
Of course, in your own server-side script to accept and process the HTTP Post request, you know whether the upload is successful and can make it more obvious by returning some custom information to indicate that. In this case, the 2nd callback onServerReturnedSomething will be triggered on purpose and you will need to read the argument response which contains what is returned by the server.
> NOTE - When the callback onServerReturnedSomething is triggered, you will always get an errorCode and an errorString but you can choose to ignore them if it's triggered on purpose.
Dynamic Web TWAIN also provides an API called [HTTPPostResponseString](/_articles/info/api/WebTwain_IO.md#httppostresponsestring){:target="_blank"} which contains the response and can be read outside of the upload method.
---
title: How can I securely transfer scanned documents to my server?
description: How can I securely transfer scanned documents to my server?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/securely-transfer-to-server.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/securely-transfer-to-server.md
---
# Security
## How can I securely transfer scanned documents to my server?
Dynamic Web TWAIN supports downloading/uploading documents via HTTPS.
To enable HTTPS,
- Set [IfSSL](/_articles/info/api/WebTwain_IO.md#ifssl){:target="_blank"} to true to turn on SSL in HTTP requests
- Set the SSL port with the API [HTTPPort](/_articles/info/api/WebTwain_IO.md#httpport){:target="_blank"}
- Call the API HTTPUpload to upload the documents
To upload documents via HTTP/HTTPS, we recommend the API [here](/_articles/general-usage/image-export/index.md#upload){:target="_blank"}.
> Note - that if you use this feature, you need to enable HTTPS on the server. For how to enable HTTPS, please check out the manual of your webserver.
---
title: Do I need a separate license for each addon?
description: Do I need a separate license for each addon?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/separate-license-for-addon.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/separate-license-for-addon.md
---
# Addon
## Do I need a separate license for each addon?
Yes—each add-on requires its own license. See pricing at Dynamic Web TWAIN Pricing and the licensing guide at [Using License Keys](/_articles/general-usage/license.md){:target="_blank"}.
For per-client-device licenses, you can add an add-on license to the existing project without changing the license key string in your application. Organization ID/handshake details are in the Dynamsoft License Server terms here.
---
title: How can I reduce the size of documents in PDF, TIFF or JPEG format?
description: How can I reduce the size of documents in PDF, TIFF or JPEG format?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/smallest-size-documents.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/smallest-size-documents.md
---
# Document Saving
## How can I reduce the size of documents in PDF, TIFF or JPEG format?
There are a few things that you can try to reduce the size of a resulting file
- Scan in grayscale or black & white instead of RGB;
- Convert the images to grayscale or black & white before the save or upload call. Read more [here](/_articles/general-usage/image-processing/index.md#working-with-pixels-and-bit-depth){:target="_blank"};
- Scan in a lower resolution;
- Convert the images to a lower resolution (DPI). Read more [here](/_articles/general-usage/image-processing/index.md#working-with-pixels-and-bit-depth){:target="_blank"};
- [Optional] If the resulting file is in the JPEG format (.jpg) or is a TIF or PDF that is encoded by the JPEG standard, you can set [JPEGQuality](/_articles/info/api/WebTwain_IO.md#jpegquality){:target="_blank"} to a lower value.
- Save in PDF format (No PDF Rasterizer Addon license is required for this API),
```javascript
DWTObject.Addon.PDF.Write.Setup({compression: Dynamsoft.DWT.EnumDWT_PDFCompressionType.PDF_JPEG, quality: 20});
//or set DWTObject.Addon.PDF.Write.Setup({compression: 5, quality: 20}); which is equivalent.
```
```html
```
- Save in TIF format,
```javascript
DWTObject.TIFFCompressionType = Dynamsoft.DWT.EnumDWT_TIFFCompressionType.TIFF_JPEG;
//or set DWTObject.TIFFCompressionType = 7 which is equivalent.
DWTObject.JPEGQuality = 20;
```
- Save in JPEG format.
```javascript
DWTObject.JPEGQuality = 20;
```
**Note that black & white image cannot be saved in the JPEG format. To reduce the size, please convert the image to grayscale.**
---
title: How can I automatically trigger actions when images arrive on my server side?
description: How can I automatically trigger actions when images arrive on my server side?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/trigger-actions-server-side.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/trigger-actions-server-side.md
---
# Document Saving
## How can I automatically trigger actions when images arrive on my server side?
Dynamic Web TWAIN sends an HTTP POST request to the server when doing an upload. You need to write your server-side script to receive and save the uploaded files. On the server side, any scripting language can be used. The server-side script file is specified in the POST Form with the name RemoteFile by default and will be triggered to process the uploaded file.
To change the default field name RemoteFile, you can use the API [HttpFieldNameOfUploadedImage](/_articles/info/api/WebTwain_IO.md#httpfieldnameofuploadedimage){:target="_blank"}.
For Server-side Scripting examples, please check [this](/_articles/general-usage/server-side-scripting.md){:target="_blank"}.
---
title: Can I upload documents to a different website domain?
description: Can I upload documents to a different website domain?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/upload-documents-to-different-domain.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/upload-documents-to-different-domain.md
---
# Document Saving
## Can I upload documents to a different website domain?
Yes, if your web server is configured to allow cross domain requests. Please check your web server manual for instructions on how to configure it to allow cross domain requests.
If your web server does not allow accessing from a different domain and you are uploading or downloading to/from a web server in a different domain than your current website, you will get a CORS error as described here: [XMLHttpRequest cannot load XXX ](/_articles/faq/XMLHttpRequest-cannot-load.md)
---
title: How can I upload a JSON file to my server?
description: How can I upload a JSON file to my server?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/upload-json-files-to-server.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/upload-json-files-to-server.md
---
# Document Saving
## How can I upload a JSON file to my server?
While you cannot send a JSON file with HTTPUpload, you can send the JSON string with the API [SetHTTPFormField](/_articles/info/api/WebTwain_IO.md#sethttpformfield){:target="_blank"}.
Dynamic Web TWAIN sends an HTTP POST request to the server when doing an upload. The SetHTTPFormField() method is used to [add extra fields to the HTTP form](/_articles/faq/additional-form-fields.md){:target="_blank"}. Just like how you can add extra text information to the form, you can also add the JSON string to it.
---
title: Can I upload documents via a background service outside the web browser?
description: Can I upload documents via a background service outside the web browser?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/upload-using-background-service.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/upload-using-background-service.md
---
# Document Saving
## Can I upload documents via a background service outside the web browser?
Yes. You can use the File Uploader to create and run an upload job.
The File Uploader is an independent component that is dedicated to file uploading. It can be used seamlessly with Dynamic Web TWAIN.
Learn about how to use the File Uploader [here](/_articles/general-usage/image-export/server-upload.md#fileuploader).
---
title: Does the Dynamic Web TWAIN SDK use any deprecated technologies like NPAPI or ActiveX?
description: Does the Dynamic Web TWAIN SDK use any deprecated technologies like NPAPI or ActiveX?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/use-deprecated-technology.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/use-deprecated-technology.md
---
# Security
## Does the Dynamic Web TWAIN SDK use any deprecated technologies like NPAPI or ActiveX?
Dynamic Web TWAIN no longer uses NPAPI. ActiveX support was removed starting in v19.0 (see the [Removed Features](/_articles/info/schedule/Stable.md#removed-features){:target="_blank"} in the release notes).
We added HTML5 support long before Chrome dropped NPAPI, so web scanning remains supported without deprecated tech. Customers should migrate off ActiveX; modern versions require the HTML5 edition.
---
title: Where does the Dynamic Web TWAIN SDK store images on end-user machines? Are they encrypted?
description: Where does the Dynamic Web TWAIN SDK store images on end-user machines? Are they encrypted?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/where-images-are-stored.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/where-images-are-stored.md
---
# Security
## Where does the Dynamic Web TWAIN SDK store images on end-user machines? Are they encrypted?
Images are stored in the memory buffer on end-user machines. Since memory configuration is limited on end-user machines, Dynamic Web TWAIN introduced a disk caching feature to allow saving image data to the local disk.
The disk caching feature is enabled by default and can be disabled by setting [IfAllowLocalCache](/_articles/info/api/WebTwain_Buffer.md#ifallowlocalcache){:target="_blank"} to false. You can also set how much memory Dynamic Web TWAIN can use before images start to be cached. By default, 800MB is used. You can change it using the property [BufferMemoryLimit](/_articles/info/api/WebTwain_Buffer.md#buffermemorylimit){:target="_blank"}.
All cached data is encrypted, can only be accessed by Dynamic Web TWAIN, and is destroyed when Dynamic Web TWAIN is unloaded.
For more information, please check here: [Dynamic Web TWAIN Features - Buffer](/_articles/extended-usage/buffer-caching.md){:target="_blank"}.
---
title: Does your Barcode Reader addon support patch code?
description: Does your Barcode Reader addon support patch code?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/does-barcode-addon-support-patch-code.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/does-barcode-addon-support-patch-code.md
---
# Addon
## Does your Barcode Reader addon support patch code?
Yes. Configure it in the barcode types list shown here: [Specify the Barcode Type(s) to Read](/_articles/extended-usage/barcode-processing.md#specify-the-barcode-types-to-read){:target="_blank"}.
---
title: How can I generate PDF/A files?
description: How can I generate PDF/A files?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/generate-pdf-files.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/generate-pdf-files.md
---
# Addon
## How can I generate PDF/A files?
Dynamic Web TWAIN supports exporting documents as **PDF/A** starting from version **19.3**.
PDF/A is an archival format designed for long-term preservation. The following variants are supported:
### Supported PDF/A Versions
| PDF/A Variant | Underlying PDF Version |
|:-------------:|-----------------------------|
| `pdf/a-1b` | **1.4** (default) |
| `pdf/a-2b` | **1.5** (default), 1.6, 1.7 |
### What’s the difference between PDF/A-1b and PDF/A-2b?
Although both variants ensure that documents can be reliably displayed in the future, they differ in terms of supported PDF features and compression options.
- PDF/A-1b
- Uses the older PDF 1.4 specification.
- **Does not support JPEG2000** or JBIG2 image compression.
- Does not allow transparency.
- May result in larger file sizes and more conversion restrictions.
- PDF/A-2b
- Based on newer PDF versions (1.5–1.7).
- Supports **JPEG2000**, JBIG2, transparency, and other modern PDF features.
- Typically requires **fewer changes** to the source document.
- Usually produces **smaller output** files.
**Recommendation:**
For most use cases, we recommend using **`pdf/a-2b`**.
It offers better compression support, fewer limitations, and higher compatibility with modern PDFs while still meeting archival requirements.
### Licensing Requirements
Dynamic Web TWAIN does not require any add-on license to **export** or generate PDF or PDF/A files. However, PDF Rasterizer add-on would be required when **loading** a PDF/PDF-A file that contains **text or vector graphics**.
You can programmatically check whether a file needs rasterization using [`IsRasterizationRequired()`](/_articles/info/api/Addon_PDF.md#israsterizationrequired):
```javascript
DWTObject.Addon.PDF.IsRasterizationRequired(path); // returns true or false
```
### Behavior and Defaults
- If you do not set `pdfaVersion`, the export uses standard PDF format (non-PDF/A).
- If you set `pdfaVersion` but forget to set `version`, or set a mismatched or incorrect PDF version, Dynamic Web TWAIN automatically falls back to a default PDF version:
- `pdf/a-1b` → defaults to PDF `1.4`
- `pdf/a-2b` → defaults to PDF `1.5`
### How to Export as PDF/A
Configure PDF output using [`Write.Setup()`](/_articles/info/api/Addon_PDF.md#writesetup) before calling any save function.
```javascript
DWTObject.Addon.PDF.Write.Setup({
version: "1.5", // [optional] 1.4 for "pdf/a-1b"; 1.5/1.6/1.7 for "pdf/a-2b"
pdfaVersion: "pdf/a-2b" // "pdf/a-1b" or "pdf/a-2b"
});
```
After configuring `pdfaVersion`, all APIs that output PDF files will automatically generate PDF/A-compliant PDFs. This includes, but is not limited to:
- **Save APIs** like: [`SaveAsPDF()`](/_articles/info/api/WebTwain_IO.md#saveaspdf), [`SaveSelectedImagesAsMultiPagePDF()`](/_articles/info/api/WebTwain_IO.md#saveselectedimagesasmultipagepdf), [`SaveAllAsPDF()`](/_articles/info/api/WebTwain_IO.md#saveallaspdf)
- **Conversion APIs** like: [`ConvertToBlob()`](/_articles/info/api/WebTwain_IO.md#converttoblob), [`ConvertToBase64()`](/_articles/info/api/WebTwain_IO.md#converttobase64)
- **Upload APIs** like: [`HTTPUpload()`](/_articles/info/api/WebTwain_IO.md#httpupload), [`FTPUpload()`](/_articles/info/api/WebTwain_IO.md#ftpupload), [`httpUploadBlob()`](/_articles/info/api/WebTwain_IO.md#httpuploadblob)
- **OCR Output APIs** like: [`SaveToPath()`](/_articles/info/api/Addon_OCR.md#savetopath), [`SaveAsBase64()`](/_articles/info/api/Addon_OCR.md#saveasbase64), [`SaveAsBlob()`](/_articles/info/api/Addon_OCR.md#saveasblob)
---
title: Do I need the PDF Rasterizer addon to convert scanned documents to PDF files?
description: Do I need the PDF Rasterizer addon to convert scanned documents to PDF files?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/is-pdf-rasterizer-needed-to-convert-scanned-documents-to-pdf.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/is-pdf-rasterizer-needed-to-convert-scanned-documents-to-pdf.md
---
# Addon
## Do I need the PDF Rasterizer addon to convert scanned documents to PDF files?
No. Dynamic Web TWAIN can output images as image-based PDF files and this is built into the core module, so no addon is required to convert scanned documents to PDF files.
---
title: How can I load PDF/A files into the Dynamic Web TWAIN SDK?
description: How can I load PDF/A files into the Dynamic Web TWAIN SDK?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/load-pdf-files.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/load-pdf-files.md
---
# Addon
## How can I load PDF/A files into the Dynamic Web TWAIN SDK?
Dynamic Web TWAIN can load PDF/A files. Whether you need the **[PDF Rasterizer Add-on (PDFR)](https://www.dynamsoft.com/web-twain/pdf-to-image-javascript/)** depends entirely on the contents of the PDF/A document:
- If the PDF/A contains **text or vector graphics**, rasterization is required → **PDFR license needed**.
- If the PDF/A contains **only raster images**, the file can be loaded **without** the PDFR add-on.
> [!NOTE]
> **Looking for information about generating PDF/A files?**
>
> Starting from Dynamic Web TWAIN 19.3, PDF/A creation is supported.
>
> See: [How can I generate PDF/A files?](/_articles/faq/generate-pdf-files.md)
### How to check whether rasterization is required
You can programmatically detect whether a given PDF/A file requires rasterization before loading it:
```javascript
DWTObject.Addon.PDF.IsRasterizationRequired(path); // returns true or false
```
If this method returns **`true`**, the SDK will need the PDFR to process the file.
### When rasterization actually happens
Dynamic Web TWAIN performs rasterization **only when necessary**. If [`IsRasterizationRequired()`](/_articles/info/api/Addon_PDF.md#israsterizationrequired) returns **`true`** and the PDF Rasterizer license is configured, the SDK automatically rasterizes the PDF into images using the reader settings you specify.
The rasterization behavior—including resolution (default **200 DPI**) and other rendering parameters—can be customized through [`SetReaderOptions()`](/_articles/info/api/Addon_PDF.md#setreaderoptions).
Rasterization may occur when using any of these APIs (including drag-and-drop):
- [ `LoadImage()` ](/_articles/info/api/WebTwain_IO.md#loadimage)
- [ `LoadImageEx()` ](/_articles/info/api/WebTwain_IO.md#loadimageex)
- [ `LoadImageFromBase64Binary()` ](/_articles/info/api/WebTwain_IO.md#loadimagefrombase64binary)
- [ `LoadImageFromBinary()` ](/_articles/info/api/WebTwain_IO.md#loadimagefrombinary)
- [ `FTPDownload()` ](/_articles/info/api/WebTwain_IO.md#ftpdownload)
- [ `FTPDownloadEx()` ](/_articles/info/api/WebTwain_IO.md#ftpdownloadex)
- [ `HTTPDownload()` ](/_articles/info/api/WebTwain_IO.md#httpdownload)
- [ `HTTPDownloadEx()` ](/_articles/info/api/WebTwain_IO.md#httpdownloadex)
- [ `HTTPDownloadThroughPost()` ](/_articles/info/api/WebTwain_IO.md#httpdownloadthroughpost)
- [ `HTTPDownloadDirectly()` ](/_articles/info/api/WebTwain_IO.md#httpdownloaddirectly)
---
title: Can I load specific page numbers of a PDF file into the viewer?
description: Can I load specific page numbers of a PDF file into the viewer?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/load-specific-page-of-pdf-to-viewer.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/load-specific-page-of-pdf-to-viewer.md
---
# Addon
## Can I load specific page numbers of a PDF file into the viewer?
Dynamic Web TWAIN does not provide a native method that supports loading specific page numbers of a PDF file. However, it can be done by following the steps below
- a. register the [OnPostLoad](/_articles/info/api/WebTwain_IO.md#onpostload){:target="_blank"} event which is triggered once the entire file has been loaded to the viewer
- b. In the event function, remove the unwanted pages (API [RemoveImage](/_articles/info/api/WebTwain_Buffer.md#removeimage){:target="_blank"})
- c. load the file to the viewer (e.g. API [LoadImage](/_articles/info/api/WebTwain_IO.md#loadimage){:target="_blank"})
---
title: How can I separate my documents automatically by barcode?
description: How can I separate my documents automatically by barcode?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/separate-documents-by-barcode.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/separate-documents-by-barcode.md
---
# Addon
## How can I separate my documents automatically by barcode?
When dealing with batch documents, barcodes can function as a smart separator, or to properly group documents. For example, by affixing a barcode to each document in a batch and then scanning it, the files can be automatically grouped or separated. They can be automatically made into multi-page TIFF or PDF files. All of this can be accomplished with a single batch scan by integrating the Core Module and Barcode Reader add-on of Dynamic Web TWAIN SDK.
Please refer to the two examples with sample codes here: [Use barcode to classify and separate documents](/_articles/extended-usage/barcode-processing.md#use-barcode-to-classify-and-separate-documents){:target="_blank"}.
Here is a sample project you can try and download: Automate Document Classification Using Barcode Separator.
---
title: Is there any way to speed up the barcode reading process?
description: Is there any way to speed up the barcode reading process?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/speed-up-barcode-reading-process.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/speed-up-barcode-reading-process.md
---
# Addon
## Is there any way to speed up the barcode reading process?
There are several runtime settings you can use to speed up the barcode reading process:
- Specify the Barcode Type(s) to Read
- Specify maximum barcode count
- Specify a scan Region
- Use the built-in mode 'speed'
For more details on runtime settings, please check [here](/_articles/extended-usage/barcode-processing.md#runtime-settings){:target="_blank"}.
In addition, the size of the image generated during the scanning process also impacts the reading performance. You can check your scanning settings to balance the image qualify and size.
---
title: What types of webcams does the Webcam Capture addon support
description: What types of webcams does the Webcam Capture addon support
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/webcam-supported-by-webcam-capture-addon.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/webcam-supported-by-webcam-capture-addon.md
---
# Addon
## What types of webcams does the Webcam Capture addon support?
The webcams supported are DirectShow Cameras which are either built into desktops/laptops or connected via USB. Please check here for more information about these cameras and to check if your camera is DirectShow compliant.
---
title: When do I need PDF Rasterizer Addon? Can I load existing PDF files into the Dynamic Web TWAIN SDK without the PDF Rasterizer addon?
description: When do I need PDF Rasterizer Addon? Can I load existing PDF files into the Dynamic Web TWAIN SDK without the PDF Rasterizer addon?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/when-is-pdf-rasterizer-needed.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/when-is-pdf-rasterizer-needed.md
---
# Addon
## When do I need PDF Rasterizer Addon? Can I load existing PDF files into the Dynamic Web TWAIN SDK without the PDF Rasterizer addon?
Third-party generated PDF files may house multiple images, text, or annotations in a single PDF page. As these elements must be rendered within the Dynamic Web TWAIN, it will utilize the PDF rasterizer addon.
When importing a PDF file generated by Dynamic Web TWAIN, or if each page of a third-party PDF holds nothing but a single image, there's no need for the PDF rasterizer addon.
If you need to append images to an existing PDF and want to keep the original pages instead of rasterized images in the saved PDF, you need to enable the [`preserveUnmodifiedOnSave`](/_articles/info/api/interfaces.md#:~:text=preserveUnmodifiedOnSave){:target="_blank"} property.
---
title: Error Message - Failed to load resource
description: Error Message - Failed to load resource
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/failed-to-load-resource.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/failed-to-load-resource.md
---
# Error Troubleshooting
## Error Message - Failed to load resource: net::ERR_CERT_DATE_INVALID
### Symptom
You get an error message that says **"Failed to load resource: net::ERR_CERT_DATE_INVALID https://local.dynamsoft.com:18623/f/VersionInfo?ts=XXXXXXXXXXXX"**. And the browser keeps asking to install the Dynamic Web TWAIN Service (previously called "Dynamsoft Service").
### Cause
By default, "127.0.0.1" is used for service connection. "127.0.0.1" uses a self-signed SSL certificate without an expiry date. It is installed to your system so that the browser can trust it. If your environment requires high level security, self-signed certificates may not be accepted. Moreover, it is not easy to install the self-signed certificate for systems like Chrome OS.
In this case, we provide a domain, "local.dynamsoft.com", which points to "127.0.0.1". It has a VeriSign’ed certificate that has an expiry date. The most recent expired "local.dynamsoft.com" certificate expired on 2025 November 20th, and the latest certificate will expire on 2026 November 21st.
> [!NOTE]
> All official third-party certificates come with an expiry date (generally one year). If `local.dynamsoft.com` is used, the certificate needs to be updated each year.
### Resolution
- **No High Level Security Requirement**:
Set back to self-signed certificate "127.0.0.1" by comment the line `Dynamsoft.WebTwainEnv.Host = "local.dynamsoft.com"` or `Dynamsoft.DWT.Host="local.dynamsoft.com"` out. No need to worry about the expiry date of the certificate anymore.
- **High Level Security Requirement**
> [!WARNING]
> If you use `local.dynamsoft.com`, replace the certificate annually due to expiration.
If you have to use "local.dynamsoft.com", the following methods can be taken:
- Method 1. Use the following links to download and install the Dynamic Web TWAIN Service Installer.
> [!IMPORTANT]
> Dynamic Web TWAIN Service installers are backward-compatible within the same major version. Identify the major SDK version first, then download the corresponding installer (for example, 19.x SDK uses v19 installers, 18.x SDK uses v18 installers). If you are unsure about your SDK version, follow [How do I know which SDK version I am using?](/_articles/faq/find-SDK-version.md).
- Windows
- macOS
- Linux
> Choose between Admin (requires admin privileges) or Personal (for individual users).
- Version 19
- [Windows Installer (Admin)](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/19.3.2/DynamicWebTWAINServiceSetup.msi)
- [Windows Installer (Personal)](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/19.3.2/DynamicWebTWAINServiceSetup.exe)
- Version 18
- [Windows Installer (Admin)](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/18.5.4/DynamsoftServiceSetup.msi)
- [Windows Installer (Personal)](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/18.5.4/DynamsoftServiceSetup.exe)
> Use the installer matching your SDK version.
- [macOS Installer v19](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/19.3.2/DynamicWebTWAINServiceSetup.pkg)
- [macOS Installer v18](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/18.5.4/DynamsoftServiceSetup.pkg)
> Select the installer format based on your distribution type.
- RPM Packages (Red Hat, Fedora, CentOS, etc.)
- [Linux RPM Installer v19](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/19.3.2/DynamicWebTWAINServiceSetup.rpm)
- [Linux RPM Installer v18](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/18.5.4/DynamsoftServiceSetup.rpm)
- DEB Packages (Ubuntu, Debian, etc.)
- [Linux DEB Installer v19](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/19.3.2/DynamicWebTWAINServiceSetup.deb)
- [Linux DEB Installer v18](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/18.5.4/DynamsoftServiceSetup.deb)
- ARM64 Architecture
- [Linux ARM64 DEB Installer v19](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/19.3.2/DynamicWebTWAINServiceSetup-arm64.deb)
- [Linux ARM64 DEB Installer v18](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/18.5.4/DynamsoftServiceSetup-arm64.deb)
- MIPS Architecture
- [Linux MIPS DEB Installer v19](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/19.3.2/DynamicWebTWAINServiceSetup-mips64el.deb)
- [Linux MIPS DEB Installer v18](https://download2.dynamsoft.com/Demo/DWT/Resources/dist/18.5.4/DynamsoftServiceSetup-mips64el.deb)
- Method 2. Click here to download the new certificate and use the new server.pem.ldsc & server_key.pem.ldsc to replace the old one in the `cert` folder under the service's [installation folder](/_articles/extended-usage/dynamsoft-service-configuration.md#installation-folder). Then restart Dynamic Web TWAIN Service.
- Method 3. [Contact Dynamsoft](/_articles/about/getsupport.md){:target="_blank"} for a new service installer for client-side. Please specify the exact service version build number found from the version your client currently has installed.
- Method 4. You can also generate the certificate by yourself. Check out this [post](/_articles/faq/change-dynamsoft-service-certificate.md).
---
title: Request header field dwt-md5 is not allowed by Access-Control-Allow-Headers in preflight response
description: Request header field dwt-md5 is not allowed by Access-Control-Allow-Headers in preflight response
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/dwt-md5-is-not-allowed.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/dwt-md5-is-not-allowed.md
---
# Error Troubleshooting
## Request header field dwt-md5 is not allowed by Access-Control-Allow-Headers in preflight response
### Symptom
When uploading images, the request fails with this CORS error.
### Cause
`dwt-md5` is a built-in header Dynamic Web TWAIN uses to validate upload integrity. Because it’s non-standard, browsers send a preflight OPTIONS request to confirm the header is allowed. If your server doesn’t allow it, the upload fails.
### Solution
Allow the `dwt-md5` header in your server’s CORS configuration. For IIS, add:
```xml
```
> Note
>
> After updating the server configuration file, you'll need to restart the server (i.e. IIS).
Check out more info [here](https://fetch.spec.whatwg.org/#http-cors-protocol)
---
title: Error message - The current product key does not support XXX, please contact the site administrator
description: Error message - The current product key does not support XXX, please contact the site administrator
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/error-message-current-product-key-does-not-support.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/error-message-current-product-key-does-not-support.md
---
# Error Troubleshooting
## Error message - The current product key does not support XXX, please contact the site administrator
### Symptom
You get an error message that says "The current product key does not support xxx…" or "The current product key is invalid because …".
### Cause
You are trying to use an unlicensed feature of Dynamic Web TWAIN or use it on an unlicensed Platform or Browser .
### Resolution
Make sure you have the correct license set in the proper configuration. If you have any questions please contact Dynamsoft Support.
---
title: Error message - The current product key is empty or invalid, please contact the site administrator
description: Error message - The current product key is empty or invalid, please contact the site administrator
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/error-message-current-product-key-is-empty-or-invalid.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/error-message-current-product-key-is-empty-or-invalid.md
---
# Error Troubleshooting
## Error message - The current product key is empty or invalid, please contact the site administrator
### Symptom
You get an error message that says "The current product key is empty or invalid, please contact the site administrator".
### Cause
You are trying to use an unlicensed feature of Dynamic Web TWAIN or use it on an unlicensed platform or browser.
### Resolution
Make sure you have the correct license set in the proper configuration. If you have any questions please contact Dynamsoft Support.
---
title: Error message - The domain of your current site does not match the domain bound in the current product key, please contact the site administrator.
description: Error message - The domain of your current site does not match the domain bound in the current product key, please contact the site administrator.
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/error-message-domain-of-site-doesnt-match-domain-bound-to-product-key.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/error-message-domain-of-site-doesnt-match-domain-bound-to-product-key.md
---
# Error Troubleshooting
## Error message - The domain of your current site does not match the domain bound in the current product key, please contact the site administrator.
### Symptom
When you visit a Dynamic Web TWAIN application, you may be met with this error message.
### Cause
To protect your license, you can bind it to your domain. When you do this, you must make sure your application is deployed to the bound domain, otherwise you will receive the error.
### Resolution
Make sure you deployed the application to the domain bound to your license or add the domain to your license bindings by contacting Dynamsoft Support.
---
title: Error message - The current product key is invalid because it's generated with the licenses of a different major version
description: Error message - The current product key is invalid because it's generated with the licenses of a different major version
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/error-message-license-generated-with-license-of-major-version.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/error-message-license-generated-with-license-of-major-version.md
---
# Error Troubleshooting
## Error message - The current product key is invalid because it's generated with the licenses of a different major version
### Symptom
You get an error message that says "The current product key is invalid because it's generated with the licenses of a different major version".
### Cause
You are trying to use a product key for a different major version.
### Resolution
Make sure you have the correct license set in the proper configuration. If you have doubts or questions, you can contact Dynamsoft Support.
---
title: Error message - The current product key does not support current OS for embed device, please contact the site administrator
description: Error message - The current product key does not support current OS for embed device, please contact the site administrator
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/error-message-product-key-does-not-support-current-os.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/error-message-product-key-does-not-support-current-os.md
---
# Error Troubleshooting
## Error message - The current product key does not support current OS for embed device, please contact the site administrator
### Symptom
You get an error message that says "The current product key does not support current OS for embed device, please contact the site administrator".
### Cause
You are trying to use a product key on an unlicensed OS.
### Resolution
Make sure you have the correct license set in the proper configuration and that the license you own covers the platform you are attempting to use. If you have any questions please contact Dynamsoft Support.
---
title: Error message – Your Dynamic Web TWAIN product key expired
description: Error message – Your Dynamic Web TWAIN product key expired
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/error-message-product-key-expired.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/error-message-product-key-expired.md
---
# Error Troubleshooting
## Error message – Your Dynamic Web TWAIN product key expired
### Symptom
You see the following pop-up

### Cause
The trial product key has expired.
### Resolution
Follow the instructions on that pop-up which are:
1. Request a new trial product key here. Refer to [this article](/_articles/indepth/development/upgrade.md#update-the-license-key){:target="_blank"} to update the ProductKey
2. Do a hard refresh or clear cache in your browser to make sure the new ProductKey is used
---
title: Error message - The current product key is missing the core license, please contact the site administrator
description: Error message - The current product key is missing the core license, please contact the site administrator
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/error-message-product-key-is-missing-the-core-license.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/error-message-product-key-is-missing-the-core-license.md
---
# Error Troubleshooting
## Error message - The current product key is missing the core license, please contact the site administrator
### Symptom
You get an error message that says "The current product key is missing the core license, please contact the site administrator".
### Cause
You are missing a license for the core module of Dynamic Web TWAIN, most likely only an addon license has been used.
### Resolution
Make sure you have the correct license set in the proper configuration. See [Using full licenses](/_articles/general-usage/license.md#using-full-licenses){:target="_blank"} for guidance. If you have doubts or questions, you can contact Dynamsoft Support.
---
title: Error message - The current product key is not for full/trial version, please contact the site administrator
description: Error message - The current product key is not for full/trial version, please contact the site administrator
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/error-message-product-key-is-not-for-full-version.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/error-message-product-key-is-not-for-full-version.md
---
# Error Troubleshooting
## Error message - The current product key is not for full/trial version, please contact the site administrator
You are trying to use a product key full/trial version that does not match with the Dynamic Web TWAIN Service (also called "Dynamsoft Service") full/trial version. Please uninstall your local Dynamic Web TWAIN Service first and access the page again to install the correct version.
Or make sure you have the correct license set in the proper configuration. If you have any questions please contact Dynamsoft Support.
---
title: General troubleshooting steps
description: Step-by-step guide for collecting verbose logs and reporting issues to Dynamsoft Support.
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/general-troubleshooting-steps.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/general-troubleshooting-steps.md
---
# Error Troubleshooting
## General Troubleshooting Steps
Before contacting support, complete the following steps:
1. Try the [Dynamic Web TWAIN online demo](https://demo.dynamsoft.com/web-twain/) to check whether the issue is reproducible outside your own application.
2. Open the browser developer tools (F12) and check the **Console** and **Network** tabs for errors. Note any error messages.
3. Enable verbose logging and collect the log files as described below.
## Enable and Collect Verbose Logs
1. Remove old log files in the `log` folder under the service's [installation folder](/_articles/extended-usage/dynamsoft-service-configuration.md#installation-folder).
2. Set the log level using one of the options below:
- **Option A (recommended) — Single client machine (no coding required):** Use the Dynamic Web TWAIN Service information page.
1. Open [http://127.0.0.1:18625/](http://127.0.0.1:18625/) in a browser on the client machine.
2. Under **Detailed information**, locate the **Log** row.
3. Click **(change)** to enable verbose logging.
> [!NOTE]
> If **(change)** is not available, enable Web Setup by setting `EnableWebSetup=TRUE` in `DSConfiguration.ini` (admin privileges required), then restart the Dynamic Web TWAIN Service. See [Web Setup](/_articles/extended-usage/dynamsoft-service-configuration.md#web-setup).

- **Option B — Single client machine:** Add the line `LogLevel=14` to `DSConfiguration.ini` on the machine. The `DSConfiguration.ini` file is in the **parent directory** of the log folder.
- **Option C — All client machines (application-wide):** Set [`LogLevel`](/_articles/info/api/WebTwain_Util.md#loglevel) to `1` in your application code. This should be set as early as possible when the `WebTwain` instance is created — for example, in the `Dynamsoft_OnReady` event:
```javascript
function Dynamsoft_OnReady() {
DWTObject = Dynamsoft.DWT.GetWebTwain("dwtcontrolContainer");
DWTObject.LogLevel = 1;
}
```
3. Perform a hard refresh (**Ctrl + F5**) on the application page and reproduce the issue.
4. Optionally, create a `.txt` file noting the exact time the issue occurred and place it in the same log folder — this helps pinpoint the relevant log entries faster.
5. Zip the log folder and share it with the [Dynamsoft Support Team](/_articles/about/getsupport.md).
> [!IMPORTANT]
> After collecting the logs, disable verbose logging — leaving it enabled will affect scanning performance.
> - **Option A**: Click **(change)** again on the service page.
> - **Option B**: Remove the `LogLevel` line from `DSConfiguration.ini`.
> - **Option C**: Set `DWTObject.LogLevel` back to `0` in your application code.
---
title: Sequence error
description: Sequence error
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/sequence-error.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/sequence-error.md
---
# Error Troubleshooting
## Sequence error
### Symptom
When you fail to acquire images from your scanner, you may get this error.
### Cause
This problem occurs when the correct order of operations is not followed for the TWAIN sequence.
### Resolution
Check if you followed the acquisition sequence to get images from your device. For example, some methods and properties, like the [PixelType](/_articles/info/api/WebTwain_Acquire.md#pixeltype) property, can only be used after calling the [OpenSource()](/_articles/info/api/WebTwain_Acquire.md#opensource) method. Please check the TWAIN State Transition Diagram below for more information

---
title: Source is connected to the maximum supported number of applications
description: Source is connected to the maximum supported number of applications
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/source-connected-to-maximum.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/source-connected-to-maximum.md
---
# Error Troubleshooting
## Source is connected to the maximum supported number of applications
### Symptom
When you try to acquire images, you may get this error.
### Cause
The problem may occur when the source is **not** disabled completely after a transfer ends or is used by other applications.
### Resolution
- Check whether another application is using the source. If yes, close it and try again.
- Set [IfDisableSourceAfterAcquire](/_articles/info/api/WebTwain_Acquire.md#ifdisablesourceafteracquire) to `true` and use [CloseSource()](/_articles/info/api/WebTwain_Acquire.md#closesource) to make sure that the source is closed after a scanning session.
```javascript
function btnScan_onclick() {
DWTObject.RegisterEvent("OnPostAllTransfers", function () {
DWTObject.CloseSource();
});
DWTObject.SelectSource();
DWTObject.CloseSource(); //close source before open
DWTObject.OpenSource();
DWTObject.IfDisableSourceAfterAcquire = true; //close the scanner UI after acquiring
DWTObject.AcquireImage();
}
```
- Reboot your device.
---
title: Syntax error – Unexpected Token "<"
description: Syntax error – Unexpected Token "<"
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/syntax-error-unexpected-token.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/syntax-error-unexpected-token.md
---
# Error Troubleshooting
## Syntax error – Unexpected Token "<"
This is usually because the request to load our resources is returning a 404 error.
Please make sure the path to dwt-resources is correct and that you can find \*.viewer.js under the src folder. If it does not exist, please manually copy the Dynamic Web TWAIN resources to that folder.
Please refer to this link for more details on server deployment [Dynamic Web TWAIN Deployment - Server Deployment](/_articles/general-usage/server-deployment.md){:target="_blank"}.
---
title: What is your discount policy?
description: What is your discount policy?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/discount-policy.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/discount-policy.md
---
# Licensing and Purchase
## What is your discount policy?
We offer discounts based on the below mentioned criteria:
- Educational and non-profit discounts are available. Please send your info to sales@dynamsoft.com to see if you are qualified.
- Discounts are also available for volume purchases or licenses for non-production use. Please contact us to get a discounted quote.
---
title: Does the per-server license allow unlimited number of client devices and end users?
description: Does the per-server license allow unlimited number of client devices and end users?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/does-per-server-allow-unlimited.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/does-per-server-allow-unlimited.md
---
# Licensing and Purchase
## Does the per-server license allow unlimited number of client devices and end users?
Yes. With per server license, you get an unlimited number of client devices and end users.
Note that every VM or machine (either a server or workstation) that hosts the web app needs a 1-server license seat.
If your application is a commercial cloud service, the per-server license may not be applicable. Please submit your requirement via this quote form to our sales team so we can provide proper licensing option to fit in your need.
---
title: Are you flexible to discuss custom licensing models?
description: Are you flexible to discuss custom licensing models?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/flexible-to-custom-license.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/flexible-to-custom-license.md
---
# Licensing and Purchase
## Are you flexible to discuss custom licensing models?
Yes. We understand our standard options may not cover your need, so we are very flexible with different licensing metrics to best serve your business. Please submit your request via this form or directly contact us.
---
title: Do I get free upgrade if there is a newer version available?
description: Do I get free upgrade if there is a newer version available?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/free-upgrade.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/free-upgrade.md
---
# Licensing and Purchase
## Do I get free upgrade if there is a newer version available?
If you have a valid annual maintenance contract with us, then you are eligible for free upgrades as well as premium tech support. If you don't know the status of your maintenance contract, please send your license info to sales@dynamsoft.com.
---
title: Is internet connectivity required to use all licenses?
description: Is internet connectivity required to use all licenses?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/is-internet-connectivity-required.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/is-internet-connectivity-required.md
---
# Licensing and Purchase
## Is internet connectivity required to use all licenses?
No it is not mandatory, but different licensing options leverage different techniques.
Generally, you need to use a license server program to distribute your purchased license seats to specified devices.
Option #1: Connect to a license server hosted by Dynamsoft
- Dynamsoft has the license server hosted on Amazon's AWS. If your device can connect to the internet, you can easily license your devices this way. More Detail >
Option #2: Host the license server program on your own server machine
- By hosting the license server internally, all your devices can get licensed via your intranet. This is suggested if you don't allow internet connection of your devices. More Detail >
Option #3: Discuss custom licensing with Dynamsoft
- If neither of the above options is desired, we can also provide a non-tracking offline license with a trust-based agreement signed by both parties. Please contact us to discuss it.
---
title: What if I reach the limit of the granted number of license seats?
description: What if I reach the limit of the granted number of license seats?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/license-limit-reached.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/license-limit-reached.md
---
# Licensing and Purchase
## What if I reach the limit of the granted number of license seats?
For Per Client Device or Per Page licensing model, we offer some additional quota at no cost in case you can't extend or expand the license in time. For details, see What happens if my license runs out?. To avoid running out of licensed seats suddenly, Dynamsoft sends notification emails automatically to licensees about the status of the license. Please refer to Usage Alerts.
For other licensing models, please refer to the contract or agreement you signed or contact your account manager for help.
---
title: Do you have any local resellers from whom I can purchase a license of the Dynamic Web TWAIN SDK?
description: Do you have any local resellers from whom I can purchase a license of the Dynamic Web TWAIN SDK?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/local-resellers.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/local-resellers.md
---
# Licensing and Purchase
## Do you have any local resellers from whom I can purchase a license of the Dynamic Web TWAIN SDK?
Yes. To see if there is an authorized local reseller in your region, please go to this page. If you can't find an appropriate one from the list, you can contact your preferred local reseller and have them email reseller@dynamsoft.com for quick registration. The registration process takes 1 - 3 business days. Or, contact us so we can look into it directly.
---
title: Do you offer lifetime/perpetual licenses?
description: Do you offer lifetime/perpetual licenses?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/offer-perpetual-license.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/offer-perpetual-license.md
---
# Licensing and Purchase
## Do you offer lifetime/perpetual licenses?
Yes, we offer a lifetime/perpetual license, which typically includes one year of software maintenance service. To receive upgrades and premium technical support, you would need to renew your yearly maintenance. Learn more about [the benefits of maintenance](https://www.dynamsoft.com/company/annual-maintenance/).
To obtain pricing for your specific scenario, please visit our "[Ask for Quote](https://www.dynamsoft.com/store/dynamic-web-twain/)" page.
---
title: Do I need to purchase a license for my dev or testing environment?
description: Do I need to purchase a license for my dev or testing environment?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/purchase-dev-or-test-license.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/purchase-dev-or-test-license.md
---
# Licensing and Purchase
## Do I need to purchase a license for my dev or testing environment?
The answer will depend upon the timeframe in which it is used and the environment in which you are testing.
- For ongoing development and testing, you can purchase a license from the online store to cover your usage. If you expect to consume a large volume of scans or browser clients during your dev or testing, please contact us for a discount.
- For evaluation, you can use the 30-day free trial SDK provided by Dynamsoft.
- For temporary development and testing, you can contact support@dynamsoft.com or log into the customer portal to get a 15-day (max. 30 days) temporary license.
---
title: What's your refund policy?
description: What's your refund policy?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/refund-policy.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/refund-policy.md
---
# Licensing and Purchase
## What's your refund policy?
- All purchases are governed by our 30-Day Money-Back Guarantee policy.
- If you are not completely satisfied, you may request a full refund by sending an e-mail to sales@dynamsoft.com within 30 days of purchasing a license.
---
title: For the per-client-device licensing model, can seats taken by retired/unused devices be released from the license?
description: For the per-client-device licensing model, can seats taken by retired/unused devices be released from the license?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/release-license-seats.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/release-license-seats.md
---
# Licensing and Purchase
## For the per-client-device licensing model, can seats taken by retired/unused devices be released from the license?
Yes. Seats tied to a device are automatically released if that device hasn’t used the SDK for 90 days. A client device is simply the end user’s computer (Windows/macOS/Linux).
---
title: I need to resell the SDK within my application to my customers. What options do you offer?
description: I need to resell the SDK within my application to my customers. What options do you offer?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/resell-sdk.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/resell-sdk.md
---
# Licensing and Purchase
## I need to resell the SDK within my application to my customers. What options do you offer?
We are happy to discuss an OEM partnership agreement with you if you are selling your commercial application with our SDK integrated to your end customers.
You may submit your requirement via this quote form and our sales team will contact you for further discussion.
---
title: Will a client machine take an additional license seat if its operating system is reinstalled?
description: Will a client machine take an additional license seat if its operating system is reinstalled?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/seat-taken-if-os-reinstalled.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/seat-taken-if-os-reinstalled.md
---
# Licensing and Purchase
## Will a client machine take an additional license seat if its operating system is reinstalled?
Yes, When a client device is licensed, a random UUID is issued to the client device. Reinstalling the device OS would erase the UUID, so if the device accesses the SDK feature again, it will take a new UUID – i.e. a new license seat will be taken.
However, if an UUID has no usage of the SDK for consecutive 90 days, the license seat taken by the UUID will be automatically released. Furthermore, our Per-Client-Device license allows you to overuse up to an additional 10% of the purchased device quota, which helps relieve minor misuse or device reinstallation. For example, if you purchase a license for 100 client devices, you can actually license 110 devices.
---
title: What license should I purchase if I am providing SaaS?
description: What license should I purchase if I am providing SaaS?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/which-license-purchase-needed-for-saas.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/which-license-purchase-needed-for-saas.md
---
# Licensing and Purchase
## What license should I purchase if I am providing SaaS?
The Per Client Device licensing model suits any usage scenarios including SaaS.
Please note that Dynamsoft Sales team is open to discuss any custom licensing option that may better fit in your need. To help us learn your requirement in detail, we recommend that you submit your requirement via this quote form and our team will contact you for further discussion.
---
title: How can I verify if my physical document scanner works with the Dynamic Web TWAIN SDK?
description: How can I verify if my physical document scanner works with the Dynamic Web TWAIN SDK?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/verify-if-device-is-supported.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/verify-if-device-is-supported.md
---
# Capture/Image Source
## How can I verify if my physical document scanner works with the Dynamic Web TWAIN SDK?
Dynamsoft supports the following types of scanners:
- TWAIN Scanners (for Windows)
- ICA Scanners (for macOS)
- SANE Scanners (for Linux)
There are two ways to check if a physical document scanner is compatible:
1) Verify via Dynamsoft's Online Demo
The fastest and most convenient way is to check using our online demo, which is built based on the Dynamic Web TWAIN SDK. If your scanner shows in the source list and can scan documents properly, it means it works well with our SDK.

2) Use Native Program to Verify
### For Windows
Use the tool called Twacker which is developed by the TWAIN Working Group to verify if a scanner is TWAIN compatible on a Windows machine.
1. Download and install
(Note: Please download the version of TWACKER that matches your driver architecture, not your operating system architecture. In most cases, it would be 32-bit.)
- 32-bit
- 64-bit
2. Open the program
3. Select your device from File -> Select Source...
(Note: If your device is not listed, please check if the driver is installed. Or, try running Twacker as admin to see if it shows up.)
4. Try scanning a document via Acquire...

If scanning is successful without any errors, then your device should be TWAIN compliant. You can also try other commands to see how it works. If your scanner doesn't work with TWACKER, please check your scanner model online and make sure you have installed the (latest) TWAIN driver from its manufacturer.
### For macOS
Use the Image Capture app (provided by Apple Inc.) to verify if a scanner is ICA compatible on a macOS machine.
1. Find the Image Capture application

2. Open the application
3. Acquire an image and see how it works

For more info, please check out the official guide.
### For Linux
Use the XSane app to verify if a scanner is SANE compatible on a Linux machine.
Please check out the official guide for more details.
---
title: How can I use a custom capability of my scanner hardware when there is no direct API to set it?
description: How can I use a custom capability of my scanner hardware when there is no direct API to set it?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/custom-capability.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/custom-capability.md
---
# Capture/Image Source
## How can I use a custom capability of my scanner hardware when there is no direct API to set it?
You can use Capability Negotiation to set it. Capability Negotiation is the way a TWAIN application communicates with a TWAIN source. This is how Dynamic Web TWAIN communicates with a scanner. The process looks something like this:
- [Dynamic Web TWAIN] Are you capable of \*\*\*?
- [Scanner] Yes, and here is what I can do…
- [Dynamic Web TWAIN] Great, here is what I want done…
- [Scanner] Consider it done
The steps are:
1. Use [getCapabilities](/_articles/info/api/WebTwain_Acquire.md#getcapabilities){:target="_blank"} to find the capability you want to set.
```javascript
DWTObject.OpenSource();
DWTObject.getCapabilities(
function () {
console.log(arguments);
},
function (error) {
console.log(error);
}
);
```
- Alternatively, you can install the [TWAIN Sample App](http://www.dynamsoft.com/download/support/twainapp.win32.installer.msi) to check the capabilities available and their values.
2. Use [setCapabilities](/_articles/info/api/WebTwain_Acquire.md#setcapabilities){:target="_blank"} to set the capability.
```javascript
DWTObject.setCapabilities(
{
exception: "ignore",
capabilities: [
{
capability: Dynamsoft.DWT.EnumDWT_Cap.ICAP_CONTRAST,
curValue: 500, // set the contrast to 500
exception: "fail",
},
],
},
function (result) {
console.log(result);
},
function (error) {
console.log(error);
}
);
```
---
title: Can the Dynamic Web TWAIN SDK detect whether papers exist on the flatbed?
description: Can the Dynamic Web TWAIN SDK detect whether papers exist on the flatbed?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/detect-paper-on-flatbed.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/detect-paper-on-flatbed.md
---
# Capture/Image Source
## Can the Dynamic Web TWAIN SDK detect whether papers exist on the flatbed?
Yes. You can use [IfFeederLoaded](/_articles/info/api/WebTwain_Acquire.md#iffeederloaded){:target="_blank"} API to inspect whether papers are loaded in the feeder of your current scanner. Before calling this API, please use [IfPaperDetectable](/_articles/info/api/WebTwain_Acquire.md#ifpaperdetectable){:target="_blank"} to inspect whether your current scanner hardware has a sensor to detect papers.
Code Example:
```javascript
DWTObject.SelectSource();
DWTObject.OpenSource();
if(DWTObject.IfPaperDetectable)
if(DWTObject.IfFeederLoaded)
DWTObject.AcquireImage();
else
alert("There is no paper in the feeder.");
...
...
```
---
title: Document scanning via the Dynamic Web TWAIN SDK is slower than using the native scanner application. How can I speed it up?
description: Document scanning via the Dynamic Web TWAIN SDK is slower than using the native scanner application. How can I speed it up?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/document-scanning-slow-than-native.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/document-scanning-slow-than-native.md
---
# Capture/Image Source
## Document scanning via the Dynamic Web TWAIN SDK is slower than using the native scanner application. How can I speed it up?
First, confirm you are using the same scan settings (color mode, DPI, duplex, etc.) as the native app.
If settings match, look for extra work in your callbacks. Check code in `AcquireImage()` callbacks like [`OnPostTransfer`](/_articles/info/api/WebTwain_Acquire.md#onposttransfer){:target="_blank"} and [`OnPostAllTransfers`](/_articles/info/api/WebTwain_Acquire.md#onpostalltransfers){:target="_blank"}. If you must run per-page logic, prefer [`OnPostTransferAsync`](/_articles/info/api/WebTwain_Acquire.md#onposttransferasync){:target="_blank"} to avoid blocking the scan pipeline.
If the scanning performance issue persists, please contact us.
---
title: Can I download an image from an FTP or HTTP server using the Dynamic Web TWAIN SDK?
description: Can I download an image from an FTP or HTTP server using the Dynamic Web TWAIN SDK?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/download-image-from-FTP-or-HTTP-server.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/download-image-from-FTP-or-HTTP-server.md
---
# Capture/Image Source
## Can I download an image from a FTP or HTTP server using the Dynamic Web TWAIN SDK?
Yes, you can download an image from a FTP or HTTP server using the Dynamic Web TWAIN SDK by using FTPDownload and HTTPDownload. You can find [here](/_articles/info/api/WebTwain_IO.md#input-methods){:target="_blank"} all the input methods that are provided by Dynamic Web TWAIN SDK.
---
title: Do you support fingerprint or medical imaging devices?
description: Do you support fingerprint or medical imaging devices?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/fingerprint-medical-imaging.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/fingerprint-medical-imaging.md
---
# Capture/Image Source
## Do you support fingerprint or medical imaging devices?
The Dynamic Web TWAIN SDK works with any TWAIN specification compatible devices including fingerprint devices.
However, there are not many fingerprint devices that provide TWAIN drivers. You can refer to this blog for some info.
For medical imaging devices, DICOM is a common specification, which is not supported by our Dynamic Web TWAIN SDK.
---
title: Can I hide offline scanner devices from the select source list?
description: Can I hide offline scanner devices from the select source list?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/hide-offline-scanners-from-source-list.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/hide-offline-scanners-from-source-list.md
---
# Capture/Image Source
## Can I hide offline scanner devices from the select source list?
Generally, the modern scanner drivers have the functionality to auto-hide themselves if they are not connected. If your scanner doesn't hide itself when it is offline, unfortunately, there is no good way to automatically remove this offline device from showing on the source list.
If your requirement is to hide some specific devices (e.g. hide all Epson scanners) from the source list, this could be achieved by using the below example:
```javascript
var sources = DWTObject.GetSourceNames();
for (var i = 0; i < sources.length; i++) {
if (sources[i].toLowerCase().indexOf("epson") != -1) {
sources.splice(i, 1);
}
}
```
---
title: Can I hide webcam devices from the select source list?
description: Can I hide webcam devices from the select source list?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/hide-webcam-from-source-list.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/hide-webcam-from-source-list.md
---
# Capture/Image Source
## Can I hide webcam devices from the select source list?
Many webcam devices may use WIA drivers. As explained in this article, WIA drivers can also be detected by the Dynamic Web TWAIN SDK. If you need to exclude webcam/camera devices, you can try using [GetDeviceType](/_articles/info/api/WebTwain_Acquire.md#getdevicetype){:target="_blank"} API to verify if a source is a scanner or not. If not, you can skip it from your source list.
Please note that you would need to call [OpenSource](/_articles/info/api/WebTwain_Acquire.md#opensource){:target="_blank"} API to open a source before you can inspect its device type. If there are any offline devices in the source name list, this process would be interrupted.
Another workaround is to exclude some sources by detecting certain keywords from the source name list. E.g. you can try to exclude any source names with 'camera' or 'webcam'. Please refer to this [FAQ](/_articles/faq/hide-offline-scanners-from-source-list.md){:target="_blank"} for more details.
---
title: Can I import existing images or PDF documents using the Dynamic Web TWAIN SDK?
description: Can I import existing images or PDF documents using the Dynamic Web TWAIN SDK?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/import-existing-documents-or-images.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/import-existing-documents-or-images.md
---
# Capture/Image Source
## Can I import existing images or PDF documents using the Dynamic Web TWAIN SDK?
Yes, Dynamic Web TWAIN supports loading PNG, JPG, BMP, image-only PDF, and TIFF files. But if you need to support text-based PDF files, you also require the PDF Rasterizer Addon.
**Code snippet**
```javascript
var onSuccess = function() {
console.log("Loaded a file successfully!");
};
var onFailure = function(errorCode, errorString) {
console.log(errorString);
};
DWTObject.IfShowFileDialog = true;
// PDF Rasterizer Addon is used here to ensure text-based PDF support
DWTObject.Addon.PDF.SetReaderOptions({
convertMode: Dynamsoft.DWT.EnumDWT_ConvertMode.CM_RENDERALL,
renderOptions:{
renderAnnotations: true,
resolution: 300,
}
});
DWTObject.LoadImage();
```
#### Related Links
[PDF Rasterizer Guide](/_articles/extended-usage/pdf-processing.md){:target="_blank"}.
[API Documentation](/_articles/info/api/Addon_PDF.md)
---
title: How can I set the last selected source as the default source for an end user?
description: How can I set the last selected source as the default source for an end user?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/last-selected-sourcename.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/last-selected-sourcename.md
---
# Capture/Image Source
## How can I set the last selected source as the default source for an end user?
[DefaultSourceName](/_articles/info/api/WebTwain_Acquire.md#defaultsourcename){:target="_blank"} is the API which you can use to leverage this functionality.
Example:

---
title: Is there a limit on the number of pages I can scan at a time? Where do you store them after scanning?
description: Is there a limit on the number of pages I can scan at a time? Where do you store them after scanning?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/limit-on-scanned-pages.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/limit-on-scanned-pages.md
---
# Capture/Image Source
## Is there a limit on the number of pages I can scan at a time? Where do you store them after scanning?
Dynamic Web TWAIN Desktop Service edition allows you to scan unlimited number of pages from a physical document scanner.
The Desktop Service edition can run in 32-bit and 64-bit and the data is stored raw in DIB format. Starting from version 15.0, 64-bit has been made the default option on a 64-bit OS and that means the available address space is large enough that you are unlikely to hit memory limits in normal scenarios. However, physical memory size is always finite, so a good practice is to store images to memory by default and temporarily cache some images to the local disk when the used memory size exceeds a specific value (e.g. 800MB).
Note the disk caching feature is turned on by default and you can change the setting by using the following APIs
- [IfAllowLocalCache](/_articles/info/api/WebTwain_Buffer.md#ifallowlocalcache){:target="_blank"}
- [BufferMemoryLimit](/_articles/info/api/WebTwain_Buffer.md#buffermemorylimit){:target="_blank"} (defaults to 800MB)
---
title: How can I limit all users to use a specific scanner model?
description: How can I limit all users to use a specific scanner model?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/limit-to-specific-scanner.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/limit-to-specific-scanner.md
---
# Capture/Image Source
## How can I limit all users to use a specific scanner model?
You can limit all the users to use a specific scanner model by automatically selecting that scanner programmatically. Use the method [SelectSourceByIndex()](/_articles/info/api/WebTwain_Acquire.md#selectsourcebyindex){:target="_blank"} to select a scanner by its index in the source list. In some cases, you may want to select a source by its name as shown in the example below. This way you can use the specific scanner model.
```javascript
var sources = DWTObject.GetSourceNames();
sources.find(function (name, index) {
//"EPSON DS-530" is the name of the scanner
if (name === "EPSON DS-530") DWTObject.SelectSourceByIndex(index);
});
```
---
title: How can I get a list of supported resolution/DPI values from the document scanner?
description: How can I get a list of supported resolution/DPI values from the document scanner?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/list-supported-resolution-DPI.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/list-supported-resolution-DPI.md
---
# Capture/Image Source
## How can I get a list of supported resolution/DPI values from the document scanner?
You can use capability negotiation to get all the resolutions supported by the scanner.
Steps:
- Step-1: Use [getCapabilities](/_articles/info/api/WebTwain_Acquire.md#getcapabilities){:target="_blank"} to get all capabilities of the current data source,
```javascript
DWTObject.OpenSource();
DWTObject.getCapabilities(
function () {
console.log(arguments);
},
function (error) {
console.log(error);
}
);
```
and then find the capability corresponding to the resolution. Normally, it is called ICAP_XRESOLUTION.

- Step-2: Call the following code to get all the resolutions supported by the scanner.
```javascript
DWTObject.OpenSource();
DWTObject.getCapabilities(
function (result) {
for (var i = 0; i < result.length; i++) {
if (result[i].capability.value === Dynamsoft.DWT.EnumDWT_Cap.ICAP_XRESOLUTION) {
if (result[i].conType.label === 'TWON_ENUMERATION') { // If the capability's Value Type is Enumeration
dpi = result[i].values;
console.log(dpi); // The list of supported resolution.
} else if (result[i].conType.label === 'TWON_RANGE') { // If the capability's Value Type is Range
max = result[i].maxValue;
min = result[i].minValue;
step = result[i].stepSize;
console.log("maxValue: " + max); // The maximum value for the resolution.
console.log("minValue: " + min); // The minimum value for the resolution.
console.log("stepSize: " + step); // The step size for the resolution.
} else {
console.log("Please contact Dynamsoft for help.");
}
}
}
},
function (error) {
console.log(error);
}
);
```
---
title: Can I set my document scanner to scan x pages instead of all pages from the automatic document feeder (ADF)?
description: Can I set my document scanner to scan x pages instead of all pages from the automatic document feeder (ADF)?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/scan-x-pages-from-automatic-document-feeder.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/scan-x-pages-from-automatic-document-feeder.md
---
# Capture/Image Source
## Can I set my document scanner to scan x number of pages instead of all pages from the automatic document feeder (ADF)?
Yes. You can use [XferCount](/_articles/info/api/WebTwain_Acquire.md#xfercount){:target="_blank"} to set the number of pages you'd like to scan from the feeder at a time. However, please note that the XferCount API is a hardware-dependent feature, so it only works properly if your scanner device supports it.
---
title: Can I set scanning settings without using the default scanner's UI? What pre-scanning settings do you support?
description: Can I set scanning settings without using the default scanner's UI? What pre-scanning settings do you support?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/setting-scan-settings-without-ui.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/setting-scan-settings-without-ui.md
---
# Capture/Image Source
## Can I set scanning settings without using the default scanner's UI? What pre-scanning settings do you support?
Yes, you can set the scanner settings without using the default scanner's UI. By setting [IfShowUI](/_articles/info/api/WebTwain_Acquire.md#ifshowui){:target="_blank"} to false, the default scanner's UI is hidden.
Then, you can instead set multiple settings by passing the configuration settings to acquire image api. Please refer to [this API instruction page](/_articles/info/api/WebTwain_Acquire.md#acquireimage){:target="_blank"} for more details.
---
title: Do you support capturing documents from mobile cameras?
description: Do you support capturing documents from mobile cameras?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/support-capture-from-mobile-camera.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/support-capture-from-mobile-camera.md
---
# Capture/Image Source
## Do you support capturing documents from mobile camera?
While Dynamic Web TWAIN has discontiued its support of using mobile cameras starting from version [18.1](/_articles/info/schedule/Stable.md#181-01122023), we are introducing [Mobile Document Scanner](https://www.dynamsoft.com/use-cases/mobile-document-scanner/) for better performance and customizability.
---
title: How can I trigger an automatic workflow right after document scanning or image importing?
description: How can I trigger an automatic workflow right after document scanning or image importing?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/trigger-automatic-workflow-after-scanning.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/trigger-automatic-workflow-after-scanning.md
---
# Capture/Image Source
## How can I trigger an automatic workflow right after document scanning or image importing?
There are many events available to help you build an automatic business workflow in your document scanning application.
If you scan papers from your physical document scanners, you can use the [OnPostTransfer](/_articles/info/api/WebTwain_Acquire.md#onposttransfer){:target="_blank"} or [OnPostTransferAsync](/_articles/info/api/WebTwain_Acquire.md#onposttransferasync){:target="_blank"} event to trigger actions right after each page is successfully scanned. You can use [OnPostAllTransfers](/_articles/info/api/WebTwain_Acquire.md#onpostalltransfers){:target="_blank"} if you need to trigger any actions once all pages are scanned successfully.
If you import images from your local disk, you can use the [OnPostLoad](/_articles/info/api/WebTwain_IO.md#onpostload){:target="_blank"} event which triggers right after each file is successfully loaded.
---
title: Can I use built-in or USB webcam to capture document?
description: Can I use built-in or USB webcam to capture document?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/use-usb-webcam-to-capture.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/use-usb-webcam-to-capture.md
---
# Capture/Image Source
## Can I use built-in or USB webcam to capture document?
Yes, you can use either the built-in webcam or a USB-connected webcam to capture documents. To verify if your device supports the DirectShow architecture, you can test it using the [online demo](https://demo.dynamsoft.com/web-twain/camera-scan).
---
title: What physical document scanners does the Dynamic Web TWAIN SDK support?
description: What physical document scanners does the Dynamic Web TWAIN SDK support?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/what-physical-scanners-are-supported.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/what-physical-scanners-are-supported.md
---
# Capture/Image Source
## What physical document scanners does the Dynamic Web TWAIN SDK support?
Dynamic Web TWAIN's main feature is interacting with imaging devices like scanners and cameras. Here is the list of supported document scanners.
1. TWAIN Scanners (for Windows)
2. ICA Scanners (for macOS)
3. SANE Scanners (for Linux)
You can learn more details about each type of device on this page.
TWAIN, ICA and SANE are free scanner driver specifications and they have been adopted by almost all the scanner manufacturers in the market. Network scanners are also supported as long as there is a TWAIN/ICA/SANE scanner driver available.
Therefore, Dynamic Web TWAIN SDK has great compatibilities with almost all scanners in the market. Note that ScanSnap is one known scanner model that is not TWAIN compliant. To verify if your scanner is compatible with our SDK, you can refer to [this article](/_articles/faq/verify-if-device-is-supported.md).
---
title: How can I change the display language of all messages from English to another language?
description: How can I change the display language of all messages from English to another language?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/change-display-language.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/change-display-language.md
---
# UI Customization
## How can I change the display language of all messages from English to another language?
You can customize the display language in dynamsoft.webtwain.config.js by changing the values of the properties of the Dynamsoft.DWT.CustomizableDisplayInfo object.
```javascript
Dynamsoft.DWT.CustomizableDisplayInfo = {
errorMessages: {
// launch
ERR_MODULE_NOT_INSTALLED:
"Error: The Dynamic Web TWAIN module is not installed.",
ERR_BROWSER_NOT_SUPPORT: "Error: This browser is currently not supported.",
ERR_CreateID_MustNotInContainers:
"Error: Duplicate ID detected for creating Dynamic Web TWAIN objects, please check and modify.",
ERR_CreateID_NotContainer:
"Error: The ID of the DIV for creating the new DWT object is invalid.",
ERR_DWT_NOT_DOWNLOADED:
"Error: Failed to download the Dynamic Web TWAIN module.",
// image view
limitReachedForZoomIn: "Error: You have reached the limit for zooming in",
limitReachedForZoomOut: "Error: You have reached the limit for zooming out",
// image editor
insufficientParas: "Error: Not enough parameters.",
invalidAngle: "Error: The angle you entered is invalid.",
invalidHeightOrWidth: "Error: The height or width you entered is invalid.",
imageNotChanged: "Error: You have not changed the current image.",
},
// launch
generalMessages: {
checkingDWTVersion: "Checking WebTwain version ...",
updatingDService: "Dynamic Web TWAIN Service is updating ...",
downloadingDWTModule: "Downloading the Dynamic Web TWAIN module.",
refreshNeeded: "Please REFRESH your browser.",
downloadNeeded: "Please download and install the Dynamic Web TWAIN.",
DWTmoduleLoaded: "The Dynamic Web TWAIN module is loaded.",
},
customProgressText: {
// html5 event
upload: "uploading...",
download: "Downloading...",
load: "Loading...",
decode: "Decoding...",
decodeTIFF: "Decoding tiff...",
decodePDF: "Decoding pdf...",
encode: "Encoding...",
encodeTIFF: "Encoding tiff...",
encodePDF: "Encoding pdf...",
// image control
canvasLoading: "Loading ...",
},
// image editor
buttons: {
titles: {
previous: "Previous Image",
next: "Next Image",
print: "Print Image",
scan: "Acquire new Image(s)",
load: "Load local Image(s)",
rotateleft: "Rotate Left",
rotate: "Rotate",
rotateright: "Rotate Right",
deskew: "Deskew",
crop: "Crop Selected Area",
cut: "Cut Selected Area",
changeimagesize: "Change Image Size",
flip: "Flip Image",
mirror: "Mirror Image",
zoomin: "Zoom In",
originalsize: "Show Original Size",
zoomout: "Zoom Out",
stretch: "Stretch Mode",
fit: "Fit Window",
fitw: "Fit Horizontally",
fith: "Fit Vertically",
hand: "Hand Mode",
rectselect: "Select Mode",
zoom: "Click to Zoom In",
restore: "Restore Original Image",
save: "Save Changes",
close: "Close the Editor",
removeall: "Remove All Images",
removeselected: "Remove All Selected Images",
},
},
dialogText: {
dlgRotateAnyAngle: [
"Angle :",
"Interpolation:",
"Keep size",
" OK ",
"Cancel",
],
dlgChangeImageSize: [
"New Height :",
"New Width :",
"Interpolation method:",
" OK ",
"Cancel",
],
saveChangedImage: [
"You have changed the image, do you want to keep the change(s)?",
" Yes ",
" No ",
],
selectSource: [
"Select Source:",
"Select",
"Cancel",
"There is no source available!",
],
},
};
```
For the Dynamic Web TWAIN Service (also called "Dynamsoft Service") installation message below, you can customize the display language by searching for `Dynamsoft._show_install_dialog` in dynamsoft.webtwain.install.js, and changing the display language accordingly.

---
title: How can I change/hide the spinner which shows during document scanning?
description: How can I change/hide the spinner which shows during document scanning?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/change-hide-spinner.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/change-hide-spinner.md
---
# UI Customization
## How can I change/hide the spinner which shows during document scanning?
You can change/hide the loading bar which is shown during document scanning. The detailed steps can be found in [this link](/_articles/extended-usage/ui-customization.md#loading-bar-and-backdrop){:target="_blank"}.
> Note: there is a known issue in v17.3, if you cannot hide the loading bar with the above method, please refer to this [link](/_articles/faq/unable-hide-loading-bar.md).
---
title: Can I customize UI elements of the built-in image editor?
description: Can I customize UI elements of the built-in image editor?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/customize-ui-elements-of-image-editor.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/customize-ui-elements-of-image-editor.md
---
# UI Customization
## Can I customize UI elements of the built-in image editor?
Yes, you can perform various customizations on the image editor. Some of such customizations are shown below as examples.
### Can I change the language of the Editor?
Yes, as shown in the sample code below, you can use the parameters `titles` and `dialogText` to specify the language used in the editor.
```javascript
titles: {
'previous': 'Previous Image',
'next': 'Next Image',
'print': 'Print Image',
'scan': 'Scan Documents',
'load': 'Load Local Images'
}
```
```javascript
dialogText: {
dlgRotateAnyAngle: ['Angle :', 'Interpolation:', 'Keep size', ' OK ', 'Cancel'],
dlgChangeImageSize: ['New Height :', 'New Width :', 'Interpolation method:', ' OK ', 'Cancel'],
saveChangedImage: ['You have changed the image, do you want to keep the change(s)?', ' Yes ', ' No '],
selectSource: ['Select Source:', 'Select', 'Cancel', 'There is no source available']
}
```
### Can I remove or add buttons on the toolbar of the Editor?
While you can use `visibility` (as shown in the sample code below) to remove a default button(s), currently you cannot add a custom button.
```javascript
visibility: {
'scan': true,
'load': true,
'print': false,
'removeall': true
}
```
You can see the print icon is hidden in the image below.

### Can I specify where and how big the Editor is?
Yes, as shown in the sample code below, you can use the parameter `element` to specify where the editor is created and then use `width` and `height` to specify its size.
```javascript
element: document.getElementById("imageEditor"),
width: 600,
height: 400,
```
### Can I change the colors of the Editor?
Yes, as shown in the sample code below, the parameters `border` , `topMenuBorder` , `innerBorder` and `background` can be used to specify the style, including the color of the editor.
```javascript
border: '5px solid rgb(0,128,0)',
topMenuBorder: '',
innerBorder: '',
background: "rgb(255, 255, 255)",
```

Complete code is as below.
```javascript
// Customize the editor
var editorSettings = {
/* Show the editor within the DIV 'imageEditor'*/
element: document.getElementById("imageEditor"),
width: 600,
height: 400,
border: "10px solid rgb(0,128,0)",
topMenuBorder: "",
innerBorder: "",
background: "rgb(255, 255, 255)",
promptToSaveChange: true,
buttons: {
titles: {
previous: "Previous Image",
next: "Next Image",
print: "Print Image",
scan: "Scan Documents",
load: "Load Local Images",
rotateleft: "Rotate Left",
rotate: "Rotate",
rotateright: "Rotate Right",
deskew: "Deskew",
crop: "Crop Selected Area",
cut: "Cut Selected Area",
changeimagesize: "Change Image Size",
flip: "Flip Image",
mirror: "Mirror Image",
zoomin: "Zoom In",
originalsize: "Show Original Size",
zoomout: "Zoom Out",
stretch: "Stretch Mode",
fit: "Fit Window",
fitw: "Fit Horizontally",
fith: "Fit Vertically",
hand: "Hand Mode",
rectselect: "Select Mode",
zoom: "Click to Zoom In",
restore: "Restore Original Image",
save: "Save Changes",
close: "Close the Editor",
removeall: "Remove All Images",
removeselected: "Remove All Selected Images",
},
visibility: {
scan: true,
load: true,
print: true,
removeall: true,
removeselected: true,
rotateleft: true,
rotate: true,
rotateright: true,
deskew: true,
crop: true,
cut: true,
changeimagesize: true,
flip: true,
mirror: true,
zoomin: true,
originalsize: true,
zoomout: true,
stretch: true,
fit: true,
fitw: true,
fith: true,
hand: true,
rectselect: true,
zoom: true,
restore: true,
save: true,
close: true,
},
},
dialogText: {
dlgRotateAnyAngle: [
"Angle :",
"Interpolation:",
"Keep size",
" OK ",
"Cancel",
],
dlgChangeImageSize: [
"New Height :",
"New Width :",
"Interpolation method:",
" OK ",
"Cancel",
],
saveChangedImage: [
"You have changed the image, do you want to keep the change(s)?",
" Yes ",
" No ",
],
selectSource: [
"Select Source:",
"Select",
"Cancel",
"There is no source available",
],
},
};
var imageEditor = DWTObject.Viewer.createImageEditor(editorSettings);
imageEditor.show();
```
---
title: How can I change/hide the UI of the progress bar when importing or uploading images?
description: How can I change/hide the UI of the progress bar when importing or uploading images?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/hide-progress-bars.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/hide-progress-bars.md
---
# UI Customization
## How can I change/hide the UI of the progress bar when importing or uploading images?
To change/hide the progress bar shown during the import/upload process, please refer to [this article](/_articles/extended-usage/ui-customization.md#progress-bar){:target="_blank"}.
---
title: Is the UI of the Dynamic Web TWAIN SDK fully customizable? What cannot be customized?
description: Is the UI of the Dynamic Web TWAIN SDK fully customizable? What cannot be customized?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/is-ui-customizable.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/is-ui-customizable.md
---
# UI Customization
## Is the UI of the Dynamic Web TWAIN SDK fully customizable? What cannot be customized?
Most UI is customizable: you can style or replace the viewer, thumbnail viewer, image editor, progress/loading indicators, and the install prompt (via `dynamsoft.webtwain.install.js`, e.g., `Dynamsoft._show_install_dialog`). You can also localize built-in error messages and other labels. What you cannot customize is the native scanner UI itself. See the full guide at [UI Elements and customization](/_articles/extended-usage/ui-customization.md){:target="_blank"}.
---
title: Can I stop the scanner from showing its default popup when there is a paper jam?
description: Can I stop the scanner from showing its default popup when there is a paper jam?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/stop-default-scanner-popup.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/stop-default-scanner-popup.md
---
# UI Customization
## Can I stop the scanner from showing its default popup when there is a paper jam?
Dynamic Web TWAIN cannot prevent showing the popup of the printer UI as the popup comes from the scanner driver. But if you would like, you can catch the error code from the driver and handle it.
---
title: Can I convert a color image to grayscale or black & white?
description: Can I convert a color image to grayscale or black & white?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/convert-color-image-to-grayscale.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/convert-color-image-to-grayscale.md
---
# Image Editing
## Can I convert a color image to grayscale or black & white?
Yes, you can convert the color of an image easily by using the below methods:
- [DWTObject.ConvertToBW()](/_articles/info/api/WebTwain_Edit.md#converttobw){:target="_blank"} // Converts the specified image to a black-and-white image
- [DWTObject.ConvertToGrayScale()](/_articles/info/api/WebTwain_Edit.md#converttograyscale){:target="_blank"} // Converts the specified image to a grayscale image
---
title: How can I remove only the selected images?
description: How can I remove only the selected images?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/remove-selected-images.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/remove-selected-images.md
---
# Image Editing
## How can I remove only the selected images?
- You can remove the selected images by first selecting the images from the buffer by using the command:
[DWTObject.SelectImages([0, 1, 2]);](/_articles/info/api/WebTwain_Buffer.md#selectimages){:target="_blank"} // This command selects the first 3 images from the buffer, you can pass the indices of the images you want to select as the argument to this method.
- As the second step, invoke the remove command to delete the selected images.
[DWTObject.RemoveAllSelectedImages();](/_articles/info/api/WebTwain_Buffer.md#removeallselectedimages){:target="_blank"} // This command will remove all the images that were selected in first step.
---
title: How can I configure all scanned images to conform to a specific size standard (e.g., A4)?
description: How can I configure all scanned images to conform to a specific size standard (e.g., A4)?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/set-page-size.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/set-page-size.md
---
# Image Editing
## How can I configure all scanned images to conform to a specific size standard (e.g., A4)?
Simply, you can use [PageSize](/_articles/info/api/WebTwain_Acquire.md#pagesize){:target="_blank"} to set the page size to be used when acquiring images.
Or you can leverage the negotiation capabilities functionality by following the steps mentioned below.
1. ask for the supported sizes of your device.
```javascript
DWTObject.getCapabilities(
function (result) {
for (var i = 0; i < result.length; i++) {
if (
result[i].capability.value ===
Dynamsoft.DWT.EnumDWT_Cap.ICAP_SUPPORTEDSIZES
)
sizes = result[i].values;
}
console.log(sizes);
},
function (error) {
console.log(error);
}
);
```
2. set the page size to a size standard as needed.
```javascript
DWTObject.setCapabilities(
{
exception: "ignore",
capabilities: [
{
capability: Dynamsoft.DWT.EnumDWT_Cap.ICAP_SUPPORTEDSIZES,
curValue: 1, // 1 means 'A4' in our case
exception: "fail",
},
],
},
function (result) {
console.log(result);
},
function (error) {
console.log(error);
}
);
```
A list of the values of various supported sizes can be found [here](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_capsupportedsizes){:target="_blank"}. You can use the value for the curValue property.
---
title: How can I show the default image editor tool?
description: How can I show the default image editor tool?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/show-default-image-editor.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/show-default-image-editor.md
---
# Image Editing
## How can I show the default image editor tool?
Image editor can be easily integrated by using the code sample provided below.
```javascript
// The below command will use the default settings in which it shows all buttons in toolbar and also takes up entire screen.
var imageEditor = DWTObject.Viewer.createImageEditor();
imageEditor.show();
```
If you are looking to customize the settings of the image editor before integrating it, you can change the properties mentioned on [this link](/_articles/info/api/WebTwain_Viewer.md#createimageeditor){:target="_blank"}.
---
title: Do you support image deskew?
description: Do you support image deskew?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/support-image-deskew.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/support-image-deskew.md
---
# Image Editing
## Do you support image deskew?
Generally, there are two ways to automatically deskew an image.
### Enable the capability of a scanner
> Applicable only to compatible TWAIN scanners
There is a standard TWAIN capability called `ICAP_AUTOMATICDESKEW` which, when enabled, does the deskewing of all scanned images automatically. If your scanner supports this capability, you can enable the functionality through `Dynamic Web TWAIN` using the API [IfAutomaticDeskew](/_articles/info/api/WebTwain_Acquire.md#ifautomaticdeskew){:target="_blank"}
``` javascript
DWTObject.OpenSource();
DWTObject.IfAutomaticDeskew = true;
```
### Use Dynamic Web TWAIN to deskew an image as it is scanned
> The function `deskew()` below is applicable to all platforms. The event [OnPostTransferAsync](/_articles/info/api/WebTwain_Acquire.md#onposttransferasync){:target="_blank"} is only triggered during scanning
``` javascript
function deskew(index) {
DWTObject.GetSkewAngle(
index,
function(angle) {
console.log("skew angle: " + angle);
DWTObject.Rotate(index, angle, true,
function() {
console.log("Successfully deskewed an image!");
},
function(errorCode, errorString) {
console.log(errorString);
}
);
},
function(errorCode, errorString) {
console.log(errorString);
}
);
}
DWTObject.RegisterEvent("OnPostTransferAsync", function(info) {
deskew(DWTObject.ImageIDToIndex(info.imageId));
});
```
---
title: Is there an undo functionality?
description: Is there an undo functionality?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/undo-functionality.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/undo-functionality.md
---
# Image Editing
## Is there an undo functionality?
No, we don't have an undo functionality for editing an image because it may not be easy to achieve step-by-step undo with our SDK. However, we offer a restore changes functionality inside of an image editor before saving any changes that were made. But our advice would be to save the image/images first before editing, and then if you want to revert, you can simply load the previously saved version.
---
title: What image editing operations does the Dynamic Web TWAIN SDK support?
description: What image editing operations does the Dynamic Web TWAIN SDK support?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/what-image-editing-operation-supported.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/what-image-editing-operation-supported.md
---
# Image Editing
## What image editing operations does the Dynamic Web TWAIN SDK support?
Dynamic Web TWAIN offers many image editing features to help give you the result you are looking for. All the image editing operations are explained in details [here](/_articles/general-usage/image-processing/index.md#edit-options){:target="_blank"}.
---
title: How can I change the background color of the image viewer?
description: How can I change the background color of the image viewer?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/change-background-color.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/change-background-color.md
---
# Image Viewer
## How can I change the background color of the image viewer?
You can change the background color of the image viewer according to your requirements and even put an image in the background.
Example: DWTObject.Viewer.background = 'rgb(255, 255, 255)'
Read more on background shorthand CSS.
---
title: How to get the coordinates of the selected area on an image?
description: How to get the coordinates of the selected area on an image?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/coordinates-of-selected-area.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/coordinates-of-selected-area.md
---
# Image Viewer
## How to get the coordinates of the selected area on an image?
You can use the [`pageAreaSelected`](/_articles/info/api/WebTwain_Viewer.md#pageareaselected) event to get the coordinates of the selected area on an image. This event is triggered when the user selects an area (draws a rectangle) or moves a selected area on the current page. (Click the link to view syntax and sample usage)
---
title: How can I create a thumbnail viewer to view images?
description: How can I create a thumbnail viewer to view images?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/create-thumbnail-viewer-to-navigate-images.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/create-thumbnail-viewer-to-navigate-images.md
---
# Image Viewer
## How can I create a thumbnail viewer to view images?
You can create a thumbnail viewer by using the API [createThumbnailViewer()](/_articles/info/api/WebTwain_Viewer.md#createthumbnailviewer){:target="_blank"}. You can either use the default settings or customize the viewer as shown below:
```javascript
// Use default settings
var objThumbnailViewer = DWTObject.Viewer.createThumbnailViewer();
objThumbnailViewer.background = "rgb(0,0,255)";
objThumbnailViewer.show();
// Customize the thumbnail viewer
var thumbnailViewerSettings = {
location: "left",
size: "30%",
columns: 1,
rows: 3,
scrollDirection: "vertical", // 'horizontal'
pageMargin: 10,
background: "rgb(255, 255, 255)",
border: "",
allowKeyboardControl: true,
allowPageDragging: true,
allowResizing: false,
showPageNumber: false,
pageBackground: "transparent",
pageBorder: "1px solid rgb(238, 238, 238)",
hoverBackground: "rgb(239, 246, 253)",
hoverPageBorder: "1px solid rgb(238, 238, 238)",
placeholderBackground: "rgb(251, 236, 136)",
selectedPageBorder: "1px solid rgb(125,162,206)",
selectedPageBackground: "rgb(199, 222, 252)",
};
var thumbnail = DWTObject.Viewer.createThumbnailViewer(thumbnailViewerSettings);
thumbnail.show();
```
---
title: How can I disable drag and drop images in the viewer?
description: How can I disable drag and drop images in the viewer?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/disable-drag-and-drop-in-images.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/disable-drag-and-drop-in-images.md
---
# Image Viewer
## How can I disable drag and drop images in the viewer?
You can leverage the inbuilt API [acceptDrop](/_articles/info/api/WebTwain_Viewer.md#acceptdrop){:target="_blank"} to disable the load functionality of the dropped images in the viewer.
```javascript
DWTObject.Viewer.acceptDrop = false;
```
---
title: How can I insert an image after a selected image in the viewer?
description: How can I insert an image after a selected image in the viewer?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/insert-image-after-selected-image.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/insert-image-after-selected-image.md
---
# Image Viewer
## How can I insert an image after a selected image in the viewer?
By default, when you scan or load images, they are appended to the end of the image array in buffer. However, in some business scenarios, the user may want to insert these new images to a specified index. Unfortunately, Dynamic Web Twain does not provide a native method for that. The following code snippet shows how this functionality can be implemented.
1. Insert when acquiring
```javascript
function acquireToIndex(index) {
DWTObject.IfAppendImage = false;
DWTObject.CurrentImageIndexInBuffer = index;
DWTObject.RegisterEvent("OnPostTransfer", function () {
DWTObject.CurrentImageIndexInBuffer++;
});
DWTObject.RegisterEvent("OnPostAllTransfers", function () {
DWTObject.IfAppendImage = true;
});
DWTObject.AcquireImage();
}
```
2. Insert when loading
```javascript
function loadToIndex(index) {
var oldCount = DWTObject.HowManyImagesInBuffer;
DWTObject.RegisterEvent("OnPostLoad", function () {
var newCount = DWTObject.HowManyImagesInBuffer;
for (var j = 0; j < newCount - oldCount; j++)
DWTObject.MoveImage(oldCount + j, index + j);
});
DWTObject.LoadImageEx("", 5);
}
```
---
title: What mouse click events does the viewer support?
description: What mouse click events does the viewer support?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/mouse-click-events-supported.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/mouse-click-events-supported.md
---
# Image Viewer
## What mouse click events does the viewer support?
Dynamic Web TWAIN Viewer supports several mouse click events like mouseup, mousedown, mousemove, mouseover, mouseout and click. You can find [here](/_articles/info/api/WebTwain_Viewer.md#events){:target="_blank"} a list of all supported events by the viewer.
---
title: Can I print images from the viewer?
description: Can I print images from the viewer?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/print-images-from-viewer.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/print-images-from-viewer.md
---
# Image Viewer
## Can I print images from the viewer?
Yes, you can print the images from the viewer by exporting all image data in the buffer to a new browser window and use the browser's default feature to print images. This can be achieved by using the [Print](/_articles/info/api/WebTwain_IO.md#print){:target="_blank"} API.
Note: The Print API prints all the images on the viewer, you can use [PrintEx](/_articles/info/api/WebTwain_IO.md#printex){:target="_blank"} to print only selected images.
---
title: Can I protect sensitive information of an image from being seen?
description: Can I protect sensitive information of an image from being seen?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/protect-sensitive-information.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/protect-sensitive-information.md
---
# Image Viewer
## Can I protect sensitive information of an image from being seen?
If you need to modify an image by concealing certain areas permanently, you can use the [erase()](/_articles/info/api/WebTwain_Edit.md#erase){:target="_blank"} method. This method is particularly useful when the requirement involves replacing a rectangular region within the image with a solid white block.
On the other hand, if you prefer a customizable and removable layer to temporarily conceal particular content, our newly developed Annotation feature is just what you need. For comprehensive details about this feature, please click on the following link: How can I add annotations to an image and then save/upload it?
---
title: How can I resize the view of image (e.g. zoom in/out an current image)?
description: How can I resize the view of image (e.g. zoom in/out on an image)?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/resize-view-of-image.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/resize-view-of-image.md
---
# Image Viewer
## How can I resize the view of image (e.g. zoom in/out on an image)?
Use the viewer’s `zoom` property to change the zoom factor (enlarge or reduce the current page). See the API reference for details: [zoom](/_articles/info/api/WebTwain_Viewer.md#zoom){:target="_blank"}.
---
title: How can I reorder images in the viewer?
description: How can I reorder images in the viewer?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/resort-images-in-viewer.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/resort-images-in-viewer.md
---
# Image Viewer
## How can I reorder images in the viewer?
You can easily reorder the images in the viewer. You may drag and drop the images in the order you want them to appear. This process will trigger the inbuilt callback event [OnIndexChangeDragDropDone](/_articles/info/api/WebTwain_Buffer.md#onindexchangedragdropdone){:target="_blank"}.
You can also reorder the images by using the method [SwitchImage(index1, index2)](/_articles/info/api/WebTwain_Buffer.md#switchimage){:target="_blank"}.
---
title: How can I show multiple images at a time?
description: How can I show multiple images at a time?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/show-multiple-images.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/show-multiple-images.md
---
# Image Viewer
## How can I show multiple images at a time?
You can use the [setViewMode](/_articles/info/api/WebTwain_Viewer.md#setviewmode){:target="_blank"} API to show multiple images at a time in the viewer.
Example:
```javascript
// display 6 images at a time in 2 columns and 3 rows
DWTObject.Viewer.setViewMode(2, 3);
```

---
title: Can the size of the image viewer auto resize when the browser window size changes?
description: Can the size of the image viewer auto resize when the browser window size changes?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/viewer-size-auto-resize.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/viewer-size-auto-resize.md
---
# Image Viewer
## Can the size of the image viewer auto resize when the browser window size changes?
Scenario
When using Dynamic Web TWAIN in different environments, it may be necessary to change the size of the viewer within the window automatically.
Steps
This can be done in two different ways
1. Set the viewer size when the page is opened based upon the size of the window
2. Change the viewer size when the window size is adjusted based on the new size of the window
For option 1:
You may change the container size based on the window size by setting the following in your javascript file (before any other Dynamsoft-related operations):
```javascript
Dynamsoft.DWT.Containers = [
{
ContainerId: "dwtcontrolContainer",
Width: window.innerWidth,
Height: window.innerHeight,
},
];
```
and in dynamsoft.webtwain.config.js file set:
```javascript
Dynamsoft.DWT.Containers = [];
```
Note: window.innerWidth and window.innerHeight do not work in IE. You can replace it with document.documentElement.clientWidth and document.documentElement.clientHeight.
For option 2:
Write your own function to calculate the Container's width and height according to the browser's size. Then, assign the values to our API's Height & Width. Finally, use the event [resize](/_articles/info/api/WebTwain_Viewer.md#resize){:target="_blank"} to trigger the function.
---
title: Is there any component of the Dynamic Web TWAIN SDK that needs to be installed on end-user machines?
description: Is there any component of the Dynamic Web TWAIN SDK that needs to be installed on end-user machines?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/component-needs-to-be-installed-on-end-user-machine.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/component-needs-to-be-installed-on-end-user-machine.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# Is there any component of the Dynamic Web TWAIN SDK that needs to be installed on end-user machines?
For the [Desktop Service Edition](/_articles/general-usage/initialization.md#desktop-service-edition){:target="_blank"}, end users need the Dynamic Web TWAIN Service installed locally (this was called “Dynamsoft Service” prior to v19.0). They are prompted to install it the first time they open your application.
When you upgrade Dynamic Web TWAIN, plan to reinstall the service on client machines if required. See [Update Dynamic Web TWAIN Service on the Client-side](/_articles/indepth/development/upgrade.md#update-dynamsoft-service-on-the-client-side){:target="_blank"} for details.
If you prefer zero client-side installation, enable Remote Scan. It routes scanning through a host machine’s service, so the browser client installs nothing. Learn how to enable it [here](/_articles/faq/how-to-enable-remote-scan.md){:target="_blank"}.
---
title: What resources of the SDK should be included in my web application?
description: What resources of the SDK should be included in my web application?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/resources-to-be-included-in-SDK.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/resources-to-be-included-in-SDK.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# What resources of the SDK should be included in my web application?
You can include all the files under the Resources folder, but not all are required.
Under the `\addon` folder, you do not need the files for add-ons which are not used by your web application.
Under the `\dist` folder, you can include the installers required per your OS requirements.
Under the `\src` folder, you do not need the wasm files if you are not using camera functionalities.
For more information, please check [Loading the Resource Files](/_articles/general-usage/initialization.md#loading-the-core-js-files){:target="_blank"}.
---
title: I have installed the Dynamic Web TWAIN Service on an end-user machine but still got asked to install it repeatedly. Why?
description: I have installed the Dynamic Web TWAIN Service on an end-user machine but still got asked to install it repeatedly. Why?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/service-prompting-to-install-repeatedly.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/service-prompting-to-install-repeatedly.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# I have installed the Dynamic Web TWAIN Service on an end-user machine but still got asked to install it repeatedly. Why?
#### There are a few possible causes
> [!NOTE]
> "Local network access permission is not granted" is a **newly developing issue**
1. The local network access permission is not granted (required starting Chromium 142).
2. The Dynamic Web TWAIN Service (previously called "Dynamsoft Service") is not installed properly.
3. The Dynamic Web TWAIN Service is installed correctly but not started.
4. The requests sent to the Service are redirected because you are using a proxy server on IE.
5. The service's listening ports are blocked by another software, like anti-virus software.
6. The service is blocked by extensions or plugins you have installed in the browser. (e.g. NoScript, M*Modal Fluency Direct Web Connector)
7. You are accessing an HTTPS site on a Linux machine.
8. You are visiting a public HTTP website with Dynamic Web TWAIN SDK integrated via Chrome v94+ (or any Chromium v94+ based browsers)
9. You have added `Access-Control-Allow-Origin` setting in the `DSConfiguration.ini` file, but the request originates from a different domain and you didn't set [`IfCheckCORS`](/_articles/extended-usage/dynamsoft-service-configuration.md#access-control-allow-origin).
#### The respective fixes are listed below
1. See [Chromium local network access issue](/_articles/faq/chromium-142-local-network-access-issue.md) for details and corrective actions.
2. Check the service's [installation folder](/_articles/extended-usage/dynamsoft-service-configuration.md#installation-folder) and make sure you have [the correct files](/_articles/extended-usage/dynamsoft-service-configuration.md#related-files-and-folders){:target="_blank"}.
3. Check `Local Services` and make sure the Dynamic Web TWAIN Service is listed and Running.
4. On IE, go to `Internet Options` --> `Security` tab, select `Local Intranet`, then click `Sites`, uncheck 'Include all sites that bypass the proxy server'


5. Check your anti-virus software or any other software that can block local ports and make sure the ports 18622, 18623, 18625 and 18626 are not blocked.
6. Disable all the extensions or plugins in the browser, refresh and try again.
7. On your Linux client machine, visit https://127.0.0.1:18626 and https://127.0.0.1:18623 separately in Chrome and FireFox, manually add both certificates to the exception lists.
8. See the solution [here](/_articles/faq/http-insecure-websites-in-chromium-browser.md){:target="_blank"}
9. Set [`IfCheckCORS`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#ifcheckcors) to `true` in `dynamsoft.webtwain.config.js` file.
---
title: How do I upgrade the end-user installation for all end users once I upgrade my project?
description: How do I upgrade the end-user installation for all end users once I upgrade my project?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/upgrade-end-user-installations.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/upgrade-end-user-installations.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# How do I upgrade the end-user installation for all end users once I upgrade my project?
By default once your application with the upgraded version has been deployed, end-users will be prompted to install the newer version of the Dynamic Web TWAIN Service (also called "Dynamsoft Service").
In a controlled environment Dynamic Web TWAIN can be distributed to all clients in one go just like other similar programs. Group Policy is one such technology.
You can install Dynamic Web TWAIN Service silently using the following commands:
- [v19.0+](#19plus)
- [Versions below 19.0](#19min)
- Windows
```javascript
msiexec /i "/path/to/DynamicWebTWAINServiceSetup.msi" /qn
```
- macOS
```javascript
// Install
sudo installer -pkg /path/to/DynamicWebTWAINServiceSetup.pkg -target /Applications
// Stop service
sudo launchctl unload /Library/LaunchAgents/com.dynamsoft.dynamicwebtwainservicex64.plist
// Start service
launchctl load /Library/LaunchAgents/com.dynamsoft.dynamicwebtwainservicex64.plist
```
• Linux
```javascript
sudo dpkg -i /path/to/DynamicWebTWAINServiceSetup.deb
// or
sudo rpm -i path/to/DynamicWebTWAINServiceSetup.rpm
```
- Windows
```javascript
msiexec /i "/path/to/DynamsoftServiceSetup.msi" /qn
```
- macOS
```javascript
// Install
sudo installer -pkg /path/to/DynamsoftServiceSetup.pkg -target /Applications
// Stop service
sudo launchctl unload /Library/LaunchAgents/com.dynamsoft.dynamsoftservicex64.plist
// Start service
launchctl load /Library/LaunchAgents/com.dynamsoft.dynamsoftservicex64.plist
```
• Linux
```javascript
sudo dpkg -i /path/to/DynamsoftServiceSetup.deb
// or
sudo rpm -i path/to/DynamsoftServiceSetup.rpm
```
> Note - If you are upgrading from version 14, end-users may need to uninstall the previous version manually before reinstallation.
---
title: How do I upgrade my project to use the latest version of the Dynamic Web TWAIN SDK?
description: How do I upgrade my project to use the latest version of the Dynamic Web TWAIN SDK?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/upgrade-to-latest-version.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/upgrade-to-latest-version.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# How do I upgrade my project to use the latest version of the Dynamic Web TWAIN SDK?
For the upgrade process, we would recommend trying out the latest version with a trial before requesting the upgrade.
You can download a 30-day free trial here.
Please refer to the upgrade guide and the release notes below to update your application/configuration.
[Dynamic Web TWAIN Development - Upgrade Guide](/_articles/indepth/development/upgrade.md){:target="_blank"}
[Dynamic Web TWAIN Schedule - Stable Release](/_articles/info/schedule/Stable.md){:target="_blank"}
Once you are ready to upgrade, please send an email to sales@dynamsoft.com requesting the upgrade be done.
Please note that once your license is upgraded, the old license will be revoked within 60 days.
---
title: What does the Dynamic Web TWAIN Service do on the end-user machine?
description: What does the Dynamic Web TWAIN Service do on the end-user machine?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/what-does-dynamsoft-service-do-on-end-user-machine.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/what-does-dynamsoft-service-do-on-end-user-machine.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# What does the Dynamic Web TWAIN Service do on the end-user machine?
Dynamic Web TWAIN Service (also called "Dynamsoft Service") is required for the Desktop Service Edition of Dynamic Web TWAIN. It's a background system service that handles the communication between connected physical devices and the browser, as well as image processing, encoding, decoding, etc.
- [v19.0+](#19plus)
- [Versions below 19.0](#19min)
## Three processes
By default, there are three Dynamic Web TWAIN Service processes running which use the same file `DynamicWebTWAINService.exe` but initiated with different arguments:
- The **main process** starts without any argument as follows:
``` cmd
C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service {version number}\DynamicWebTWAINService.exe
```
- Then there is a **monitor process** which is meant to monitor the main process and automatically start it in case it crashes. The monitor process starts like this:
``` cmd
C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service {version number}\DynamicWebTWAINService.exe -asmonitor XXX
```
- The last always-running process is meant to **support the SSL certificate specifically for the Firefox browser**:
``` cmd
C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service {version number}\DynamicWebTWAINService.exe -certCheck XXX
```
> Note: you may find another process named 'Dynamsoft Scanning New Module', which is a scan module. This process will start when you access an application integrated with Dynamic Web TWAIN, and will automatically stop when you close the application.
> * On Windows, the service runs under the Local System account
> * On macOS, the service runs under the current user account
> * On Linux, the service runs under the root account
## Files and folders in the service directory
There are multiple files and folders in the service directory. Taking Windows service (located at `C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service {version number}`) as an example, the content is as follows:
### For the Service
* `\cache\` : Data cached on the disk. Check out [Disk Caching](/_articles/extended-usage/buffer-caching.md#disk-caching){:target="_blank"}.
* `\cert\` : The certificates used for SSL connection. Check out [How to change the certificates](/_articles/faq/change-dynamsoft-service-certificate.md){:target="_blank"}.
* `\dump\` : Dump files in case the service crashes.
* `\log\` : Log files for debugging purposes.
* `\upload\` : Temporary location for image data to be uploaded by the file uploader.
* `DSConfiguration.ini` : Service configuration file.
* `DWASManager_19000318.dll` : The service manager. The name of the file may vary among different versions.
* `DynamicWebTWAINService.exe` : The service.
* `service.ini` : Define service name.
* `user_config.ini` : User configuration file.
* `welcome.htm` : The home page for the service (present when you visit http://127.0.0.1:18625)
### Components
These files are named with their version number. The following uses v19.0 as an example.
* Core scanning module
+ `dwt_19.0.0.0318.dll`
+ `DSSCN2.exe`
+ `DSSCN2x64.exe`
+ `TWAINDSM.dll`
+ `TWAINDSMx64.dll`
* Barcode Reader Addon
+ `\x64\DynamsoftBarcodeReaderx64_9.6.dll`
+ `dbrx64_9.6.2.0318.dll`
* PDF Addon & Imaging features
+ `\x64\DynamsoftCorex64.dll`
+ `\x64\DynamsoftImageProcessingx64.dll`
+ `\x64\ImageProcessx64.dll`
* Webcam Addon
+ `DynamicWebcamx64_15.0.0.0625.dll`
* File Uploader
+ `UploadModule_1.9.0.0318.dll`
### Supporting files
* `favicon.ico` : The favicon.
* `legal.txt` : Legal notice.
* `libcurl.dll` : The file transfer library.
* For OpenSSL
+ `libssl-3-x64.dll`
* `port.lock`
## HTTP Requests and Responses
Dynamic Web TWAIN Service sets up a local HTTP service that accepts requests from JavaScript code running in the browser and performs operations accordingly. The following are a few examples.
> NOTE
>
> These requests are handled by the JavaScript client of the library. Please do not try to make similar requests in your own code without consulting [Dynamsoft Support](/_articles/about/getsupport.md).
#### Perform image removal
- Request
```
https://127.0.0.1:18623/f/RemoveAllImages?753350643
```
- Response in case of success
```json
{
"id": "414778098",
"method": "RemoveAllImages",
"result": [true],
"cmdId": ""
}
```
#### Return an image
- Request
```
https://127.0.0.1:18623/dwt/dwt_16100728/img?id=414778098&index=5&width=585&height=513&ticks=1603162807999
```
- Response in case of success
The image data.
## Three processes
By default, there are three Dynamsoft Service processes running which use the same file `DynamsoftService.exe` but initiated with different arguments:
- The **main process** starts without any argument as follows:
``` cmd
C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64\DynamsoftService.exe
```
- Then there is a **monitor process** which is meant to monitor the main process and automatically start it in case it crashes. The monitor process starts like this:
``` cmd
C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_{version number}\DynamsoftService.exe -asmonitor XXX
```
- The last always-running process is meant to **support the SSL certificate specifically for the Firefox browser**:
``` cmd
C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_{version number}\DynamsoftService.exe -certCheck XXX
```
> Note: you may find another process named 'Dynamsoft Scanning New Module', which is a scan module. This process will start when you access an application integrated with Dynamic Web TWAIN, and will automatically stop when you close the application.
> * On Windows, the service runs under the Local System account
> * On macOS, the service runs under the current user account
> * On Linux, the service runs under the root account
## Files and folders in the service directory
There are multiple files and folders in the service directory. Taking Windows service (located at `C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_16`) as an example, the content is as follows:
### For the Service
* `\cache\` : Data cached on the disk. Check out [Disk Caching](/_articles/extended-usage/buffer-caching.md#disk-caching){:target="_blank"}.
* `\cert\` : The certificates used for SSL connection. Check out [How to change the certificates](/_articles/faq/change-dynamsoft-service-certificate.md){:target="_blank"}.
* `\dump\` : Dump files in case the service crashes.
* `\log\` : Log files for debugging purposes.
* `\upload\` : Temporary location for image data to be uploaded by the file uploader.
* `DSConfiguration.ini` : Service configuration file.
* `DWASManager_16000428.dll` : The service manager. The name of the file may vary among different versions.
* `DynamsoftService.exe` : The service.
* `DynamicSocket.dll` : For socket connections.
* `service.ini` : Define service name.
* `user_config.ini` : User configuration file.
* `welcome.htm` : The home page for the service (present when you visit http://127.0.0.1:18625)
### Components
These files are named with their version number. The following uses v16.1.1 as an example.
* Core scanning module
+ `dwt_16.1.0.0728.dll`
+ `DSSCN2.exe`
+ `DSSCN2x64.exe`
+ `TWAINDSM.dll`
+ `TWAINDSMx64.dll`
* Barcode Reader Addon
+ `\x64\`
+ `\x86\`
+ `dbr_7.4.0.0428.dll`
+ `dbrx64_7.4.0.0428.dll`
* PDF Addon
+ `DynamicPdfCore_11.0.0.0428.dll`
+ `DynamicPdfCorex64_11.0.0.0428.dll`
+ `DynamicPdfR_11.0.0.0428.dll` (for the PDF Rasterizer)
+ `DynamicPdfRx64_11.0.0.0428.dll` (for the PDF Rasterizer)
* Webcam Addon
+ `DynamicWebcam_15.0.0.0625.dll`
+ `DynamicWebcamx64_15.0.0.0625.dll`
* File Uploader
+ `UploadModule_1.6.0.0428.dll`
* Imaging features
+ `DynamicImage.dll`
+ `DynamicImagex64.dll`
### Supporting files
* `favicon.ico` : The favicon.
* `legal.txt` : Legal notice.
* `libcurl.dll` : The file transfer library.
* For OpenSSL
+ `libeay32.dll`
+ `ssleay32.dll`
* `port.lock`
## HTTP Requests and Responses
Dynamsoft Service sets up a local HTTP service that accepts requests from JavaScript code running in the browser and performs operations accordingly. The following are a few examples.
> NOTE
>
> These requests are handled by the JavaScript client of the library. Please do not try to make similar requests in your own code without consulting [Dynamsoft Support](/_articles/about/getsupport.md).
#### Return availability
- Request
```
https://127.0.0.1:18623/fa/VersionInfo?ts=1603161807908
```
- Response in case of success
```json
{
"id": "1",
"method": "VersionInfo",
"result": ["16, 1, 0, 0728", "", "64"],
"cmdId": ""
}
```
#### Perform image removal
- Request
```
https://127.0.0.1:18623/f/RemoveAllImages?753350643
```
- Response in case of success
```json
{
"id": "414778098",
"method": "RemoveAllImages",
"result": [true],
"cmdId": ""
}
```
#### Return an image
- Request
```
https://127.0.0.1:18623/dwt/dwt_16100728/img?id=414778098&index=5&width=585&height=513&ticks=1603162807999
```
- Response in case of success
The image data.
For more information, please refer to [Dynamic Web TWAIN Deployment - Dynamic Web TWAIN Service](/_articles/extended-usage/dynamsoft-service-configuration.md){:target="_blank"}.
---
title: How can I use Dynamic Web TWAIN SDK in a Citrix environment?
description: How can I use Dynamic Web TWAIN in a Citrix environment?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/use-dwt-in-citrix-env.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/use-dwt-in-citrix-env.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# How can I use Dynamic Web TWAIN in a Citrix environment?
If too many end-users access the same scanning application using the same communication port, it can slow down server response and increase wait time.
To optimize user experience within the Citrix environment, Dynamsoft offers **enhanced mode** which distributes end-users among different ports. For more information, please check here: Optimized Document Scanning Within Citrix Remote Desktop
**Note**: enabling enhanced mode requires license key modifications. Please contact our [support team](/_articles/about/getsupport.md) to use enhanced mode functionalities.
To configure the enhanced mode, please follow the steps below:
- [v19.0+](#19plus)
- [Versions below 19.0](#19min)
1. Stop Dynamic Web TWAIN Service
2. Set EnableEnhancedMode=TRUE in DSConfiguration.ini which is under `C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service {version number}`
3. Set Dynamsoft.DWT.IfCheckDCP=true in dynamsoft.webtwain.config.js
4. Restart Dynamic Web TWAIN Service
***In this case, initializing the DWT object dynamically is not supported.***
How to check if Enhanced mode is running
1. user_config.ini which is under `C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service {version number}` will list the ports that each user is listening on.
2. In Network, the DWT port included in the request URL should be 17000 and so on, not 18622 anymore
1. Stop Dynamsoft Service
2. Set EnableEnhancedMode=TRUE in DSConfiguration.ini which is under `C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_{version number}`
3. Set Dynamsoft.DWT.IfCheckDCP=true in dynamsoft.webtwain.config.js
4. Restart Dynamsoft Service
***In this case, initializing the DWT object dynamically is not supported.***
How to check if Enhanced mode is running
1. user_config.ini which is under `C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_{version number}` will list the ports that each user is listening on.
2. In Network, the DWT port included in the request URL should be 17000 and so on, not 18622 anymore
---
title: Can I generate/load an encrypted file in PDF format?
description: Can I generate/load an encrypted file in PDF format?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/encrypt-pdf-files.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/encrypt-pdf-files.md
---
# Security
## Can I generate/load an encrypted file in PDF format?
Yes. In v18.5, Dynamic Web TWAIN supports the function of [`encrypting the generated PDF files`](/_articles/extended-usage/pdf-processing.md#pdf-save-settings).
Moreover, loading password-protected PDFs has been supported by utilizing the [`ReaderOptions`](/_articles/info/api/interfaces.md#readeroptions) interface along with the [`SetReaderOptions()`](/_articles/info/api/Addon_PDF.md#setreaderoptions) method.
---
title: Why is my scanner not shown or not responding in the browser?
description: Why is my scanner not shown or not responding in the browser?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/scanner-not-shown-or-not-responding-in-the-browser.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/scanner-not-shown-or-not-responding-in-the-browser.md
---
# Capture/Image Source
## Why is my scanner not shown or not responding in the browser?
### Symptom
Sometimes when you are using a scanning page built with Dynamic Web TWAIN, you will encounter an issue where your scanner is not shown, not responding or shown as busy in the browser.
### Causes
1. The scanner is not connected to the machine or the scanner driver is not installed.
Especially when you are using **64-bit Internet Explorer** but you don't have the 64-bit scanner (TWAIN) driver installed on the machine.
2. The Browser doesn't have enough permission to access the scanner driver.
This mostly happens on **Windows 7/Vista/2008 OS** where high security level is applied to **Internet Explorer**. It would also happen in Firefox 4+ and Safari.
### Solution
1. Make sure the driver of the scanner is installed and the scanner is running and properly connected to the machine. You should be able to see the scanner in the Windows' Scanners and Cameras Wizard. And you can use Twacker to check if the driver is TWAIN compatible.
In addition, if you are using 64-bit Internet Explorer, please make sure you have a 64-bit TWAIN driver of the scanner installed.
2. **For Firefox, Safari, etc.**, please go to C:\Windows\twain_32 and you should be able to find that your scanner driver has a sub-folder there. In order to show the scanner as an available source, you need to copy the dlls in the sub-folder and paste them to the folder C:\Windows\System32 (or C:\Windows\SysWOW64 on a 64-bit OS).
For Internet Explorer, you can try one of the following tricks:
1. Add the website to the zone of trusted sites.
IE | Tools | Internet Options | Security | Trusted Sites.
2. Turn Protected Mode off.
To turn off the protected mode of IE, you can go to Tools | Internet Options | Security and uncheck "Enable Protected Mode (requires restarting Internet Explorer)" option.
FYI, Protected Mode helps protect users from attack by running an IE process with greatly restricted privileges. It uses the Windows Vista integrity mechanism to run the Internet Explorer process at low integrity.
But with Protected Mode turned on, you may encounter problems when running Dynamic Web TWAIN applications.
3. To temporarily elevate permissions of IE.
Click Start, point to All Programs, right-click IE, and then select Run as Administrator (with Administrator permissions).
---
title: How to use a blank page as a separator?
description: How to use a blank page as a separator?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/use-blank-page-as-a-separator.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/use-blank-page-as-a-separator.md
---
# Document Saving
## How to use a blank page as a separator?
### Scenario
You are scanning in multiple documents with a blank page separating them and would like to save each set of documents separately.
### Solution
In order to do this we will scan in all the sheets, then use [IsBlankImageExpress](/_articles/info/api/WebTwain_Buffer.md#isblankimageexpress){:target="_blank"} to detect whether or not it is blank. If the sheet is blank we will then remove it from the buffer and save the previous set of sheets. In order to accomplish this task we are going to use the event OnPostAllTransfers, which fires after all scans are complete in order to check whether or not any pages are blank.
```javascript
function Dynamsoft_OnReady() {
DWTObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embedded in the div with id 'dwtcontrolContainer'
if (DWTObject) {
DWTObject.IfShowUI = false;
DWTObject.IfAutoDiscardBlankpages = false;
DWTObject.RegisterEvent('OnPostAllTransfers', CheckBlankPage); //Register the OnPostAllTransfers event that will be called after all scanning is complete
}
}
function AcquireImage() {
if (DWTObject) {
DWTObject.SelectSource(function () {
var OnAcquireImageSuccess = function () {
DWTObject.CloseSource();
};
var OnAcquireImageFailure = function (ec, es) {
DWTObject.CloseSource();
alert(es);
};
DWTObject.OpenSource();
DWTObject.IfDisableSourceAfterAcquire = false; // Scanner source will be disabled/closed automatically after the scan.
DWTObject.AcquireImage(OnAcquireImageSuccess, OnAcquireImageFailure);
}, function () {
console.log('SelectSource failed!');
});
}
}
function OnSuccess() {
console.log('successful');
}
function OnFailure(errorCode, errorString) {
alert(errorString);
}
function CheckBlankPage() { //Function for checking a blank page, called when OnPostAllTransfers is triggered
if (DWTObject) { //Ensure there is a DWTObject
var startindex = 0; // Assume it starts from the first page in the buffer.
for (var i = 0; i < DWTObject.HowManyImagesInBuffer; i++) { //Go through each image in the buffer.
if (DWTObject.IsBlankImageExpress(i)) {
DWTObject.RemoveImage(i); // remove the blank page from the buffer.
if (i != 0) {
var imageRecord = [];
i--; //decrement i for the removed image
var selectedCount = i - startindex + 1;
for (var j = 0; j < selectedCount; j++) { //loop to select all images from previous blank to current
imageRecord.push(j + startindex);
}
if (selectedCount > 0) { //save images as long as there are some in the selection
DWTObject.SelectImages(imageRecord);
DWTObject.IfShowFileDialog = true;
DWTObject.SaveSelectedImagesAsMultiPagePDF("C:\\....", OnSuccess, OnFailure); //PLEASE CHANGE THIS FILE PATH (The first parameter)
}
startindex = i + 1; //set the start index for next search 1 higher than current page
}
} else if (i == DWTObject.HowManyImagesInBuffer - 1) { //the last few images are not blank
var selectedCount = i - startindex + 1; // set how many images are selected
var imageRecord = [];
for (var j = 0; j < selectedCount; j++) { //loop to select all images from previous blank to current
imageRecord.push(j + startindex);
}
if (selectedCount > 0) { //save images as long as there are some in the selection
DWTObject.SelectImages(imageRecord);
DWTObject.IfShowFileDialog = true;
DWTObject.SaveSelectedImagesAsMultiPagePDF("C:\\...", OnSuccess, OnFailure); //PLEASE CHANGE THIS FILE PATH (The first parameter)
}
}
}
}
}
```
If your application is having a hard time detecting blank pages(there is some areas around the edge of the blank page with non-blank spots) or you are using coloured pages you may want to use the pages standard deviation instead. You may use the following Snippet instead.
**Using Page Standard Deviation:**
```javascript
function CheckBlankPage(){ //Function for checking a blank page, called when OnPostAllTransfers is triggered
if(DWTObject){//Ensure there is a DWTObject
for(var i = 0; i < DWTObject.HowManyImagesInBuffer;i++){//Go through each image in the buffer.
if(DWTObject.IsBlankImageExpress(i)){}//Make Blank Image run, but do not use the result
if(DWTObject.BlankImageCurrentStdDev < 15.0){//set a standard deviation for the program to use
//......
}
}
}
}
```
---
title: How to resolve Dynamic Web TWAIN SDK issue in Chrome 101?
description: How to resolve Dynamic Web TWAIN issue in Chrome 101?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/private-network-access-in-chrome101.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/private-network-access-in-chrome101.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# Dynamic Web TWAIN issue in Chrome 101
**Latest Update from Google:**
(REF: https://developer.chrome.com/blog/private-network-access-preflight/)
September 27, 2022: Google has stated that the pre-flight changes will not occur sooner than Chrome version 109, which according to Google's release calendar, is scheduled for early 2023.July 7, 2022: Google has updated the timeline for this preflight request feature. The experiment is scheduled again for Chrome 104 and may be released in Chrome 107 at the earliest. Please refer to Google's feature updates here.March 7, 2022: The experiment in Chrome 98 was rolled back due to stability and compatibility issues discovered in the rollout to Chrome stable. These issues will be fixed before the experiment is tried again, no earlier than in Chrome 101. Learn more in the blink-dev@chromium.org Intent to Ship email thread for more details.
### Symptom
In Chrome 101 at the earliest, when visiting a website that has Dynamic Web TWAIN SDK v17.2 or older integrated into the application, you may see the following **error message** in the browser console. For the end users of your website, they may be prompted repeatedly to download and install the Dynamic Web TWAIN Service (also called "Dynamsoft Service").
NOTE that the same issue will also occur in any browser based on **Chromium 101+**, such as Microsoft Edge 101.
```
Access to XMLHttpRequest at 'https://local.dynamsoft.com:****' from origin 'https://yourwebsiteURL' has been blocked by CORS policy:
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Private-Network' header was present in the preflight response
for this private network request targeting the `local` address space.
```
In Chrome 98, you may have already noticed the following **warning/error message** in the browser console, but it is not expected to cause any immediate issues. Per Google's message below, Chrome 101 is expected to be released in April 2022.
```
A site requested a resource from a network that it could only access because of its users' privileged network position.
These requests expose devices and servers to the internet, increasing the risk of a cross-site request forgery (CSRF) attack, and/or information leakage.
To mitigate these risks, Chrome will require non-public subresources to opt-into being accessed with a preflight request and will start blocking them in Chrome 101 (April 2022).
```
### Cause
As a part of the Private Network Access (PNA) specification, Chrome is deprecating direct access to private network endpoints from public websites. In Chrome 101 at the earliest, Chrome will enforce explicit permission from private network endpoints before requests from public websites can be allowed. According to Google, "this will begin only if and when compatibility data indicates that the change is safe enough and we've outreached directly when necessary." More details can be found at https://developer.chrome.com/blog/private-network-access-preflight/.
Dynamic Web TWAIN utilizes a local service named 'Dynamic Web TWAIN Service' to support document scanning from physical scanners. Your web scanning page needs to make requests to localhost or 127.0.0.1 to communicate with the local service. In Chrome 101, the connection from your public website to the private network (i.e. localhost/127.0.0.1) will be blocked.
### Resolution
To avoid this potential issue, you can apply one of the following solutions:
1. [Upgrade](/_articles/indepth/development/upgrade.md){:target="_blank"} Dynamic Web TWAIN SDK to **version 17.2.1** or later
In version 17.2.1, we have made changes to handle preflight requests on our end to resolve the issue. You can test the latest version with our free trial and when you are ready to upgrade, please contact sales@dynamsoft.com to request the upgrade.
Please note that once upgraded, the Dynamic Web TWAIN Service on all client machines also need to be updated. You may consider [installing Dynamic Web TWAIN Service silently](/_articles/faq/can-i-install-dynamsoft-service-silently.md#can-i-install-dynamsoft-service-silently){:target="_blank"}.
2. Disable Private Network Access checks using enterprise policies
If you have administrative control over your users, you can disable Private Network Access checks using either of the following policies:
InsecurePrivateNetworkRequestsAllowedInsecurePrivateNetworkRequestsAllowedForUrls
For more details about managing policies for your users, please refer to Google's help center article.
### If you need more time to implement the solution
Register for Google's deprecation trials to request a time extension so your website will not be affected during the trial period which will last for at least 6 months.
---
title: Dynamic Web TWAIN SDK – Content-Security-Policy violated
description: Dynamic Web TWAIN – Content-Security-Policy violated
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/content-security-policy-violated.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/content-security-policy-violated.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# Dynamic Web TWAIN – Content-Security-Policy violated
If your server has Content-Security-Policy enabled, you might get an error when accessing a web scanning page using Dynamic Web TWAIN.
```
CSP14312: Resource violated directive 'default-src 'self' 'unsafe-inline' 'unsafe-eval'' in Content-Security-Policy: wss://127.0.0.1:8992/. Resource will be blocked.
```
In such cases, you will need to modify your Content-Security-Policy settings to allow the loading of Dynamic Web TWAIN JS files like dynamsoft.webtwain.initiate.js, dynamsoft.webtwain.config.js. etc.
To do so, please set the Content-Security-Policy value on the client or server side to:
```
connect-src 'self' ws://127.0.0.1:18622 wss://127.0.0.1:18623 ws://127.0.0.1:18625 wss://127.0.0.1:18626 http://127.0.0.1:18622 https://127.0.0.1:18623 http://127.0.0.1:18625 https://127.0.0.1:18626
```
More information can be found on https://content-security-policy.com/
---
title: Dynamic Web TWAIN Service installation and uninstallation issue
description: Dynamic Web TWAIN Service installation and uninstallation issue
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/service-installation-issue.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/service-installation-issue.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# Dynamic Web TWAIN Service installation and uninstallation issue
### Symptom
The old version of Dynamic Web TWAIN Service (also called "Dynamsoft Service") cannot be uninstalled successfully through the Control Panel, and the new version of Dynamic Web TWAIN Service cannot be successfully installed by double-clicking, or the following error message appears during installation.

### Cause
The current user account does not match the user account under C:\Users\{account}
In the screenshot below, the current user is owen_thinkpad_t480s, but in 'Command Prompt', the corresponding folder under the C:\Users is ThinkPad.

When installing by double-clicking DynamsoftServiceSetup.msi (from v19.0+, use DynamicWebTWAINServiceSetup.msi) or uninstalling via Control Panel, Dynamic Web TWAIN takes the current user's Temp directory:
C:\Users\owen_thinkpad_t480s\AppData\Local\Temp, because this path can't be found, the installation/uninstallation failed.
### Resolution
Run 'Command Prompt' as administrator, go to C:\WINDOWS\system32, then execute the following line to uninstall it:
``` shell
wmic product where name="Dynamsoft Service" call uninstall /nointeractive
//from v19.0+
wmic product where name="Dynamic Web TWAIN Service" call uninstall /nointeractive
```

and then run the following command to install Dynamic Web TWAIN Service.
``` shell
msiexec /i "/path/to/DynamsoftServiceSetup.msi" /qn
//from v19.0+
msiexec /i "/path/to/DynamicWebTWAINServiceSetup.msi" /qn
```
---
title: Can I use two different websites integrated with two different versions of Dynamic Web TWAIN SDK on the same computer?
description: Can I use two different websites integrated with two different versions of Dynamic Web TWAIN on the same computer?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/service-backward-compatibility.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/service-backward-compatibility.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# Running two different websites integrated with two different versions of Dynamic Web TWAIN on the same computer
Dynamic Web TWAIN has limited backward compatibility between different versions and generally only one version is expected to be used on an end-user's computer.
However, since Dynamic Web TWAIN is a popular document scanning SDK and has been integrated to many web applications all over the world, it is not uncommon that some end users use two different websites (developed by two different vendors) integrated with different versions of Dynamic Web TWAIN on the same computer.
As a result, we have provided the following instructions for backward compatibility for some of the older versions, in order to support running both versions on the same computer.
From 16.x, the latest service within the major version supports all previous versions of the same major version.
> Note: There is a known issue for the 17.2 and 17.2.x services. Please use the 17.3 service if you are using 17.x as your latest service.
### Instructions for setting up cross major version support
1. Install the _older_ version of Dynamic Web TWAIN Service (also called "Dynamsoft Service").
2. Copy the .dll files from `C:\Windows\SysWOW64\Dynamsoft\DynamsoftService64_{version number}\` to a temporary location. For the list of .dll files you are required to copy, please refer to the list below.
3. Install the _newer_ version of the Dynamic Web TWAIN Service.
4. Copy the .dll files from your temporary location into the _new_ Dynamic Web TWAIN Service folder (from v19.0+, the target path is `C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service {version number}`).
### List of required .dll files
- [v19.0+](#19plus)
- [Versions below 19.0](#19min)
**Version 18.x**
```javascript
dwt_18.5.1.0828.dll
DynamicImagex64.dll
DynamicPdfCorex64_11.5.3.0828.dll
DynamicPdfRx64_11.5.3.0828.dll
DWASManager_18500312.dll
DeviceManager_18510828.dll
UploadModule_1.8.5.0828.dll
dbrx64_9.6.1.0312.dll
```
**Version 17.x**
```javascript
dwt_17.3.5.1212.dll
DynamicImagex64.dll
DynamicPdfCorex64_11.4.0.0531.dll
DynamicPdfRx64_11.4.0.0531.dll
DWASManager_17351212.dll
DynamicSocket.dll
libcrypto-1_1-x64.dll
libssl-1_1-x64.dll
UploadModule_1.7.2.1026.dll
dbrx64_8.8.0.0531.dll
x64
```
**Version 16.x**
```javascript
dwt_16.2.6.1212.dll
DynamicImagex64.dll
DynamicPdfCorex64_11.1.0.0112.dll
DynamicPdfRx64_11.1.0.0112.dll
DWASManager_16261212.dll
DynamicSocket.dll
libeay32.dll
ssleay32.dll
UploadModule_1.6.0.0428.dll
dbrx64_7.6.0.0112.dll
x64
```
**Version 15.x**
```javascript
dwt_15.3.4.1212.dll
DynamicImagex64.dll
DynamicPdfCorex64_10.3.3.0924.dll
DynamicPdfRx64_10.3.3.0924.dll
DWASManager_15341212.dll
DynamicSocket.dll
libeay32.dll
ssleay32.dll
UploadModule_1.4.0.0107.dll
dbrx64_7.3.0.0107.dll
x64
```
**Version 17.x**
```javascript
dwt_17.3.0.0531.dll
DynamicPdfCorex64_11.4.0.0531.dll
DynamicPdfRx64_11.4.0.0531.dll
libcrypto-1_1-x64.dll
```
**Version 16.x**
```javascript
dwt_16.2.0.0112.dll
DynamicPdfCorex64_11.1.0.0112.dll
DynamicPdfRx64_11.1.0.0112.dll
```
**Version 15.3.1**
```javascript
dwt_15.3.0.0116.dll
DynamicPdfCorex64_10.3.3.0924.dll
DynamicPdfRx64_10.3.3.0924.dll
```
**Version 15.3**
```javascript
dwt_15.3.0.0107.dll
DynamicPdfCorex64_10.3.3.0924.dll
DynamicPdfRx64_10.3.3.0924.dll
```
**Version 15.2**
```javascript
dwt_15.2.0.0924.dll
DynamicPdfCorex64_10.3.3.0924.dll
DynamicPdfRx64_10.3.3.0924.dll
```
**Version 15.1**
```javascript
dwt_15.1.0.0806.dll
DynamicPdfCorex64_10.3.2.0806.dll
DynamicPdfRx64_10.3.2.0806.dll
```
**Version 15.0**
```javascript
dwt_15.0.0.0625.dll
DynamicPdfCorex64_10.3.1.0124.dll
DynamicPdfRx64_10.3.1.0124.dll
```
---
title: Error Message - The connection from the insecure (HTTP) web page to the local 'Dynamsoft Service' failed
description: Error Message - The connection from the insecure (HTTP) web page to the local 'Dynamsoft Service' failed
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/connection-from-the-insecure-HTTP-to-service-failed.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/connection-from-the-insecure-HTTP-to-service-failed.md
---
# Error Troubleshooting
## Error Message - The connection from the insecure (HTTP) web page to the local 'Dynamsoft Service' failed
### Symptom
On Windows 7 x86, Win7 64 Enterprise (or any older Windows OS), you get an error message that says **"The connection from the insecure (HTTP) web page to the local 'Dynamsoft Service' failed. To fix the issue, please update your website to HTTPS or refer to [this article](/_articles/faq/http-insecure-websites-in-chromium-browser.md){:target="_blank"} for other workarounds"** even if you are accessing a secure (HTTPs) web page.
And refresh the web page does not work.
### Cause
This issue is only limited on Windows 7, likely the cause is due to TLS 1.2 is not enabled on Windows 7 by default (this protocol is enabled by default on Windows 8 and higher versions), which leads to GoDaddy Cert can't be recognized.
### Resolution
There are 2 resolutions to fix this issue.
**Resolution 1:** Install Service Pack 1 for Windows 7 or Windows Server 2008 R2. See more details here.
**Resolution 2:** Update Godaddy Cert
- Click here to download the certs.
- Run `Certmgr.msc` to open Certificate Manager Tool

- Import `godaddy Trusted Root Cert.cer` to Trusted Root Certification Authorities.
- Import `godaddy Intermediate Cert.cer` to Intermediate Certificate Authorities.

---
title: Scanner source is listed on XSane application but not on my web application on Linux machines
description: Scanner source is listed on XSane application but not on my web application on Linux machines
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/source-not-listed-on-linux.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/source-not-listed-on-linux.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# Scanner source is listed on XSane application but not on my web application on Linux machines
### Symptom
On Linux machines, the scanner can be accessed using the XSane application and it can successfully scan. But the scanner does not show on the web application integrated with Dynamic Web TWAIN even after the Dynamic Web TWAIN Service (also called "Dynamsoft Service") is installed.
### Cause
Dynamic Web TWAIN Service is not installed correctly.
### Resolution
- [v19.0+](#19plus)
- [Versions below 19.0](#19min)
Please follow the steps below to reinstall Dynamic Web TWAIN Service:
1. Run the following commands
``` shell
su
usermod -aG wheel XXX ps:XXX is current username
```
2. Restart the terminal under current user
3. Run the following command
``` shell
sudo rpm -i DynamicWebTWAINServiceSetup.rpm
OR
sudo dpkg -i DynamicWebTWAINServiceSetup.deb
```
If the above does not resolve the issue, please follow the troubleshooting steps below.
1. Run the command below and check whether the process (DynamsoftScanningMgr) has started.
``` shell
ps aux | grep dynamsoft
```
2. Does the below command list out the source?
``` shell
bash /opt/dynamsoft/DynamicWebTWAINService/DynamsoftScanning list
```
3. Please check the logs here: /var/log/syslog
Please follow the steps below to reinstall Dynamsoft Service:
1. Run the following commands
``` shell
su
usermod -aG wheel XXX ps:XXX is current username
```
2. Restart the terminal under current user
3. Run the following command
``` shell
sudo rpm -i DynamsoftServiceSetup.rpm
OR
sudo dpkg -i DynamsoftServiceSetup.deb
```
If the above does not resolve the issue, please follow the troubleshooting steps below.
1. Run the command below and check whether the process (DynamsoftScanningMgr) has started.
``` shell
ps aux | grep dynamsoft
```
2. Does the below command list out the source?
``` shell
bash /opt/dynamsoft/DynamsoftService/DynamsoftScanning list
```
3. Please check the logs here: /var/log/syslog
For further support, please email support@dynamsoft.com and include any screenshots and logs collected.
---
title: The scanner's UI or the system's file dialog does not open when scanning
description: The scanner's UI or the system's file dialog does not open when scanning
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/service-is-blocked.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/service-is-blocked.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# The scanner's UI or the system's file dialog does not open when scanning
### Symptom
Dynamic Web TWAIN Service (also called "Dynamsoft Service") is installed successfully, but when attempting to scan or load files, the scanner's UI or the system's file dialog does not open. You may also see the error, "The pipe is being closed."
### Cause
**Cause One**
This can be due to permissions, firewall, or other programs (e.g. anti-virus) blocking connections to the Dynamic Web TWAIN Service.
To determine if Dynamic Web TWAIN Service is blocked by another process, open Task Manager and go to the Details Tab.
Typically, before opening the scan page, you will see three Dynamic Web TWAIN Service processes listed: two under SYSTEM and one under the user account.

When you open the scan page, two new processes are created under the user account.

If these two processes are not under the user account, we can confirm that Dynamic Web TWAIN Service is being blocked by another process.
**Cause Two**
The issue occurs when the allocated memory address exceeds the 32-bit limit. In this situation, it becomes impossible to access resources under the current user's permissions, such as save/load operations. Notably, 32-bit scanning and memory uploads remain unaffected. This issue is present in all versions before 18.2.
### Resolution
#### Resolution for Cause 1
To determine which process is blocking Dynamic Web TWAIN Service, please follow the steps below.
1. Collect [verbose log](/_articles/faq/general-troubleshooting-steps.md#how-to-enable-and-collect-verbose-log){:target="_blank"}
2. Open the file wts.log and search for the string "GetConnectionProcessID" to locate the line:
*GetConnectionProcessID:: connection client 1960 process is xxxxx.*
[xxxxx] indicates the connection process id, which will identify a process in Task Manager. This process should should typically be a browser process.

However, if the identified PID is not a browser process as expected, the PID will typically be the process which is blocking Dynamic Web TWAIN Service.
If you need further assistance, please contact Dynamsoft Support.
#### Resolution for Cause 2
Please contact [Dynamsoft](https://www.dynamsoft.com/contact/) for patched installer.
---
title: Why I cannot hide the loading bar (spinner)?
description: Why I cannot hide the loading bar (spinner)?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/unable-hide-loading-bar.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/unable-hide-loading-bar.md
---
# UI Customization
## Why I cannot hide the loading bar (spinner)?
### Symptom:
In v17.3 of the Dynamic Web TWAIN SDK, you may find the spinner is unable to hide with the method mentioned in this [article](/_articles/extended-usage/ui-customization.md#loading-bar-and-backdrop), it will continue to spin or will never stop.

### Cause:
The event `Dynamsoft.OnWebTwainPreExecuteCallback` is not registered in the **dynamsoft.webtwain.install.js** file in v17.3 so that the `Dynamsoft.DWT.OnWebTwainPreExecute()` will never be called.
### Workaround:
Step 1) In the **dynamsoft.webtwain.install.js** file, add the event behind the function `OnWebTwainPostExecuteCallback`.

````javascript
Dynamsoft.OnWebTwainPreExecuteCallback = function(){
console.log("OnWebTwainPreExecuteCallback")
}
````
Step 2) Follow the step in this [article](/_articles/extended-usage/ui-customization.md#loading-bar-and-backdrop).
*Note: If `Dynamsoft.DWT.AutoLoad` in your code is set to false, please contact us.*
---
title: How to upload multiple files at a time?
description: How to upload multiple files at a time?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/upload-multiple-files-at-a-time.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/upload-multiple-files-at-a-time.md
---
# Document Saving
## How to upload multiple files at a time?
### Scenario:
After scanning multiple files, you might want to upload them one by one as individual images. Before version 13.1, you have to call the upload method(s) multiple times. From version 13.1+, you can do this in one go.
### Solution:
You can use the methods [ConvertToBlob](/_articles/info/api/WebTwain_IO.md#converttoblob) and [HTTPUpload](/_articles/info/api/WebTwain_IO.md#httpupload) to achieve this.
### Steps:
1. In JS, write code similar to the following:
```javascript
function UploadAsJPG() {
var count = 0;
DWTObject.ClearAllHTTPFormField();
DWTObject.SetHTTPFormField("UploadedImagesCount",DWTObject.HowManyImagesInBuffer);
function asyncFailureFunc(errorCode, errorString) {
alert("ErrorCode: " + errorCode + "\r" + "ErrorString:" + errorString);
};
var onEmptyResponse = function () {
console.log("Uploaded Successfully");
};
var onServerReturnedSomething = function (ecode,estring,resp) {
console(resp);
}
var convertImage = function (_index) {
DWTObject.ConvertToBlob(
[_index],
Dynamsoft.DWT.EnumDWT_ImageType.IT_JPG,
function (result) {
DWTObject.SetHTTPFormField('image_' + _index, result, 'JPG_image_' + _index);
count++;
if (count < DWTObject.HowManyImagesInBuffer) {
convertImage(count);
} else {
DWTObject.HTTPUpload("http://localhost:90/saveUploadedJPG.aspx", onEmptyResponse, onServerReturnedSomething);// Please replace the URL with yours.
}
},
asyncFailureFunc
);
};
convertImage(0);
}
```
2. On the server, add an action page to process the uploaded data, take c# as an example,
```csharp
<%@ Page Language="C#" %>
<%
try
{
String strImageName;
String strInfo = HttpContext.Current.Request["UploadedImagesCount"];
short uploadedImagesCount = Convert.ToInt16(strInfo);
HttpFileCollection files = HttpContext.Current.Request.Files;
for (short i = 0; i < uploadedImagesCount; i++)
{
HttpPostedFile uploadfile = files["image_" + i.ToString()];
strImageName = uploadfile.FileName;
uploadfile.SaveAs(Server.MapPath(".") + "\\UploadedImages\\" + strImageName + ".jpg");
}
}
catch
{
}
%>
```
---
title: Dynamic Web TWAIN SDK FAQs Develop How to Exclude WIA Sources in the Source List
description: Dynamic Web TWAIN SDK Documentation FAQs How to Exclude WIA Sources in the Source List
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/how-to-exclude-wia-sources-in-the-source-list.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/how-to-exclude-wia-sources-in-the-source-list.md
---
# Develop
## How to exclude WIA sources in the source list?
> Applicable to Windows only
There are two ways to achieve this:
* Set [IfUseTwainDSM](/_articles/info/api/WebTwain_Acquire.md#ifusetwaindsm) to `true`
``` javascript
DWTObject.IfUseTwainDSM = true;
```
* Filter sources before listing them
``` javascript
var sources = DWTObject.GetSourceNames();
sources = sources.filter(source => !source.toLowerCase().includes('wia'));
```
If you are still having issues with a device, please feel free to [contact us](https://www.dynamsoft.com/company/contact/) via email, live chat, or phone call.
---
title: Error Message - Source has nothing to capture
description: Error Message - Source has nothing to capture
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/source-has-nothing-to-capture.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/source-has-nothing-to-capture.md
---
# Error Troubleshooting
## Error Message - Source has nothing to capture
### Symptom
On Linux, calling `ErrorCode`/`ErrorString` after a scan could return code 1029 with “Source has nothing to capture,” even though scanning completed successfully.
### Solution
The message was cosmetic only. It was fixed in Dynamic Web TWAIN 18.0. On 18.0 or later, no action is required. If you are on an earlier version and see 1029 despite a successful scan, you can ignore it or upgrade to 18.0+ to remove the message.
---
title: Warning message - Canvas2D Warning
description: Canvas2D Warning
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/chrome-106-107-warning.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/chrome-106-107-warning.md
---
# Error Troubleshooting
## Warning message - Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true.
> Archived: This warning was fixed in Dynamic Web TWAIN 18.0. The steps below are only for projects pinned to versions prior to 18.0.
### Symptom
When you are using Chrome 107(developer version) & 106 (official version) or any version above these, you could encounter a warning in console:
```shell
Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently
```
### Cause
Based on Google developer guide, the setting for attribute `willReadFrequently` in `getContext("2d")` has to be `true` if you are using Chrome 107(developer version) & 106 (official version) or higher, otherwise it will show this warning message.
### Solution
Step 1. Navigate to '../Resources/dynamsoft.webtwain.initiate.js' replace all `getContext("2d")` to `getContext("2d",{willReadFrequently:true})`
Step 2. Navigate to '../Resources/src/dynamsoft.viewer.js' replace all `getContext("2d")` to `getContext("2d",{willReadFrequently:true})`
### Status
Fixed in Dynamic Web TWAIN 18.0+. No action is needed on supported versions.
---
title: Error Message - Uncaught TypeError - Cannot read properties of null (reading 'appendChild') or Failed to execute 'appendChild' on 'Node' - parameter 1 is not of type 'Node'.
description: Error Message - Uncaught TypeError - Cannot read properties of null (reading 'appendChild') or Failed to execute 'appendChild' on 'Node'- parameter 1 is not of type 'Node'.
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/type-error-appendchild.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/type-error-appendchild.md
---
# Error Troubleshooting
## Error Message - Uncaught TypeError: Cannot read properties of null (reading 'appendChild') or Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
### Symptom:
You may see the following errors when you open your application. These errors may be sporadic or may halt your application.
- **Uncaught TypeError: Cannot read properties of null (reading 'appendChild')**
- **Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'**
### Cause:
Typically, an application uses `DWTObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer')` to create the object at the target container. There are certain conditions where Dynamic Web TWAIN's initialization process will complete, but after initialization, the target container is not defined or remains null. You will then see the error when trying to upload your files.
### Workaround:
Please check if your container is created dynamically (especially if you are using dynamic frameworks). There are two ways to address the issue.
(1) If you want to use dynamic initialization method, here is sample code to create the object dynamically:
```javascript
Dynamsoft.DWT.CreateDWTObjectEx(
{
WebTwainId: 'myDWT'
},
function(obj) {
DWTObject = obj;
DWTObject.Viewer.bind(document.getElementById('dwtcontrolContainer'));
DWTObject.Viewer.height = 400;
DWTObject.Viewer.width = 600;
DWTObject.Viewer.show();
},
function(err) {
console.log(err);
}
);
```
(2) If you want to use default initialization method, please set `Dynamsoft.DWT.AutoLoad` to `false` and manually implement `Dynamsoft.DWT.Load()` after you confirm the container has been created.
---
title: Error message - User cancelled the operation
description: Error message - User cancelled the operation
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/error-message-user-cancelled-the-operation.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/error-message-user-cancelled-the-operation.md
---
# Error Troubleshooting
## Error message - User cancelled the operation
### Symptom
You may encounter the error "user cancelled the operation" after successfully scanning all pages. But you can still run the application normally.
### Cause
1) The user manually terminated the ongoing operation.
2) This is known to happen if you use a **WIA/WIATWAIN** driver instead of TWAIN driver. Our SDK is developed based upon the TWAIN protocol, therefore the performance in WIA driver cannot be guaranteed.
### Resolution
(For versions prior to v18.2) To prevent any issues related to the WIA driver, we recommend using the TWAIN driver provided by the manufacturer.
(For v18.2 and above) To mitigate potential problems with the WIATWAIN driver, we suggest using either the TWAIN driver from the manufacturer or the WIA driver, which is officially supported starting from version v18.2.
---
title: The loading bar keeps spinning when capture the image with iPhone.
description: The loading bar keeps spinning when capture the image with iPhone.
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/the-loading-bar-keeps-spinning-when-capture-the-image-with-iphone.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/the-loading-bar-keeps-spinning-when-capture-the-image-with-iphone.md
---
# Error Troubleshooting
## The loading bar keeps spinning when capturing images with iPhone.
### Symptom
iOS 16.4 was released on March 27th, 2023. In this version, all browsers on iOS have begun to support `OffscreenCanvas`. Unfortunately, Apple's implementation of the API is still incomplete and is missing an important feature: "webgl context". Please see the MDN docs on [OffscreenCanvas](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas) for more details.
### Cause
`OffscreenCanvas` is utilized in all versions of the Dynamic Web TWAIN Mobile Web Capture Edition. After you upgrade your iOS to v16.4, the loading bar will keep spinning when you try to capture an image. Note that the Service Edition is not affected by this issue.
### Resolution
Add the following lines of code to disable the API.
```javascript
if (Dynamsoft.navInfoSync.biPhone || Dynamsoft.navInfoSync.biPad) {
window.OffscreenCanvas = null
}
```
**Or** download the patch version:
- For NPM project, please upgrade your dwt package to `v17.3.4` or `v18.0.2`.
- For Non-NPM application, please download the new camera.js file below and replace the old file with new one under `Resource/addon` directory.
- [v17.3 camera.js file](https://tst.dynamsoft.com/public/DWT_FIX/v17.3/OffscreenCanvas/dynamsoft.webtwain.addon.camera.zip)
- [v18.0 camera.js file](https://tst.dynamsoft.com/public/DWT_FIX/v18.0/OffscreenCanvas/dynamsoft.webtwain.addon.camera.zip)
> If the resolution doesn't work for you, please [contact us](https://www.dynamsoft.com/company/contact/).
---
title: How can I support WIA scanner drivers in my application?
description: How can I support WIA scanner drivers in my application?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/support-wia-scanner-drivers.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/support-wia-scanner-drivers.md
---
# Capture/Image Source
## How can I support WIA scanner drivers in my application?
Prior to Dynamic Web TWAIN version 18.2, WIA drivers are not supported and TWAIN drivers are recommended. Please refer to [this article](/_articles/faq/difference-between-Twain-and-wia.md){:target="_blank"} for the differences between WIA and TWAIN drivers.
As of Dynamic Web TWAIN version 18.2, we officially support WIA 2.0. By comparison, `WIA` can only control a very limited set of general capabilities of the device, while `TWAIN` can control all standard and even custom capabilities of the device. In addition, `WIA` has only two transfer modes (Memory, File), while `TWAIN` has three (Native, Memory, File).
Since Dynamic Web TWAIN v18.0, we introduced a new set of scanner related APIs.
To compatible with both TWAIN and WIA 2.0,
- If your application is already using the new set of APIs below, no application change is required.
- If not, replace the old APIs with the matching new APIs.
| New APIs (supports WIA) | Old APIs |
|:-|:-|
| [GetDeviceAsync()](https://www.dynamsoft.com/web-twain/docs/info/api/WebTwain_Acquire.html#getdevicesasync) | [GetSourceNames()](https://www.dynamsoft.com/web-twain/docs/info/api/WebTwain_Acquire.html#getsourcenames), [GetSourceNamesAsync()](https://www.dynamsoft.com/web-twain/docs/info/api/WebTwain_Acquire.html#getsourcenamesasync)|
| [SelectDeviceAsync()](https://www.dynamsoft.com/web-twain/docs/info/api/WebTwain_Acquire.html#selectdeviceasync) | [SelectSourceByIndex()](https://www.dynamsoft.com/web-twain/docs/info/api/WebTwain_Acquire.html#selectsourcebyindex), [SelectSourceByIndexAsync()](https://www.dynamsoft.com/web-twain/docs/info/api/WebTwain_Acquire.html#selectsourcebyindexasync) |
| [SelectSourceAsync()](https://www.dynamsoft.com/web-twain/docs/info/api/WebTwain_Acquire.html#selectsourceasync) | [SelectSource()](https://www.dynamsoft.com/web-twain/docs/info/api/WebTwain_Acquire.html#selectsource) |
| [AcquireImageAsync()](https://www.dynamsoft.com/web-twain/docs/info/api/WebTwain_Acquire.html#acquireimageasync) | [AcquireImage()](https://www.dynamsoft.com/web-twain/docs/info/api/WebTwain_Acquire.html#acquireimage) |
### Example Code
```javascript
DWTObject.GetDevicesAsync(Dynamsoft.DWT.EnumDWT_DeviceType.TWAINSCANNER|Dynamsoft.DWT.EnumDWT_DeviceType.WIASCANNER).then((deviceList)=>{
return DWTObject.SelectDeviceAsync(deviceList[0]) //Select the first device
}).then(()=>{
return DWTObject.AcquireImageAsync({})
}).catch((e)=>{
console.error(e)
})
```
### Difference between the WIASCANNER and WIATWAINSCANNER DeviceType
To support the WIA protocol in v18.2+, we added a new Enumeration `WIASCANNER` to [Dynamsoft.DWT.EnumDWT_DeviceType](https://www.dynamsoft.com/web-twain/docs/info/api/Dynamsoft_Enum.html?ver=latest&&cVer=true#dynamsoftdwtenumdwt_devicetype) . The enumeration named `WIATWAINSCANNER` represents WIA sources mapped through the TWAIN protocol after packaging by Microsoft. It was used in previous versions of Dynamic Web TWAIN and it will continue to be supported.
---
title: Why are my images coming out distorted in MacOS Sonoma?
description: Why are my images coming out distorted in MacOS Sonoma?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/macos-sonoma-distorted-scans.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/macos-sonoma-distorted-scans.md
---
# MacOS Sonoma issue identified
## Symptoms
The user may see distorted, duplicated, or ghost copies of the image when acquiring the scan on MacOS while using Dynamic Web TWAIN 18.4 or below.
## Background
ICA are the drivers that are put out by the manufacturers to specifically work with the [ImageCaptureCore](https://developer.apple.com/documentation/imagecapturecore) specification on the Mac platform. Generally, the ICA drivers are bundled with MacOS and are updated with MacOS updates. Some manufacturers will make ICA drivers available for their scanners through their own support portals.
It has been discovered that with the release of MacOS Sonoma (MacOS 14.0), Dynamic Web TWAIN may behave unexpectedly when acquiring images using ICA drivers. We have investigated and it seems that there was a change in how ICA drivers respond to Dynamic Web TWAIN commands. Based on this information, it would be recommended to avoid upgrading to Sonoma, if possible. However, Dynamsoft understands that many end users will automatically upgrade and therefore adjustments to Dynamic Web TWAIN must be made.
## Solution
1) The recommended solution is to download and install the TWAIN driver from the scanner manufacturer, and use the TWAIN driver.
2) Dynamsoft understands that not all manufacturers provide TWAIN drivers for MacOS. Therefore, Dynamsoft has released Dynamic Web TWAIN 18.4.1 which includes an updated Dynamic Web TWAIN Service (also called "Dynamsoft Service") for MacOS that should help alleviate the issue. Please upgrade to Dynamic Web TWAIN 18.4.1 to utilize this updated Dynamic Web TWAIN Service.
---
title: How do I know which SDK version I am using?
description: How do I know which SDK version I am using?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/find-SDK-version.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/find-SDK-version.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# How do I know which SDK version I am using?
### Introduction
Due to Dynamic Web TWAIN being a long-standing and popular product among enterprises, customers who have integrated Dynamic Web TWAIN may be using various versions. To provide better technical support, customers will need to provide the SDK version number they are using to help support team understand the situation more accurately. This article will outline several methods to assist users in finding the current SDK version they are using.
### Resolution
* Method 1
> If you are not using NPM to manage Dynamic Web TWAIN resources, you can try to find and open the "**dynamsoft.webtwain.config.js**" file in your project. At the very top of the file, you can see the version number noted by Dynamsoft in the comments.

> If you are using NPM to manage Dynamic Web TWAIN resources, you can try to find and open the "**dynamsoft.webtwain.min.js**" file in your project. At the very top of the file, you can see the version number noted by Dynamsoft in the comments.

* Method 2
> For versions 17.0 and above, you can retrieve the current SDK version by running the code "`Dynamsoft.DWT.JSVersion`".
> For versions prior to 17.0, you can obtain the current SDK version by executing the code "`Dynamsoft.WebTwainEnv.JSVersion`"
* Method 3
> Let's take Windows as a example, to find the version of Dynamic Web TWAIN Service (also called "Dynamsoft Service") on Windows, you can follow these steps:
> 1. Open the Control Panel.
> 2. In the Control Panel, click on the "Uninstall a Program" option.
> 3. Look for "Dynamic Web TWAIN Service" in the list of installed programs.
> 4. The version of Dynamic Web TWAIN Service should be displayed in the program list.

If you need further assistance, please contact [Dynamsoft Support](https://www.dynamsoft.com/contact/).
---
title: How to deploy your own upload server with ASP.NET?
description: How to deploy your own upload server with ASP.NET?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/deploy-your-own-upload-server-with-asp.net.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/deploy-your-own-upload-server-with-asp.net.md
---
# Document Saving
## How to Deploy an Upload Server Using ASP.NET
Dynamic Web TWAIN is a client-side JavaScript SDK. However, it does need to interact with the server when performing operations like uploading and downloading. This article introduces how to deploy an upload server using backend ASP.NET code.
Please select your frontend language:
- [Javascript](#Javascript)
- [Angular](#Angular)
- [React-Javascript](#React-Javascript)
- [React-TypeScript](#React-TypeScript)
- [Vue-Javascript](#Vue-Javascript)
- [Vue-Typescript](#Vue-Typescript)
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-JavaScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure your web server supports ASP.NET(C#).
### Steps:
Download the server-side ASP.NET code, unzip it and copy the aforementioned "Upload" directory to the "Sample" directory. Under the "Upload" root folder, there is a file "SaveToFile.aspx". This is the backend page that accepts the uploaded data.
Modify the client-side upload function in {path}\Sample\Scripts\online_demo_operation.js, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
function Upload() {
if (DWTObject && DWTObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
var strUrl = "http://{server-path}/Sample/Upload/SaveToFile.aspx";
var imgAry = [DWTObject.CurrentImageIndexInBuffer];
DWTObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
onUploadSuccess,
onUploadFailure);
} else {
alert("There is no image in buffer.");
}
}
function onUploadSuccess() {
alert("Upload successful");
}
function onUploadFailure(errorCode, errorString, sHttpResponse) {
alert(sHttpResponse.length > 0 ? sHttpResponse : errorString);
}
Copy the "Sample" directory to the IIS website or other web server services.
Navigate to http://{server-path}/Sample/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-Angular.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server supports ASP.NET(C#).
### Steps:
Download the server-side ASP.NET code, unzip it and copy the "Upload" directory to the "Sample\src\public" directory. Under the "Upload" folder, there is a file "SaveToFile.aspx". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\app\components\tools\dwtService.ts, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload(): Promise<any> {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.aspx";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory, which is built, to the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-React-JavaScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server supports ASP.NET(C#).
### Steps:
Download the server-side ASP.NET code, unzip it and copy the "Upload" directory to the "Sample\public" directory. Under the "Upload" folder, there is a file "SaveToFile.aspx". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.js, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload() {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.aspx";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory, which is built, to the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-React-TypeScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server supports ASP.NET(C#).
### Steps:
Download the server-side ASP.NET code, unzip it and copy the "Upload" directory to the "Sample\public" directory. Under the "Upload" folder, there is a file "SaveToFile.aspx". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.ts, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload(): Promise<any> {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.aspx";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory, which is built, to the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-Vue-JavaScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server supports ASP.NET(C#).
### Steps:
Download the server-side ASP.NET code, unzip it and copy the "Upload" directory to the "Sample\public" directory. Under the "Upload" folder, there is a file "SaveToFile.aspx". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.js, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload() {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.aspx";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory, which is built, to the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-Vue-TypeScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server supports ASP.NET(C#).
### Steps:
Download the server-side ASP.NET code, unzip it and copy the "Upload" directory to the "Sample\public" directory. Under the "Upload" folder, there is a file "SaveToFile.aspx". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.ts, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload(): Promise<any> {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.aspx";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory, which is built, to the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
---
title: How to deploy your own upload server with JSP?
description: How to deploy your own upload server with JSP?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/deploy-your-own-upload-server-with-jsp.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/deploy-your-own-upload-server-with-jsp.md
---
# Document Saving
## How to Deploy an Upload Server Using JSP
Dynamic Web TWAIN is a client-side JavaScript SDK. However, it does need to interact with the server when performing operations like uploading and downloading. This article introduces how to deploy an upload server using backend JSP code.
Please select your frontend language:
- [Javascript](#Javascript)
- [Angular](#Angular)
- [React-Javascript](#React-Javascript)
- [React-TypeScript](#React-TypeScript)
- [Vue-Javascript](#Vue-Javascript)
- [Vue-Typescript](#Vue-Typescript)
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-JavaScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure your web server that has the Java Development Kit (JDK) installed and supports Java Server Pages (JSP).
### Steps:
Download the server-side JSP code, unzip it and copy the aforementioned "Upload" directory to the "Sample" directory. Under the "Upload" root folder, there is a file "SaveToFile.jsp". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\Scripts\online_demo_operation.js, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
function Upload() {
if (DWTObject && DWTObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
var strUrl = "http://{server-path}/Sample/Upload/SaveToFile.jsp";
var imgAry = [DWTObject.CurrentImageIndexInBuffer];
DWTObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
onUploadSuccess,
onUploadFailure);
} else {
alert("There is no image in buffer.");
}
}
function onUploadSuccess() {
alert("Upload successful");
}
function onUploadFailure(errorCode, errorString, sHttpResponse) {
alert(sHttpResponse.length > 0 ? sHttpResponse : errorString);
}
Copy the "Sample" directory to the web server.
For example, if you are using Tomcat 10.1.16, copy it to "{Tomcat-installed-path}/webapps".
Restart the web server.
Navigate to http://{server-path}/Sample/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-Angular.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server that has the Java Development Kit (JDK) installed and supports Java Server Pages (JSP).
### Steps:
Download the server-side JSP code, unzip it and copy the "Upload" directory to the "Sample\src\public" directory. Under the "Upload" folder, there is a file "SaveToFile.jsp". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\app\components\tools\dwtService.ts, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload(): Promise<any> {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.jsp";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory to the web server.
For example, if you are using Tomcat 10.1.16, copy it to "{Tomcat-installed-path}/webapps".
Restart the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-React-JavaScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server that has the Java Development Kit (JDK) installed and supports Java Server Pages (JSP).
### Steps:
Download the server-side JSP code, unzip it and copy the "Upload" directory to the "Sample\public" directory. Under the "Upload" folder, there is a file "SaveToFile.jsp". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.js, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload() {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.jsp";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory to the web server.
For example, if you are using Tomcat 10.1.16, copy it to "{Tomcat-installed-path}/webapps".
Restart the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-React-TypeScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server that has the Java Development Kit (JDK) installed and supports Java Server Pages (JSP).
### Steps:
Download the server-side JSP code, unzip it and copy the "Upload" directory to the "Sample\public" directory. Under the "Upload" folder, there is a file "SaveToFile.jsp". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.ts, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload(): Promise<any> {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.jsp";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory to the web server.
For example, if you are using Tomcat 10.1.16, copy it to "{Tomcat-installed-path}/webapps".
Restart the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-Vue-JavaScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server that has the Java Development Kit (JDK) installed and supports Java Server Pages (JSP).
### Steps:
Download the server-side JSP code, unzip it and copy the "Upload" directory to the "Sample\public" directory. Under the "Upload" folder, there is a file "SaveToFile.jsp". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.js, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload() {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.jsp";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory to the web server.
For example, if you are using Tomcat 10.1.16, copy it to "{Tomcat-installed-path}/webapps".
Restart the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-Vue-TypeScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server that has the Java Development Kit (JDK) installed and supports Java Server Pages (JSP).
### Steps:
Download the server-side JSP code, unzip it and copy the "Upload" directory to the "Sample\public" directory. Under the "Upload" folder, there is a file "SaveToFile.jsp". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.ts, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload(): Promise<any> {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.jsp";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory to the web server.
For example, if you are using Tomcat 10.1.16, copy it to "{Tomcat-installed-path}/webapps".
Restart the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
---
title: How to deploy your own upload server with Node.js?
description: How to deploy your own upload server with Node.js?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/deploy-your-own-upload-server-with-node.js.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/deploy-your-own-upload-server-with-node.js.md
---
# Document Saving
## How to Deploy an Upload Server Using Node.js
Dynamic Web TWAIN is a client-side JavaScript SDK. However, it does need to interact with the server when performing operations like uploading and downloading. This article introduces how to deploy an upload server using backend Node.js code.
Please select your frontend language:
- [Javascript](#Javascript)
- [Angular](#Angular)
- [React-Javascript](#React-Javascript)
- [React-TypeScript](#React-TypeScript)
- [Vue-Javascript](#Vue-Javascript)
- [Vue-Typescript](#Vue-Typescript)
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-JavaScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
### Steps:
Download the server-side Node.js code, unzip it. Under the "Upload" folder, there is a file "server.js". This is the backend page that accepts the uploaded data.
Run the server-side project
Open your terminal or Command Prompt and execute the following three commands to start the project:
1). Navigate to the server-side Sample directory:
cd [path]/Upload
2). Install the dependencies:
npm install
3). Run the application:
npm start
Modify the client-side upload function
In {path}\Sample\Scripts\online_demo_operation.js, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
function Upload() {
if (DWTObject && DWTObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
var strUrl = "http://localhost:2020/Upload";
var imgAry = [DWTObject.CurrentImageIndexInBuffer];
DWTObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
onUploadSuccess,
onUploadFailure);
} else {
alert("There is no image in buffer.");
}
}
function onUploadSuccess() {
alert("Upload successful");
}
function onUploadFailure(errorCode, errorString, sHttpResponse) {
alert(sHttpResponse.length > 0 ? sHttpResponse : errorString);
}
Copy the "Sample" directory to the web server.
Navigate to http://{server-path}/Sample/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-Angular.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
### Steps:
Download the server-side Node.js code, unzip it. Under the "Upload" folder, there is a file "server.js". This is the backend page that accepts the uploaded data.
Run the server-side project
Open your terminal or Command Prompt and execute the following three commands to start the project:
1). Navigate to the server-side Sample directory:
cd [path]/Upload
2). Install the dependencies:
npm install
3). Run the application:
npm start
Modify the client-side upload function
In {path}\Sample\src\app\components\tools\dwtService.ts, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload(): Promise<any> {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://localhost:2020/Upload";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Run the client-side project
Open your terminal or Command Prompt and execute the following three commands to start the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Run the application:
npm start
Navigate to http://localhost:4200 in your browser to launch the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-React-JavaScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
### Steps:
Download the server-side Node.js code, unzip it. Under the "Upload" folder, there is a file "server.js". This is the backend page that accepts the uploaded data.
Run the server-side project
Open your terminal or Command Prompt and execute the following three commands to start the project:
1). Navigate to the server-side Sample directory:
cd [path]/Upload
2). Install the dependencies:
npm install
3). Run the application:
npm start
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.js, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload() {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://localhost:2020/Upload";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Run the client-side project
Open your terminal or Command Prompt and execute the following three commands to start the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Run the application:
npm start
Navigate to http://localhost:4200 in your browser to launch the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-React-TypeScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
### Steps:
Download the server-side Node.js code, unzip it. Under the "Upload" folder, there is a file "server.js". This is the backend page that accepts the uploaded data.
Run the server-side project
Open your terminal or Command Prompt and execute the following three commands to start the project:
1). Navigate to the server-side Sample directory:
cd [path]/Upload
2). Install the dependencies:
npm install
3). Run the application:
npm start
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.ts, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload(): Promise<any> {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://localhost:2020/Upload";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Run the client-side project
Open your terminal or Command Prompt and execute the following three commands to start the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Run the application:
npm start
Navigate to http://localhost:4200 in your browser to launch the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-Vue-JavaScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
### Steps:
Download the server-side Node.js code, unzip it. Under the "Upload" folder, there is a file "server.js". This is the backend page that accepts the uploaded data.
Run the server-side project
Open your terminal or Command Prompt and execute the following three commands to start the project:
1). Navigate to the server-side Sample directory:
cd [path]/Upload
2). Install the dependencies:
npm install
3). Run the application:
npm start
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.js, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload() {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://localhost:2020/Upload";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Run the client-side project
Open your terminal or Command Prompt and execute the following three commands to start the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Run the application:
npm start
Navigate to http://localhost:4200 in your browser to launch the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-Vue-TypeScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
### Steps:
Download the server-side Node.js code, unzip it. Under the "Upload" folder, there is a file "server.js". This is the backend page that accepts the uploaded data.
Run the server-side project
Open your terminal or Command Prompt and execute the following three commands to start the project:
1). Navigate to the server-side Sample directory:
cd [path]/Upload
2). Install the dependencies:
npm install
3). Run the application:
npm start
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.ts, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload(): Promise<any> {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://localhost:2020/Upload";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Run the client-side project
Open your terminal or Command Prompt and execute the following three commands to start the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Run the application:
npm start
Navigate to http://localhost:4200 in your browser to launch the sample.
---
title: How to deploy your own upload server with PHP?
description: How to deploy your own upload server with PHP?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/deploy-your-own-upload-server-with-php.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/deploy-your-own-upload-server-with-php.md
---
# Document Saving
## How to Deploy an Upload Server Using PHP
Dynamic Web TWAIN is a client-side JavaScript SDK. However, it does need to interact with the server when performing operations like uploading and downloading. This article introduces how to deploy an upload server using backend PHP code.
Please select your frontend language:
- [Javascript](#Javascript)
- [Angular](#Angular)
- [React-Javascript](#React-Javascript)
- [React-TypeScript](#React-TypeScript)
- [Vue-Javascript](#Vue-Javascript)
- [Vue-Typescript](#Vue-Typescript)
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-JavaScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure your web server supports PHP.
### Steps:
Download the server-side PHP code, unzip it and copy the aforementioned "Upload" directory to the "Sample" directory. Under the "Upload" root folder, there is a file "SaveToFile.php". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\Scripts\online_demo_operation.js, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
function Upload() {
if (DWTObject && DWTObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
var strUrl = "http://{server-path}/Sample/Upload/SaveToFile.php";
var imgAry = [DWTObject.CurrentImageIndexInBuffer];
DWTObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
onUploadSuccess,
onUploadFailure);
} else {
alert("There is no image in buffer.");
}
}
function onUploadSuccess() {
alert("Upload successful");
}
function onUploadFailure(errorCode, errorString, sHttpResponse) {
alert(sHttpResponse.length > 0 ? sHttpResponse : errorString);
}
Copy the "Sample" directory to the web server.
Navigate to http://{server-path}/Sample/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-Angular.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server supports PHP.
### Steps:
Download the server-side PHP code, unzip it and copy the "Upload" directory to the "Sample\src\public" directory. Under the "Upload" folder, there is a file "SaveToFile.php". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\app\components\tools\dwtService.ts, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload(): Promise<any> {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.php";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory to the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-React-JavaScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server supports PHP.
### Steps:
Download the server-side PHP code, unzip it and copy the "Upload" directory to the "Sample\public" directory. Under the "Upload" folder, there is a file "SaveToFile.php". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.js, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload() {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.php";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory to the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-React-TypeScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server supports PHP.
### Steps:
Download the server-side PHP code, unzip it and copy the "Upload" directory to the "Sample\public" directory. Under the "Upload" folder, there is a file "SaveToFile.php". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.ts, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload(): Promise<any> {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.php";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory to the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-Vue-JavaScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server supports PHP.
### Steps:
Download the server-side PHP code, unzip it and copy the "Upload" directory to the "Sample\public" directory. Under the "Upload" folder, there is a file "SaveToFile.php". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.js, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload() {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.php";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory to the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
This article assumes that you have downloaded and unzipped this sample: DynamicWebTWAIN-Vue-TypeScript.zip. After unzipping it, the directory structure is shown in the image below.

Note: The "Sample" directory mentioned in the steps below refers to the "Sample" directory shown in the image.
### Prerequisite:
Please ensure that Node.js is installed. The recommended version is v20.13.1.
Please ensure your web server supports PHP.
### Steps:
Download the server-side PHP code, unzip it and copy the "Upload" directory to the "Sample\public" directory. Under the "Upload" folder, there is a file "SaveToFile.php". This is the backend page that accepts the uploaded data.
Modify the client-side upload function
In {path}\Sample\src\components\tools\dwtService.ts, modify the "URL" parameter of HTTPUpload() to match the actual path of the upload server you deployed. The "URL" parameter accepts both absolute and relative paths.
Refer to the following code snippet:
Upload(): Promise<any> {
return new Promise((res, rej) => {
if (this._dwtObject && this._dwtObject.HowManyImagesInBuffer > 0) {
//Path to the server-side script. You can adjust it according to the actual path of the upload server you deployed.
let strUrl = "http://{server-path}/dist/Upload/SaveToFile.php";
let imgAry = [this._dwtObject.CurrentImageIndexInBuffer];
this._dwtObject.HTTPUpload(
strUrl,
imgAry,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
"WebTWAINImage.png",
()=>{
res();
}, (errCode, errString, responseStr) => {
rej({
code: errCode,
message: errString
});
});
} else {
rej({
code: -1,
message: "There is no image in buffer."
});
}
}
}
Build the client-side project
Open your terminal or Command Prompt and execute the following three commands to build the project:
1). Navigate to the Sample directory:
cd [path]/Sample
2). Install the dependencies:
npm install
3). Build the project:
npm run build
Copy the "Sample/dist" directory to the web server.
Navigate to http://{server-path}/dist/index.html in your browser to access the sample.
---
title: Dynamic Web TWAIN with Annotations
description: Dynamic Web TWAIN with Annotations – Hello World
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/dwt-with-annotation.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/dwt-with-annotation.md
---
# Dynamic Web TWAIN with Annotations – Hello World
Dynamsoft's **Dynamic Web TWAIN (DWT)** is a software development kit (SDK) designed to integrate efficient document scanning workflows into web applications. **Dynamsoft Document Viewer (DDV)** is a versatile web document viewer with support for document annotations. In this guide, we explain how to **use DDV in place of DWT's built-in viewer** to enable **annotations** and provide a superior viewer experience.
In this sample, we create a **headless** DWT instance to scan images, and then pass the result to DDV to view, edit, annotate, etc. We then use DWT to save the result - **along with any edits and annotations** - to a file, or upload to the server.

- Check out [HelloWorld](https://demo.dynamsoft.com/Samples/dwt/web-twian-document-viewer/index.html) online
## 1. Add Dependencies
Use the SDK by including the packages below:
- Dynamic Web TWAIN: provides scanning, saving, and uploading functionalities.
- Dynamsoft Document Viewer: provides improved document viewer and annotation functionalities.
### 1.1 Deliver Dependencies via CDN
Deliver the SDK dependencies with either the [jsDelivr](https://jsdelivr.com/) or the [UNPKG](https://unpkg.com/) CDN.
- jsDelivr
```html
```
- UNPKG
```html
```
## 2. Define HTML Elements
Define the following elements:
- A container to hold the viewer
```html
```
- Buttons to invoke functions
```html
```
## 3. Initialize the SDK
### 3.1 Initialize Dynamsoft Document Viewer
```javascript
// Dynamsoft Document Viewer
// Public trial license which is valid for 24 hours
// You can request a 30-day trial key from https://www.dynamsoft.com/customer/license/trialLicense/?product=dwtddv
Dynamsoft.DDV.Core.license = "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9";
Dynamsoft.DDV.Core.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@3.0.0/dist/engine";
await Dynamsoft.DDV.Core.init();
```
### 3.2 Create the Edit Viewer
```javascript
// Create a Dynamsoft Document Viewer Edit Viewer to display and edit documents scanned with Dynamic Web TWAIN
let editViewer;
editViewer = new Dynamsoft.DDV.EditViewer({
container: "container",
});
// Create a Dynamsoft Document Viewer document to contain and display images scanned by Dynamic Web TWAIN
let ddvDoc;
ddvDoc = Dynamsoft.DDV.documentManager.createDocument({
name: "ddvtestDoc"
});
// Open the document
editViewer.openDocument(ddvDoc.uid);
```
Links to related documentation:
- [`How to configure image filter`](https://www.dynamsoft.com/document-viewer/docs/features/advanced/imagefilter.html)
- [`Edit Viewer`](https://www.dynamsoft.com/document-viewer/docs/features/viewers/editviewer.html)
- [`How to configure your desired uiconfig`](https://www.dynamsoft.com/document-viewer/docs/ui/customize/index.html)
API Reference
- Dynamsoft Document Viewer:
- [`Dynamsoft.DDV.EditViewer`](https://www.dynamsoft.com/document-viewer/docs/api/class/editviewer.html#editviewer)
- [`createDocument()`](https://www.dynamsoft.com/document-viewer/docs/api/class/documentmanager.html#createdocument)
- [`openDocument()`](https://www.dynamsoft.com/document-viewer/docs/api/class/editviewer.html#opendocument)
### 3.3 Create a Viewerless Dynamic Web TWAIN Instance
Reference a CDN like `jsDelivr` to fetch most resources using `Dynamsoft.DWT.ResourcesPath`. Notably these resources exclude DWT Service installers, which exceed the `jsDelivr` CDN per-file size limit. You have a few options to set this path with `Dynamsoft.DWT.ServiceInstallerLocation`:
1. [Install the DWT SDK](https://www.dynamsoft.com/web-twain/downloads/), extract the DWT service installers (under path like `C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN SDK 19.2\Resources\dist`), then self-host the DWT Service installers with `Dynamsoft.DWT.ServiceInstallerLocation = "https://example.com/DWT/Resources/dist"`.
2. Use a different CDN with a higher per-file size limit by referencing the location with `Dynamsoft.DWT.ServiceInstallerLocation = "https://unpkg.com/dwt@19.4.1/dist/dist"`.
```javascript
// Create Dynamic Web TWAIN object
// Public trial license which is valid for 24 hours
// You can request a 30-day trial key from https://www.dynamsoft.com/customer/license/trialLicense/?product=dwtddv
Dynamsoft.DWT.ProductKey = "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9";
Dynamsoft.DWT.UseDefaultViewer = false;
Dynamsoft.DWT.ResourcesPath = "https://cdn.jsdelivr.net/npm/dwt@19.4.1/dist";
// Do not forget to set your installer path
Dynamsoft.DWT.ServiceInstallerLocation = "YOUR_INSTALLER_PATH_HERE";
let DWObject;
// Create a Dynamic Web TWAIN instance without the built-in viewer
Dynamsoft.DWT.CreateDWTObjectEx({
WebTwainId: "dwtId",
},function (object) {
DWObject = object;
}, function (error) {
console.log(error);
}
);
```
API Reference
- Dynamic Web TWAIN:
- [`CreateDWTObjectEx()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#createdwtobjectex)
## 4. Use SDK Features
### 4.1 Add Simple Scanning Functionality
Use the Dynamic Web TWAIN instance for scanning. Upon scan completion, import the scanned data into DDV for viewing, editing, and annotating.
#### 4.1.1 Register the `OnPostTransferAsync` Event
```javascript
//Register the OnPostTransferAsync event in the success callback function of CreateDWTObjectEx.
Dynamsoft.DWT.CreateDWTObjectEx({
WebTwainId: "dwtId",
},
function (object) {
DWObject = object;
// Call Dynamsoft_OnPostTransferAsync upon completion of every individual page scan
DWObject.RegisterEvent("OnPostTransferAsync", Dynamsoft_OnPostTransferAsync);
},
function (error) {
console.log(error);
}
);
// Import scanned page into Dynamsoft Document Viewer to display
function Dynamsoft_OnPostTransferAsync(outputInfo){
if(DWObject) {
let index = DWObject.ImageIDToIndex(outputInfo.imageId);
DWObject.ConvertToBlob(
[index],
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
function(blob){
ddvDoc.loadSource(blob);
},
function(ec,es){
console.log(es);
}
);
}
}
```
API Reference
- Dynamic Web TWAIN:
- [`OnPostTransferAsync`](/_articles/info/api/WebTwain_Acquire.md#onposttransferasync)
- [`ImageIDToIndex()`](/_articles/info/api/WebTwain_Buffer.md#imageidtoindex)
- [`ConvertToBlob()`](/_articles/info/api/WebTwain_IO.md#converttoblob)
- Dynamsoft Document Viewer:
- [`loadSource()`](https://www.dynamsoft.com/document-viewer/docs/api/interface/idocument/index.html#loadsource)
#### 4.1.2 Use Dynamic Web TWAIN to Scan from Document Scanners
```javascript
function AcquireImage() {
if (DWObject) {
DWObject.SelectSourceAsync().then(function () {
return DWObject.AcquireImageAsync({
IfCloseSourceAfterAcquire: true
});
}).catch(function (exp) {
alert(exp.message);
});
}
}
```
API Reference
- Dynamic Web TWAIN:
- [`SelectSourceAsync()`](/_articles/info/api/WebTwain_Acquire.md#selectsourceasync)
- [`AcquireImageAsync()`](/_articles/info/api/WebTwain_Acquire.md#acquireimageasync)
### 4.2 Add PDF Saving to Local Functionality
Use `saveToPdf()` from **DDV** to convert the scanned document to a PDF Blob, then use `saveBlob` from **DWT** to export the document to local as a PDF.
```javascript
const pdfSettings = {
saveAnnotation: "annotation"
};
function SavePDF(){
editViewer.currentDocument.saveToPdf(pdfSettings).then(function(blob){
DWObject.IfShowFileDialog = true;
DWObject.saveBlob("WebTWAINImage.pdf", blob).then(function () {
console.log("OK");
}).catch(function (err) {
console.log(err);
});
});
}
```
API Reference
- Dynamic Web TWAIN:
- [`IfShowFileDialog`](/_articles/info/api/WebTwain_IO.md#ifshowfiledialog)
- [`saveBlob()`](/_articles/info/api/WebTwain_IO.md#saveblob)
- Dynamsoft Document Viewer:
- [`saveToPdf()`](https://www.dynamsoft.com/document-viewer/docs/api/interface/idocument/index.html#savetopdf)
### 4.3 Add Server Upload Functionality
Use the `saveToPdf()` API from **DDV** to convert the scanned document to a PDF Blob, then use the `httpUploadBlob()` API from **DWT** to upload the document to the server as a PDF.
```javascript
// Can be discarded if already defined previously
const pdfSettings = {
saveAnnotation: "annotation"
};
function Upload(){
editViewer.currentDocument.saveToPdf(pdfSettings).then(function(blob){
let fileName = "WebTWAINImage.pdf";
DWObject.httpUploadBlob(
"https://demo.dynamsoft.com/sample-uploads/",
blob,
fileName
).then(function () {
console.log("Upload successful.");
}).catch(function (err) {
console.log(err);
});
});
}
```
Links to related documentation:
- [`Uploading Images to the Server`](https://www.dynamsoft.com/web-twain/docs/getstarted/uploading.html)
API Reference
- Dynamic Web TWAIN:
- [`httpUploadBlob()`](/_articles/info/api/WebTwain_IO.md#httpuploadblob)
- Dynamsoft Document Viewer:
- [`saveToPdf()`](https://www.dynamsoft.com/document-viewer/docs/api/interface/idocument/index.html#savetopdf)
## Review the Complete Code
```html
HelloWorld
```
## Run the Web Application

## Further Reading
- [`Use the API to edit images within the control`](https://www.dynamsoft.com/document-viewer/docs/features/viewers/editviewer.html#edit-pages)
- [`Use the API to delete or switch images within the control`](https://www.dynamsoft.com/document-viewer/docs/api/interface/idocument/index.html#members)
---
title: How to debug on Dynamic Web TWAIN online demo?
description: How to debug on Dynamic Web TWAIN online demo?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/debug-on-online-demo.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/debug-on-online-demo.md
---
# Error Troubleshooting
## How to debug on Dynamic Web TWAIN online demo?
With the widespread application of the Dynamic Web TWAIN SDK in the market, more and more developers need an effective way to debug. Dynamsoft provides an official demo that enables developers to verify online whether their scanners and code can function properly. This article introduces how to utilize the browser developer tools to test the code through the Dynamic Web TWAIN online demo.
**Step 1:**
Visit Dynamic Web TWAIN Online Demo: [https://demo.dynamsoft.com/web-twain/](https://demo.dynamsoft.com/web-twain/)
**Step 2:**
Given that the demo is presented via the iframe element, to acquire the WebTwain instance, you need to make the following configurations.

As an alternative, you can straightforwardly call the `top[0].DWTObject`.
**Step 3:**
You've now obtained the WebTwain instance.

And you can test the API as much as you want. Let's take the [ConvertToBase64](https://www.dynamsoft.com/web-twain/docs/info/api/WebTwain_IO.html#converttobase64) as an example. After you input the code into the console and press Enter to run this code snippet, it will convert the image at index 0 in the buffer (that is, the first image) into a Base64 string.

Now that you've had the opportunity to preview how the DWT API operates in the web application, you can explore more features by reviewing the [API documentation]({{site.info}}api/).
---
title: Where can I download the Dynamic Web TWAIN Service installers only?
description: Where can I download the Dynamic Web TWAIN Service installers only?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/download-service-only.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/download-service-only.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# Where can I download the Dynamic Web TWAIN Service installers only?
Typically, we recommend that developers retrieve the Dynamic Web TWAIN Service Installers from the downloaded SDK package. This approach guarantees that the version of the Dynamic Web TWAIN Service installed by the user aligns with the current version of the SDK libraries.
Let's use Windows as an illustration. After installing the SDK package, you can locate all Dynamic Web TWAIN Service installers for various operating systems in the directory "C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN SDK {version number}\Resources\dist".[[Download the SDK](https://www.dynamsoft.com/web-twain/downloads/)]
However, considering that more and more enterprise users are using the Dynamic Web TWAIN SDK, it would be a hassle for end users to obtain the Dynamic Web TWAIN Service installer by downloading the SDK if they are unable to acquire the installers from the developer for some reasons. Therefore, you can use the following trick to download the desired Service installers.
- Download via CDN
- Download via GitHub
**Step 1:**
Visit the CDN site: [https://www.unpkg.com/browse/dwt/dist/dist/](https://www.unpkg.com/browse/dwt/dist/dist/).
**Step 2:**
For Windows users, please choose ".msi" installer
For Mac users, please choose ".pkg" installer
For Linux users, please choose ".rpm" or ".deb" installer accordingly

**Step 3:**
Click on the "View Raw" button, it will start to download the installer.

**Step 1:**
Visit the GitHub site: [https://github.com/Dynamsoft/Dynamic-Web-TWAIN/releases](https://github.com/Dynamsoft/Dynamic-Web-TWAIN/releases).
**Step 2:**
Scroll down to the **Assets** section.
- For Windows, download the **.msi** installer.
- For macOS, download the **.pkg** installer.
- For Linux, download either the **.rpm** or **.deb** installer, depending on your distribution.

> [!IMPORTANT]
> If you don't have **administrator privileges** to install the service, you can use our Personal Installer, which can be installed without admin rights.
---
title: Can I change the resolution/DPI of an image in the viewer?
description: Can I change the resolution/DPI of an image in the viewer?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/change-resolution-of-image.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/change-resolution-of-image.md
---
# Image Editing
## Can I change the resolution/DPI of an image in the viewer?
You can use the [Resolution](/_articles/info/api/WebTwain_Acquire.md#resolution){:target="_blank"} property to check the resolution while acquiring an image. To change the resolution/DPI in the viewer, you can use the following methods:
[DWTObject.SetDPI()](/_articles/info/api/WebTwain_Edit.md#setdpi){:target="_blank"} // Changes the DPI (dots per inch) of the specified image depending on the input resolution parameters
---
title: Can I hide the Dynamsoft image viewer and use my own image viewer?
description: Can I hide the Dynamsoft image viewer and use my own image viewer?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/hide-image-viewer.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/hide-image-viewer.md
---
# Image Viewer
## Can I hide the Dynamsoft image viewer and use my own image viewer?
If you want to use your own viewer, you can use [`Dynamsoft.DWT.CreateDWTObjectEx()`](/_articles/extended-usage/advanced-initialization.md#creating-headless-webtwain-instances) to create a `WebTwain` instance that does not come with a viewer. You can also unbind and destroy the viewer of an existing `WebTwain` instance with the [`unbind()`](/_articles/info/api/WebTwain_Viewer.md#unbind) API.
> Prior to using CreateDWTObjectEx(), please disable the [AutoLoad](/_articles/info/api/Dynamsoft_WebTwainEnv.md#autoload) feature. Additionally, avoid calling any [Load](/_articles/info/api/Dynamsoft_WebTwainEnv.md#load) methods either before or after using CreateDWTObjectEx(). This ensures proper functionality and prevents potential conflicts during the initialization.
---
title: Where is the image viewer object defined?
description: Where is the image viewer object defined?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/image-viewer-object-defined.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/image-viewer-object-defined.md
---
# Image Viewer
## Where is the image viewer object defined?
By default, Dynamic Web TWAIN has a viewer component that helps to view data available in the buffer. When you [create an instance of Web Twain](/_articles/extended-usage/advanced-initialization.md#instantiating-webtwain-without-onwebtwainready){:target="_blank"}, the viewer is created automatically with its default available settings. You can customize the viewer settings according to your requirements and replace the default viewer with your customized viewer settings.
You can refer to this [link](/_articles/general-usage/viewer-configuration.md#create-the-viewer){:target="_blank"} to read in details about the steps to create/modify the viewer.
---
title: Dynamic Web TWAIN prompts the .deb installer for Windows
description: Dynamic Web TWAIN prompts the .deb installer for Windows
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/incorrect-installer-for-windowsARM64.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/incorrect-installer-for-windowsARM64.md
---
# Error Troubleshooting
## Dynamic Web TWAIN prompts the .deb installer for Windows
### Symptom
You may encounter an issue where, on a Windows operating system with ARM64 architecture, you are prompted to download the .deb installer, which is intended for use on Linux operating systems.
### Resolution
The issue was patched in version 17.3.1. We highly recommend upgrading your SDK to version 17.3.1 or higher. Otherwise, you will need to manually install the .MSI installer.
---
title: How can I save selected images instead of all images to my server or database?
description: How can I save selected images instead of all images to my server or database?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/save-selected-images-to-server.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/save-selected-images-to-server.md
---
# Document Saving
## How can I save selected images instead of all images to my server or database?
The API [SelectedImagesIndices](/_articles/info/api/WebTwain_Buffer.md#selectedimagesindices){:target="_blank"} returns the indices of the selected images.
You can pass those indices as a parameter to [HTTPUpload](/_articles/info/api/WebTwain_IO.md#httpupload){:target="_blank"} which uploads files to the server/database.
To upload all images in the buffer with HTTPUpload, you can use the API [SelectAllImages](/_articles/info/api/WebTwain_Buffer.md#selectallimages){:target="_blank"} which returns the indices of all images.
There are other HTTP upload APIs that can achieve the same. Please refer to this link: [Dynamic Web TWAIN API Reference - IO APIs](/_articles/info/api/WebTwain_IO.md#output){:target="_blank"}
---
title: How can I show page number on each image?
description: How can I show page number on each image?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/show-page-number.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/show-page-number.md
---
# Image Viewer
## How can I show page number on each image?
You can set the [showPageNumber](/_articles/info/api/WebTwain_Viewer.md#showpagenumber){:target="_blank"} API to true to show the page number.
```javascript
DWTObject.Viewer.showPageNumber = true;
```
**Note**: When [setViewMode](/_articles/info/api/WebTwain_Viewer.md#setviewmode){:target="_blank"} is set to -1 by -1 or [singlePageMode](/_articles/info/api/WebTwain_Viewer.md#singlepagemode){:target="_blank"} is true then this api will not work.
---
title: Why am I unable to load the TIFF file into Dynamic Web TWAIN?
description: Why am I unable to load the TIFF file into Dynamic Web TWAIN?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/unable-to-load-4-bit-tiff.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/unable-to-load-4-bit-tiff.md
---
# Error Troubleshooting
## Why am I unable to load the TIFF file into Dynamic Web TWAIN?
### Symptom
When you attempt to import a TIFF file using Dynamic Web TWAIN, it will indicate that the file has been successfully loaded, but the image does not appear in the viewer.
### Cause
All versions prior to version 19.0 do not support importing 4-bit color images. If you encounter the issue mentioned above, your file may be using the deprecated JPEG compression standard.
### Resolution
Support for 4-bit TIFF format was added in version 19.1. Therefore, please update to version 19.1 to resolve this issue.
> If the resolution doesn't work for you, please [contact us](https://www.dynamsoft.com/company/contact/).
---
title: How to scan documents on mobile devices?
description: How to scan documents on mobile devices?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/how-to-scan-documents-on-mobile-devices.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/how-to-scan-documents-on-mobile-devices.md
---
# Capture/Image Source
## How to scan documents on mobile devices?
> If you are looking to capture documents using mobile cameras, please see FAQ: [Do you support capturing documents from mobile cameras?](/_articles/faq/support-capture-from-mobile-camera.md)
The Dynamic Web TWAIN has introduced a [Remote Scan](https://www.dynamsoft.com/remote-scan/docs/introduction/) feature starting from version [18.2](/_articles/info/schedule/Stable.md#remote-scan-1). It allows end users to access scanners of various protocols (TWAIN, SANE, ICA, eSCL, WIA) on the Intranet through any devices and any popular browsers, without any extra software installed.
---
title: Error message - Permission was denied for this request to access the unknown address space
description: CORS unknown address space
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/chromium-142-local-network-access-issue.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/chromium-142-local-network-access-issue.md
---
# Error Troubleshooting
> [!IMPORTANT]
> This is an evolving browser behavior. Details in this article may change as Chromium updates Local Network Access.
## Error message - CORS errors caused by local network access permissions in Chromium 142 and later
### Overview
Local Network Access (LNA) is a browser security model that has been enforced in Chromium-based browsers since version 142 (released October 28, 2025), including Chrome, Edge, Brave, and Opera. It blocks web apps from reaching local or loopback targets unless the user explicitly grants permission, which can affect Dynamic Web TWAIN Service behavior.
These restrictions limit requests from **public network locations** to **local or loopback locations** unless the required site permission is granted.
Starting in **Chrome 145**, the site-setting label changed from one local network access permission to two:
- `loopback-network` shown as **Apps on device**
- `local-network` shown as **Local Network**
Dynamic Web TWAIN Service communicates with `localhost` / `127.0.0.1`, so **Apps on device** (`loopback-network`) is the key permission for most deployments.
When your page first requests local access, Chromium will show an LNA permission prompt.
This FAQ and the symptoms below apply when users dismiss this prompt or click **Block**.

### Symptoms
If the initial LNA prompt is dismissed or blocked, you may experience one or more of the following:
#### **1) Browser repeatedly prompts to download the service**
The browser asks the user to download/install the Dynamic Web TWAIN Service even though it is already installed.

#### **2) Initialization succeeds, but scanning / loading returns blank**
Initialization appears successful, but scanned or loaded images are blank.
The browser console (`F12` -> `Console`) may show a CORS denial similar to:
```shell
Access to fetch at 'https://127.0.0.1:18623/fa/VersionInfo?ts=1761893667670'
from origin 'https://your-domain.com' has been blocked by CORS policy:
Permission was denied for this request to access the `unknown` address space.
```
This happens because a page on a public origin (for example, `https://your-domain.com`) is trying to access a loopback address (`127.0.0.1`), which Chromium now treats as a protected local-network request.
---
#### Version-Specific Behavior
Observed behavior depends on Chromium version and Dynamic Web TWAIN (DWT) version:
| Browser Version | DWT Version | Resulting Symptom |
|------------------|-------------|-----------------------------|
| Chromium 142+ | < 18.5.0 | Service Installation Prompt |
| Chromium 142+ | >= 18.5.0, < 19.3 | Blank Images after Scanning |
| Chromium 142+ | >= 19.3 | Permission Prompt |
| Chromium future version blocking WebSocket(*) | Any | Service Installation Prompt |
> [!NOTE]
> (*) Blocking WebSocket requests is on Chromium's roadmap, and may be enforced in a future release.
> Other browsers are also introducing local network permission controls.
### Root Cause
Chromium 142 introduced [Local Network Access (LNA)](https://chromestatus.com/feature/5152728072060928), which restricts requests from public network locations to local/loopback network locations unless permission is granted.
> [!NOTE]
> For background and design rationale, see Chrome's developer blog: [New permission prompt for Local Network Access](https://developer.chrome.com/blog/local-network-access).
Under this model, requests from a public origin (a publicly hosted site) to local or loopback targets (including `localhost` and `127.0.0.1`) can be blocked by default.
Dynamic Web TWAIN relies on a locally installed service that listens on a loopback address. If browser permission is not granted, communication with that local service fails.
### Resolution
> [!WARNING]
> This is driven by browser security policy decisions. Dynamic Web TWAIN cannot bypass these restrictions programmatically.
> Browser behavior will continue evolving, and temporary workarounds may be removed in future versions. You should plan your deployment and UX flow around current browser permission requirements.
***1. To manually correct this in Chrome***
- Navigate to your Dynamic Web TWAIN page.
- Click the lock/settings icon in the browser address bar.
- In **Chrome 142-144**, ensure **Local Network Access** (`local-network-access`) is `Allow`.
- In **Chrome 145+**, check:
- **Apps on device** (`loopback-network`) is `Allow` (required for `localhost` / `127.0.0.1`)
- **Local Network** (`local-network`) is `Allow` only if your app also needs private-network device access

> [!NOTE]
> Chrome updates permission popup UI frequently. Starting with Dynamic Web TWAIN **v19.3.1**, static screenshots were removed from built-in popups.
> For the latest browser-specific screenshots, see:
> [https://dynamsoft.github.io/Dynamic-Web-TWAIN/local-network-access.html](https://dynamsoft.github.io/Dynamic-Web-TWAIN/local-network-access.html)
***2. (For Admins) Apply this setting across an enterprise***
Enterprise administrators can deploy Chrome and/or Edge policies to set local-network permission to `Allow` for your website.
Please refer to:
- [Chrome Enterprise Policy List and Management Documentation](https://chromeenterprise.google/policies/#LocalNetworkAccessAllowedForUrls)
- [Microsoft Edge Browser Policy Documentation](https://learn.microsoft.com/en-us/deployedge/microsoft-edge-browser-policies/localnetworkaccessallowedforurls)
***3. Developer Notes***
**a) If running inside an `iframe`**
> [!IMPORTANT]
> If Dynamic Web TWAIN runs inside a cross-origin iframe, `loopback-network` permissions must be explicitly allowed in the iframe `allow` attribute.
> If the iframe is same-origin, no additional iframe permission configuration is required.
For Chrome 145+, use `loopback-network` (and `local-network` only if needed). For older versions, include `local-network-access`.
```html
```
**b) (Optional enhancement) Permission check for improved UX**
You can optionally query LNA permissions at runtime. This is not required, but it can help you guide users before initialization fails.
```javascript
// Helper: query the first supported permission name from a list.
async function queryFirstSupportedPermission(names) {
for (const name of names) {
try {
const result = await navigator.permissions.query({ name });
return { name, state: result.state };
} catch (_) {
// Not supported in this browser version.
}
}
return null;
}
(async () => {
// Chrome 145+: loopback-network; Chrome 142-144: local-network-access.
const loopbackPerm = await queryFirstSupportedPermission([
"loopback-network",
"local-network-access"
]);
if (!loopbackPerm) {
console.log("This browser does not expose the Local Network permission API.");
// Fallback: initialize DWT directly.
return;
}
console.log(`Loopback permission (${loopbackPerm.name}): ${loopbackPerm.state}`);
if (loopbackPerm.state === "denied") {
const currentSite = encodeURIComponent(window.location.origin);
const settingsUrl = `chrome://settings/content/siteDetails?site=${currentSite}`;
console.log(
"Local network permission is denied.\n" +
`Open: ${settingsUrl}\n` +
"Then allow Local Network for this site."
);
return;
}
if (loopbackPerm.state === "prompt") {
alert(
"To connect with the local scanning service, Chrome may ask for Local Network permission. " +
"Please click Allow when prompted."
);
}
// Proceed with DWT initialization.
// e.g., Dynamsoft.DWT.Load() or CreateDWTObjectEx(...)
})();
```
If permission is not granted, direct users to:
> Chrome -> Settings -> Privacy and security -> Site settings -> Local Network / Apps on device
### Product Improvements Related to Local Network Access
Starting from v19.3, Dynamic Web TWAIN now includes UX enhancements to better surface local-service connectivity and permission issues.
These changes do not alter or bypass Chromium's security model. They make permission-related failures easier to identify and guide users to the correct browser settings.
The key improvements include:
- **Guide the user to grant local network access**
If the service is installed (detected with WebSocket) and the access to the local service is not through or the detected permission is "prompt", prompt the user to grant access.
*Dialog 1 - Permission Granting Guidance*

- **Explicit detection of blocked local network access**
If the permission can be detected and is "denied", a clear dialog explains the cause and directs users to a guide, which tells how to enable the permission in site settings.

*Dialog 2 - Site Settings Guidance*
- **Clearer messaging during service installation**
The service installation dialog explains that connection failure may be caused either by missing service installation or denied local-network permission.

*Dialog 3 - Service Installation*
- **Latest popup screenshots hosted externally (v19.3.1+)**
Because Chromium updates native permission popups frequently, static popup screenshots were removed from this FAQ in v19.3.1.
Use this page for the latest screenshots:
[https://dynamsoft.github.io/Dynamic-Web-TWAIN/local-network-access.html](https://dynamsoft.github.io/Dynamic-Web-TWAIN/local-network-access.html)
These improvements are available starting with Dynamic Web TWAIN v19.3.
For older versions, a supplemental JavaScript file can be provided on request by contacting [Dynamsoft Support](mailto:support@dynamsoft.com).
> [!NOTE]
> This supplemental JavaScript file improves user guidance only and does not change browser permission requirements.
## Other Causes of Failure to Connect to the Service
There are other causes of service connection failure. See [another FAQ](/_articles/faq/service-prompting-to-install-repeatedly.md).
---
title: Why Do I Get a "File is Damaged and Can’t Be Opened" Error When Using the Dynamic Web TWAIN on macOS?
description: Why Do I Get a "File is Damaged and Can’t Be Opened" Error When Using the Dynamic Web TWAIN on macOS?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/file-damaged-on-macos.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/file-damaged-on-macos.md
---
# Why Do I Get a "File is Damaged and Can’t Be Opened" Error When Using the Dynamic Web TWAIN on macOS?
### Symptom
When attempt to use the scanner on macOS, an error message states “ is damaged and can’t be opened”.

### Reason
This issue is caused by macOS Gatekeeper, a security feature that blocks applications that are unsigned or not notarized when the file carries a quarantine attribute. The file itself is not damaged but Gatekeeper prevents it from running.
The error message may also show an outdated download time, for example “Safari downloaded this file on `June 18, 2019`”, even on a new computer. This happens because macOS preserves the quarantine metadata when the file has been copied from sources such as:
- An old computer
- A USB drive
- A company server
- A backup (e.g., Time Machine restore)
### Resolution
This issue is not related to our product but stems from the unsigned driver.
- Temporary Fix: Click “OK” on the error dialog. The driver often works normally afterward.
- Permanent Fix (if error persists): Remove the “quarantine” attribute via Terminal:
- Open Terminal (/Applications/Utilities).
- Run this command:
```bash
sudo xattr -rd com.apple.quarantine /Applications/{YourDriver}.app
```
> Only disable checks for trusted files. Verify the driver’s source is safe before proceeding.
---
title: Safari 26.2 Regression Causing Dynamic Web TWAIN v19.3 Auto-Reconnect Failure on macOS
description: Safari 26.2 Regression Causing Dynamic Web TWAIN v19.3 Auto-Reconnect Failure on macOS
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/safari-26-2-regression.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/safari-26-2-regression.md
---
# Safari 26.2 Regression Causing Dynamic Web TWAIN v19.3 Auto-Reconnect Failure on macOS
### Symptom
After upgrading to Safari 26.2 on macOS, a compatibility issue was observed with Dynamic Web TWAIN v19.3.
When a site installs or updates the Dynamic Web TWAIN v19.3 Service for the first time, the automatic connection and reconnect mechanism fails. A browser refresh is required to restore normal behavior.
### Issue characteristics
- Only occurs in Safari 26.2
- Does not occur in Safari 26.1 or earlier versions
- Does not occur in Dynamic Web TWAIN versions prior to 19.3
### Reason
Dynamic Web TWAIN 19.3 introduced a new configuration in reconnect requests: `targetAddressSpace: "loopback"`, following the Chrome Local Network Access documentation to explicitly indicate that the request targets the loopback address (127.0.0.1).
In Safari 26.1 and earlier, this configuration is ignored and requests are sent normally.
In Safari 26.2, `fetch` throws a `TypeError` when this configuration is present, causing the request to fail before being sent. As a result, `reconnect` cannot be implemented even though the Dynamsoft Service is installed and running.
### Update
The WebKit team has identified this issue as a regression in Safari 26.2 and has already fixed it. The fix will be included in an upcoming Safari release.
---
title: End-User Guide - Dynamic Web TWAIN SDK Documentation
description: This article will guide the end users of your web app to use Dynamic Web TWAIN for document scanning.
source_url:
html: https://www.dynamsoft.com/web-twain/docs/end-user/index.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/end-user/index.md
---
# End-User Guide
This article aims at guiding you, an end user of your company's web app, to scan documents using Dynamic Web TWAIN.
## Install Service
When you visit your company's web app and want to scan for the first time, you may be prompted to install Dynamic Web TWAIN if your IT does not have it installed. Please download the service installer and install it on your device. It is needed to communicate between the scanners and the web app.
Service Installation Dialog:

If you still see the dialog after installation, try enabling [access to apps on your device](#allow-access-to-local-apps) and checking the [list of possible reasons](/_articles/faq/service-prompting-to-install-repeatedly.md).
## Allow Access to Local Apps
In latest browsers, you may need to grant access to apps on your device to make proper scanning.
When it is asking for permission, please click "**Allow**".
{: id="permission-dialog"}
If you accidentally block the access, you can reset it as shown in the following dialog.
{: id="site-settings"}
The UI may vary according to different browsers and browser versions. The following shows the different UIs.
- Chrome 145+
- Chrome 142-144
- Edge 145+
- Edge 142-144
- FireFox
1. Permission asking dialog:

2. Site settings:

1. Permission asking dialog:

2. Site settings:

1. Permission asking dialog:

2. Site settings:

1. Permission asking dialog:

2. Site settings:

1. Permission asking dialog:

2. Site settings:

## Perform Scanning
Now, visit your app and try to scan documents. Here, we are using Dynamsoft's [online demo](https://demo.dynamsoft.com/web-twain/) for illustration.

If it does not detect any scanners, make sure that you have installed the driver. You can find the driver from the scanner manufacturer's support site.
Canon's Driver Download Site (e.g.):

## Others
If you do not have the permission to make the changes, please contact your IT for help.
More resources:
* [Configuring the Dynamic Web TWAIN Service](/_articles/extended-usage/dynamsoft-service-configuration.md)
* [What does the Dynamic Web TWAIN Service do on the end-user machine?](/_articles/faq/what-does-dynamsoft-service-do-on-end-user-machine.md)
* [I have installed the Dynamic Web TWAIN Service on an end-user machine but still got asked to install it repeatedly. Why?](/_articles/faq/service-prompting-to-install-repeatedly.md)
* [How to uninstall Dynamic Web TWAIN Service?](/_articles/faq/how-to-uninstall-dynamsoft-service.md)
---
title: Advanced DWT Initialization
description: Advanced DWT Initialization
source_url:
html: https://www.dynamsoft.com/web-twain/docs/extended-usage/advanced-initialization.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/extended-usage/advanced-initialization.md
---
# Advanced DWT Initialization
> Prerequisite: [DWT Initialization](/_articles/general-usage/initialization.md)
As presented in the standard [initialization guide](/_articles/general-usage/initialization.md), DWT instantiates a default `WebTwain` object in its default configuration. Here, we offer some alternative ways to instantiate `WebTwain` objects, as well as ways to alter the configuration of `WebTwain` objects.
## Auto-Loading with CDN/Package Manager Resources
The resource files loaded from CDNs and package managers slightly differ from the resource files obtained from the [official SDK](https://www.dynamsoft.com/web-twain/downloads). Namely, `Dynamsoft.DWT.AutoLoad` is `true` in official SDK resources (`dynamsoft.webtwain.config.js`), and `false` otherwise. This property affects whether or not DWT automatically instantiates `WebTwain` instances upon load resources (auto-load). Likewise, `Dynamsoft.DWT.Containers` provides configurations for `WebTwain` instances created during auto-load. This is found in the official SDK resources (`dynamsoft.webtwain.config.js`), and absent otherwise. To enable auto-loading when obtaining resources from CDNs or package manager, we must define these two properties, for example:
### Loading from jsDelivr
```html
```
### Loading from UNPKG
> [!WARNING]
> UNPKG may not provide any guarantees of uptime or technical support.
```html
```
APIs used:
- [`Dynamsoft.DWT.RegisterEvent()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent)
- [`Dynamsoft.DWT.GetWebTwain()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#getwebtwain)
- [`OnWebTwainReady`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#onwebtwainready)
- [`Dynamsoft.DWT.ResourcesPath`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#resourcespath)
- [`Dynamsoft.DWT.ProductKey`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#productkey)
- [`Dynamsoft.DWT.Containers`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#containers)
- [`Dynamsoft.DWT.Container`](/_articles/info/api/interfaces.md#Container)
- [`Dynamsoft.DWT.AutoLoad`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#autoload)
### Explanation
Setting values for `Dynamsoft.DWT.AutoLoad` and `Dynamsoft.DWT.Containers` results in identical startup behavior for resources obtained from CDNs and package managers to resources obtained from the official SDK.
> Note: jsDelivr currently has problems delivering the Dynamic Web TWAIN Service installer (`https://cdn.jsdelivr.net/npm/dwt@latest/dist/dist/DynamicWebTWAINServiceSetup.msi`) due to [size restrictions](https://www.jsdelivr.com/documentation#id-configuring-a-default-file-in-packagejson); please consider hosting this particular resource file elsewhere. You can specify the path using [`ServiceInstallerLocation`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#serviceinstallerlocation). UNPKG is currently unaffected. For information about the Dynamic Web TWAIN Service, learn more [here](/_articles/extended-usage/dynamsoft-service-configuration.md).
## Configuring Default `WebTwain` Instances
Since [`Dynamsoft.DWT.Containers`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#containers) controls the configuration for the `WebTwain` instance, we can use it to control the initial dimensions of the `Viewer`, and the container that the `Viewer` is bound to. `Dynamsoft.DWT.Containers` is an array of objects of the interface [`Dynamsoft.DWT.Container`](/_articles/info/api/interfaces.md#Container), which looks like this:
``` typescript
interface Container {
WebTwainId?: string;
ContainerId?: string;
Width?: string | number;
Height?: string | number;
}
```
Previously we omitted the `WebTwainId` property. This is simply another identifier which can substitute `ContainerId`, particularly in the case of headless `WebTwain` instances. A `WebTwain` instance must have **at least one** of these two properties defined.
To create multiple `WebTwain` instances with `Dynamsoft.DWT.Containers`, simply add elements to the array. Make sure to use different identifiers for the instances to prevent conflicts.
## Instantiating `WebTwain` Without Auto-Load
Some use cases call for instantiating `WebTwain` objects on demand. To do this, we use the [`Dynamsoft.DWT.Load()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#load) API to create the `WebTwain` instance. This following example demonstrates this method with resources obtained from a CDN, but resources from other sources also work:
### Sample Code
```html
```
APIs Used:
- [`Dynamsoft.DWT.RegisterEvent()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent)
- [`Dynamsoft.DWT.GetWebTwain()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#getwebtwain)
- [`OnWebTwainReady`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#onwebtwainready)
- [`Dynamsoft.DWT.ResourcesPath`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#resourcespath)
- [`Dynamsoft.DWT.ProductKey`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#productkey)
- [`Dynamsoft.DWT.Containers`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#containers)
- [`Dynamsoft.DWT.Container`](/_articles/info/api/interfaces.md#Container)
- [`Dynamsoft.DWT.Load()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#load)
### Explanation
> Note: When using resources from the official SDK, we must set `Dynamsoft.DWT.AutoLoad = false` in the `dynamsoft.webtwain.config.js` file.
This sample above instantiates a `WebTwain` object upon demand. In this case the button triggers instantiation, which calls [`Dynamsoft.DWT.Load()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#load). `Dynamsoft.DWT.Load()` creates `WebTwain` instances based on the value of `Dynamsoft.DWT.Containers`. `Dynamsoft.DWT.Load()` also triggers the `OnWebTwainReady` event, which allows us to store the `WebTwain` object in the `DWTObject` variable.
> Note: `Dynamsoft.DWT.Load()` also triggers `OnWebTwainReady` during auto-load; DWT just invokes `Dynamsoft.DWT.Load()` automatically.
## Instantiating WebTwain Without `OnWebTwainReady`
The previous two methods relied on listening to the `OnWebTwainReady` event to grab the `WebTwain` instance, and using `Dynamsoft.DWT.Containers` for the configuration. For more flexibility, DWT offers the [`Dynamsoft.DWT.CreateDWTObject()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#createdwtobject) API. The following sample works with resources obtained from any source:
### Sample Code
```html
```
APIs Used:
- [`Dynamsoft.DWT.RegisterEvent()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent)
- [`Dynamsoft.DWT.GetWebTwain()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#getwebtwain)
- [`OnWebTwainReady`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#onwebtwainready)
- [`Dynamsoft.DWT.ResourcesPath`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#resourcespath)
- [`Dynamsoft.DWT.ProductKey`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#productkey)
- [`Dynamsoft.DWT.CreateDWTObject()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#createdwtobject)
### Explanation
> Note: When using resources from the official SDK, we must set `Dynamsoft.DWT.AutoLoad = false` and `Dynamsoft.DWT.Containers = []` in the `dynamsoft.webtwain.config.js` file to disable auto-loading.
This method creates a `WebTwain` instance, and makes it available through the success callback function, rather than registering a callback handler to the `OnWebTwainReady` event. [`Dynamsoft.DWT.CreateDWTObject()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#createdwtobject) also binds the `WebTwain` instance to a container via a container `id`. This method does not provide a way to configure the size of the `Viewer`, so the `Viewer` size must be set after instantiation (e.g. with the `Viewer` [`width`](/_articles/info/api/WebTwain_Viewer.md#width) and [`height`](/_articles/info/api/WebTwain_Viewer.md#width) properties).
`Dynamsoft.DWT.CreateDWTObject()` can also set network configurations with an overloaded method like so:
```javascript
CreateDWTObject(
ContainerId: string,
host: string,
port: string | number,
portSSL: string | number,
successCallBack: (DWTObject: WebTwain) => void,
failureCallBack: ({code: number, message: string}) => void
): void;
```
## Creating Headless `WebTwain` Instances
The other instantiation methods all create a `Viewer` component in the `WebTwain` instance. To forgo a `Viewer`, or to create one separately after the fact, DWT provides the [`Dynamsoft.DWT.CreateDWTObjectEx()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#createdwtobjectex). This sample demonstrates creating a `WebTwain` instance on demand. This works with resource files obtained from any source.
### Sample Code
```html
```
APIs Used:
- [`Dynamsoft.DWT.ResourcesPath`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#resourcespath)
- [`Dynamsoft.DWT.ProductKey`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#productkey)
- [`Dynamsoft.DWT.CreateDWTObjectEx()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#createdwtobjectex)
- [`DWTInitialConfig`](/_articles/info/api/interfaces.md#DWTInitialConfig)
- [`SelectSourceAsync()`](/_articles/info/api/WebTwain_Acquire.md#selectsourceasync)
- [`AcquireImageAsync()`](/_articles/info/api/WebTwain_Acquire.md#acquireimageasync)
- [`IfCloseSourceAfterAcquire`](/_articles/info/api/Device.md#deviceobjectacquireimage)
- [`HowManyImagesInBuffer`](/_articles/info/api/WebTwain_Buffer.md#howmanyimagesinbuffer)
### Explanation
> Note: When using resources from the official SDK, we must set `Dynamsoft.DWT.AutoLoad = false` and `Dynamsoft.DWT.Containers = []` in the `dynamsoft.webtwain.config.js` file to disable auto-loading.
[`Dynamsoft.DWT.CreateDWTObjectEx()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#createdwtobjectex) creates a `WebTwain` instance provided by the [`DWTInitialConfig`](/_articles/info/api/interfaces.md#DWTInitialConfig) interface (this can also configure `host`, `port`, `ssl`). In this example, the object simply defines an identifier. Since this `WebTwain` instance is headless, it cannot be identifier by its container's `id`, so we use the `WebTwainId` property instead.
## Customizing the instances
The instances are defined in `dynamsoft.webtwain.config.js`:
``` javascript
Dynamsoft.DWT.Containers = [{
ContainerId: 'dwtcontrolContainer',
Width: '585px',
Height: '513px'
}];
```
`Containers` is an array of the `Container` type.
``` typescript
interface Container {
WebTwainId?: string;
ContainerId?: string;
Width?: string | number;
Height?: string | number;
}
```
Notes:
- `WebTwainId` and `ContainerId` are both optional but one must exist as the identifier for that `WebTwain` instance.
- `Width` and `Height` determine the initial viewer size of the instance.
- When instantiating with `Dynamsoft.DWT.Load` , `ContainerId` , `Width` and `Height` are required. Dynamic Web TWAIN will try to locate an HTML element with the ID defined by `ContainerId` and use `Width` and `Height` as the viewer size.
To create multiple instances, simply provide multiple `Containers`. For example, the following code creates two `WebTwain` instances:
``` javascript
Dynamsoft.DWT.Containers = [{
ContainerId: 'dwtcontrolContainer1',
Width: '585px',
Height: '513px'
}, {
ContainerId: 'dwtcontrolContainer2',
Width: '585px',
Height: '513px'
}];
```
## Note on Namespaces
DWT operates under the `Dynamsoft` namespace, and most of its features may be found in `Dynamsoft.DWT`. Here is the break-down:
- [`Dynamsoft.DWT`](/_articles/info/api/Dynamsoft_WebTwainEnv.md)
This contains global methods and properties such as DWT initialization and `WebTwain` instantiation. This also contains enumerations, e.g. [`Dynamsoft.DWT.EnumDWT_PixelType`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftenumdwt_pixeltype).
- `Dynamsoft.Lib`
This contains information such as environment detection results (`Dynamsoft.Lib.env`), and global methods such as `showMask()` and `hideMask()`.
---
title: Dynamic Web TWAIN SDK Features - Read Barcode
description: Dynamic Web TWAIN SDK Documentation Read Barcode Page
source_url:
html: https://www.dynamsoft.com/web-twain/docs/extended-usage/barcode-processing.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/extended-usage/barcode-processing.md
---
# Barcode Reader
With the increasing use of barcode reading in document management systems, the Barcode Reader add-on for Dynamic Web TWAIN presents an easy and seamless way of integrating one of the industry's best barcode reading components into your document management system. In this section, we will show you how to get started with the add-on and demonstrate how it can be used as a batch document classifier or separator.
> NOTE
>
> Barcode reading can be performed on the client side as well as the server side. For `Dynamic Web TWAIN` , we only consider client-side reading. If you are interested in reading on the server side, you can contact [Dynamsoft Support](/_articles/about/getsupport.md).
## Environment
* Windows
* macOS
* Linux
## How to use
### Step one - Include the add-on
To include this add-on is to reference the necessary JavaScript file which is included in the [resources files](/_articles/faq/what-are-the-resources-files.md).
> If you are using the [dwt package](https://www.npmjs.com/package/dwt), the barcode reader is already included in the main JavaScript file ( `dynamsoft.webtwain.min.js` or `dynamsoft.webtwain.min.mjs` ) which means you can skip this step.
``` html
```
### Step two - Start the reading
Now that the add-on has been referenced, we can call [`decode()`](/_articles/info/api/Addon_BarcodeReader.md#initruntimesettingswithstring) to start reading barcode(s).
``` javascript
function readBarcodes(imageIndex) {
if (DWTObject) {
DWTObject.Addon.BarcodeReader.decode(imageIndex)
.then(function(textResults) {
console.log(textResults)
}, function(error) {
console.log(error)
});
} else {
console.log('DWTObject is not initialized yet');
}
}
```
Note that the barcode reading does take a bit of time, so it'll help to add an indicator as mentioned in [Loading Bar and Backdrop](/_articles/extended-usage/ui-customization.md#loading-bar-and-backdrop)
``` javascript
function readBarcodes(imageIndex) {
if (DWTObject) {
// Add an indicator
Dynamsoft.DWT.OnWebTwainPreExecute();
DWTObject.Addon.BarcodeReader.decode(imageIndex)
.then(function(textResults) {
// Remove the indicator
Dynamsoft.DWT.OnWebTwainPostExecute();
console.log(textResults)
}, function(error) {
// Remove the indicator
Dynamsoft.DWT.OnWebTwainPostExecute();
console.log(error)
});
} else {
console.log('DWTObject is not initialized yet');
}
}
```
### Step three - Check the result
Check the structure of the resulting object [here](/_articles/info/api/Addon_BarcodeReader.md#decode). The following code prints out the text contained in the barcode(s)
``` javascript
Dynamsoft.DWT.OnWebTwainPreExecute();
DWTObject.Addon.BarcodeReader.decode(imageIndex)
.then(function(textResults) {
// Remove the indicator
Dynamsoft.DWT.OnWebTwainPostExecute();
for (var i = 0; i < textResults.length; i++) {
console.log(textResults[i].BarcodeText);
}
}, function(error) {
// Remove the indicator
Dynamsoft.DWT.OnWebTwainPostExecute();
console.log(error)
});
```
## Runtime Settings
Most of the time, you simply need to use the default decode method to read most of the barcode images out there. However, you may encounter some barcodes that fail to be read and sometimes you might want to limit which barcode types the reader should pick up, and more.
The runtime settings of the add-on gives you access to a wide array of customizable parameters, all of which you can check out with the method [ `getRuntimeSettings()` ](/_articles/info/api/Addon_BarcodeReader.md#getruntimesettings) and change with the method [ `updateRuntimeSettings()` ](/_articles/info/api/Addon_BarcodeReader.md#updateruntimesettings). Now to demonstrate a few typical customization scenarios:
### Specify the Barcode Type(s) to Read
By default, the add-on will read all the supported barcode types from the image. (See the `Supported Symbologies` [here](https://www.dynamsoft.com/Products/Barcode-Types.aspx))
If your license only covers a subset of the full list or you want to read specific barcode types, you can use `barcodeFormatIds` and `barcodeFormatIds2` to specify the barcode format(s). For example, to enable only 1D barcode reading, you can use the following code snippet:
``` javascript
DWTObject.Addon.BarcodeReader.getRuntimeSettings()
.then(function(runtimeSettings) {
runtimeSettings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED;
return DWTObject.Addon.BarcodeReader.updateRuntimeSettings(runtimeSettings);
}, function(error) {
console.log(error);
})
.then(function(runtimeSettings) {
// Add an indicator
Dynamsoft.DWT.OnWebTwainPreExecute();
return DWTObject.Addon.BarcodeReader.decode(imageIndex);
}, function(error) {
console.log(error);
})
.then(function(textResults) {
// Remove the indicator
Dynamsoft.DWT.OnWebTwainPostExecute();
for (var i = 0; i < textResults.length; i++) {
console.log(textResults[i].BarcodeText);
}
}, function(error) {
// Remove the indicator
Dynamsoft.DWT.OnWebTwainPostExecute();
console.log(error)
});
```
See also [`EnumBarcodeFormat`](https://www.dynamsoft.com/barcode-reader/docs/v9/web/programming/javascript/api-reference/enum/EnumBarcodeFormat.html?ver=9.6.42) and [`EnumBarcodeFormat_2`](https://www.dynamsoft.com/barcode-reader/docs/v9/web/programming/javascript/api-reference/enum/EnumBarcodeFormat_2.html?ver=9.6.42).
### Specify maximum barcode count
By default, the add-on will read as many barcodes as it can. To increase the recognition efficiency, you can use `expectedBarcodesCount` to specify the maximum number of barcodes to recognize according to your scenario.
``` javascript
// No matter how many barcodes are on the image, stop reading as soon as one barcode is found
runtimeSettings.expectedBarcodesCount = 1;
DWTObject.Addon.BarcodeReader.updateRuntimeSettings(runtimeSettings);
```
### Specify a scan Region
By default, the add-on will search the whole image for barcodes. This can lead to poor performance especially when dealing with high-resolution images. You can speed up the recognition process by restricting the scanning region. To specify a region, you will need to define an area. The following code shows how to define the region.
``` javascript
// The following reads the center of the image (50% vertically and horizontally)
runtimeSettings.region.regionTop = 25;
runtimeSettings.region.regionBottom = 75;
runtimeSettings.region.regionLeft = 25;
runtimeSettings.region.regionRight = 75;
runtimeSettings.region.regionMeasuredByPercentage = 1;
DWTObject.Addon.BarcodeReader.updateRuntimeSettings(runtimeSettings);
```
### Set the runtime settings using JSON
So far, we edited the values of specific runtime settings via accessing each individual setting and adjusting its value. However, the add-on also provides the developer the ability to set everything at once using a JSON string. The method is called [ `initRuntimeSettingsWithString()` ](/_articles/info/api/Addon_BarcodeReader.md#initruntimesettingswithstring).
> Some advanced features, such as dedicated configuration of a binarization mode, are only possible when using the method `initRuntimeSettingsWithString()` .
Here is a JSON template for your reference:
``` javascript
var settings = {
"ImageParameter": {
"BarcodeFormatIds": ["BF_ALL"],
"BinarizationModes": [{
"BlockSizeX": 0,
"BlockSizeY": 0,
"EnableFillBinaryVacancy": 1,
"ImagePreprocessingModesIndex": -1,
"Mode": "BM_LOCAL_BLOCK",
"ThreshValueCoefficient": 10
}],
"DeblurLevel": 9,
"Description": "",
"ExpectedBarcodesCount": 0,
"GrayscaleTransformationModes": [{
"Mode": "GTM_ORIGINAL"
}],
"ImagePreprocessingModes": [{
"Mode": "IPM_GENERAL"
}],
"IntermediateResultSavingMode": {
"Mode": "IRSM_MEMORY"
},
"IntermediateResultTypes": ["IRT_NO_RESULT"],
"MaxAlgorithmThreadCount": 4,
"Name": "runtimesettings",
"PDFRasterDPI": 300,
"Pages": "",
"RegionDefinitionNameArray": null,
"RegionPredetectionModes": [{
"Mode": "RPM_GENERAL"
}],
"ResultCoordinateType": "RCT_PIXEL",
"ScaleDownThreshold": 2300,
"TerminatePhase": "TP_BARCODE_RECOGNIZED",
"TextFilterModes": [{
"MinImageDimension": 65536,
"Mode": "TFM_GENERAL_CONTOUR",
"Sensitivity": 0
}],
"TextResultOrderModes": [{
"Mode": "TROM_CONFIDENCE"
},
{
"Mode": "TROM_POSITION"
},
{
"Mode": "TROM_FORMAT"
}
],
"TextureDetectionModes": [{
"Mode": "TDM_GENERAL_WIDTH_CONCENTRATION",
"Sensitivity": 5
}],
"Timeout": 10000
},
"Version": "3.0"
};
```
For a JSON object like `settings` above, you should make it a string first as shown in the code below
``` javascript
var JSONString = JSON.stringify(settings);
DWTObject.Addon.BarcodeReader.initRuntimeSettingsWithString(JSONString)
.then(function(){
return DWTObject.Addon.BarcodeReader.decode(imageIndex);
},function(error) {
console.log(error)
})
.then(function(textResults) {
if (textResults.length == 0) {
console.log("No barcode found");
} else {
for (var i = 0; i < textResults.length; i++) {
console.log(textResults[i].BarcodeText);
}
}
}, function(error) {
console.log(error)
})
```
### Built-in modes
If you are not sure how to change the `RuntimeSettings` , the add-on also comes with three built-in modes for you to choose from
* `speed` : fast but may miss some barcodes
* `coverage` : slow but covers most barcodes
* `balance` : between `speed` and `coverage`
To use one of these modes, simply call `updateRuntimeSettings()`
``` javascript
DWTObject.Addon.BarcodeReader.updateRuntimeSettings('coverage').then( /*---*/ );
```
[Try](https://demo.dynamsoft.com/Samples/dwt/Scan-Documents-and-Read-Barcode/ReadBarcode.html) or [download](https://www.dynamsoft.com/handle-sample?demoSampleId=66&type=2&productId=1000001&link=https%3a%2f%2fdownload2.dynamsoft.com%2fSamples%2fDWT%2fScan-Documents-and-Read-Barcode.zip) an official demo.
### Reset settings
You can always go back to the default settings with the method [ `resetRuntimeSettings()` ](/_articles/info/api/Addon_BarcodeReader.md#resetruntimesettings).
## Use barcode to classify and separate documents
Using pages with barcodes as document separators and classifying images with the barcode on it are two popular usage scenarios.
### As document separators
The following code reads all images and use those with barcodes to separate images into different documents.
``` javascript
// `aryIndices` consists of multiple arrays each of which represents a document
var aryIndices = [],
bBarcodeFound = false,
ProcssedImagesCount = 0;
j;
function ReadBarcode(index) {
DWTObject.Addon.BarcodeReader.decode(index)
.then(function(results) {
ProcssedImagesCount++;
if (results.length === 0) {
console.log('no barcode found on image index ' + index);
if (bBarcodeFound === true) {
// If a barcode was found earlier, this image belongs to the current document
bBarcodeFound = false;
if (aryIndices.length === 0)
aryIndices.push([index]);
else
aryIndices[aryIndices.length - 1].push(index);
} else {
// If no barcode has been found yet, this image belongs to the first document
if (aryIndices.length === 0)
aryIndices.push([index]);
else
aryIndices[aryIndices.length - 1].push(index);
}
} else {
console.log('barcode found on image index ' + index);
if (ProcssedImagesCount === DWTObject.HowManyImagesInBuffer) {
//If it is the last image, no need to set this flag to true nor create a new document
bBarcodeFound = false;
} else {
bBarcodeFound = true;
// Found a barcode, create a new one
if (aryIndices.length === 0)
aryIndices.push([]);
else if (aryIndices[aryIndices.length - 1].length != 0)
aryIndices.push([]);
}
}
if (ProcssedImagesCount === DWTObject.HowManyImagesInBuffer) {
// Print out the index arrays, each array represents a document
console.log(aryIndices);
aryIndices = [];
} else
/*
* Read the next image
*/
ReadBarcode(index + 1);
},
function(errorMsg) {
console.log(errorMsg);
}
);
}
ReadBarcode(0);
```
### As document classifier
The following code reads all barcodes from all images and puts images which have the same barcode into one document. Images without any barcodes are put into another separate document.
``` javascript
// `aryIndices` consists of multiple arrays each of which represents a document
var aryIndices = {
'noBarcode': []
},
ProcssedImagesCount = 0;
function ReadBarcode(index) {
var j,
bBarcodeFound = false;
DWTObject.Addon.BarcodeReader.decode(index).then(function(results) {
ProcssedImagesCount++;
if (results.length === 0) {
console.log('no barcode found on image index ' + index);
aryIndices.noBarcode.push(index);
} else {
console.log('barcode found on image index ' + index);
var barcodeOnThisImage = [],
allKeys = [];
for (j = 0; j < results.length; j++) {
var result = results[j];
var barcodeText = result.barcodeText;
// Record all barcodes found on this image
if (barcodeOnThisImage.indexOf(barcodeText) === -1)
barcodeOnThisImage.push(barcodeText);
}
Dynamsoft.Lib.each(aryIndices, function(value, key) {
allKeys.push(key);
});
for (j = 0; j < allKeys.length; j++) {
var oKey = allKeys[j];
if (barcodeOnThisImage.indexOf(oKey) != -1) {
barcodeOnThisImage.splice(barcodeOnThisImage.indexOf(oKey), 1);
var _value = aryIndices[oKey];
if (_value.indexOf(index) === -1) {
_value.push(index);
aryIndices[oKey] = _value;
}
}
}
for (j = 0; j < barcodeOnThisImage.length; j++) {
aryIndices[barcodeOnThisImage[j]] = [index];
}
}
if (ProcssedImagesCount === DWTObject.HowManyImagesInBuffer) {
ProcssedImagesCount = 0;
var aryTemp = [];
Dynamsoft.Lib.each(aryIndices, function(value, key) {
aryTemp.push(value);
});
aryIndices = aryTemp;
console.log(aryIndices);
aryIndices = {
'noBarcode': []
};
} else
/*
* Read the next image
*/
ReadBarcode(index + 1);
},
function(errorMsg) {
console.log(errorMsg);
}
);
}
ReadBarcode(0);
```
[Try](https://demo.dynamsoft.com/Samples/dwt/Scan-Documents-and-Separate-them-by-Barcode/Scan-Separate-Barcode.html) or [download](https://www.dynamsoft.com/handle-sample?demoSampleId=102&type=2&productId=1000001&link=https%3a%2f%2fdownload2.dynamsoft.com%2fSamples%2fDWT%2fScan-Documents-and-Separate-them-by-Barcode.zip) the official demo.
---
title: Dynamic Web TWAIN SDK Guide - Buffer Caching
description: Understand buffer caching in Dynamic Web TWAIN and how it improves scan performance, memory use, and document capture reliability for modern web and mobile apps
source_url:
html: https://www.dynamsoft.com/web-twain/docs/extended-usage/buffer-caching.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/extended-usage/buffer-caching.md
---
# Buffer Caching
The DWT image buffer is controlled by the Dynamic Web TWAIN Service(formerly known as Dynamsoft Service). The Dynamic Web TWAIN Service can run in either 32-bit mode or 64-bit mode. Before DWT version 15.0, the service ran in 32-bit mode by default. This meant it could not address more than 2GB of physical memory. Starting in version 15.0, the Dynamic Web TWAIN Service runs as 64-bit by default on 64-bit operating systems, which removes the 2GB memory limit. To limit memory usage, DWT can cache data to disk to free up memory.
## Disk Caching
The DWT image buffer handles data using the `DIB` format, which take up a lot of space in memory. For example, one A4 paper scanned in 300 DPI takes around 24MB in memory, which means 2GB of physical memory can only store no more than 85 of these images. As more images are processed, more memory gets used which may pose a threat to other programs on the machine. Due to this, the disk cache function was added. After enabling disk caching, most images will be temporarily cached on the disk, while keeping some active images in the memory to maintain high performance.
The disk caching feature is enabled by default, but can be disabled by setting [`IfAllowLocalCache`](/_articles/info/api/WebTwain_Buffer.md#ifallowlocalcache) to `false` .
You can also set how much memory `Dynamic Web TWAIN` can use before images start to be cached. By default, **800MB** is used. You can change it using the property [`BufferMemoryLimit`](/_articles/info/api/WebTwain_Buffer.md#buffermemorylimit).
> Note: All cached data is encrypted and can only be accessed by `Dynamic Web TWAIN`. When `Dynamic Web TWAIN` is unloaded (like when the browser tab refreshes or closes), the cached data is destroyed and removed from the disk automatically.
Although you can scan and load as many images as you like, you may want to handle them in smaller volumes when doing further processing. For example, when dealing with extremely large volumes, you should not try to upload or save the images all at once as that would be too time consuming and prone to errors.
## Save the encrypted image caches in local Dynamic Web TWAIN Service folder
In certain scenarios, there may be requirements to store encrypted image caches on a local disk for temporary data storage or backup purposes. For instance, when scanning a large batch of documents, accidentally closing the web page can result in the loss of scanned data, necessitating scanning the documents again. This issue can be mitigated by backing up the data before closing the page.
Starting from version 18.5, Dynamic Web TWAIN introduces a new feature that facilitates developers in securely storing image caches in encrypted form within the Dynamic Web TWAIN Service(formerly known as Dynamsoft Service) folder. This feature offers several advantages:
- Data is stored securely in encrypted form.
- The speed of storing data locally and loading it back into the Dynamic Web TWAIN buffer is fast.
- The stored data remains intact even when the `WebTwain` instance is destroyed.
> Note: Since the storage folder is located within the Dynamic Web TWAIN Service directory, the stored data will be lost if Dynamic Web TWAIN Service is uninstalled. Upgrading the Dynamic Web TWAIN Service will not affect the storage folder.
### Create a storage folder
First of all, you need to create a storage item by [`createLocalStorage()`](/_articles/info/api/WebTwain_IO.md#createlocalstorage) which is used to save the encrypted image caches. For example,
```javascript
var folderSettings = {
password: "XXXXXXXX",
}; // Specify the password of the created storage folder
var storageItemUid = await DWTObject.createLocalStorage(folderSettings);
```
Please ensure to set a strong password to enhance data security, especially in multi-user login scenarios.
The local directory of the created storage folder is under the service's [intallation folder](/_articles/extended-usage/dynamsoft-service-configuration.md#installation-folder).
**Save image caches**
To save the specified image(s) to the storage folder, [`saveToLocalStorage()`](/_articles/info/api/WebTwain_IO.md#savetolocalstorage) method is required.
```javascript
var bExist = await DWTObject.localStorageExist(storageItemUid); // Determine whether the folder exists
if (bExist) {
var saveImageSettings = {
uid: storageItemUid,
password: "XXXXXXXX",
indices: [0,1], // The first two images in buffer
};
await DWTObject.saveToLocalStorage(saveImageSettings);
}
else {
console.log("The storage folder does not exist.");
}
```
**Load image(s) from the storage folder**
To load the encrypted image caches into Dynamic Web TWAIN again, please use the method [`loadFromLocalStorage()`](/_articles/info/api/WebTwain_IO.md#loadfromlocalstorage).
```javascript
var bExist = await DWTObject.localStorageExist(storageItemUid); // Determine whether the folder exists
if (bExist) {
var loadImageSettings = {
uid: storageItemUid,
password: "XXXXXXXX",
};
await DWTObject.loadFromLocalStorage(loadImageSettings);
}
else {
console.log("The storage folder does not exist.");
}
```
**Remove the storage folder**
If you would like to remove the storage folder by programming, the method [`removeLocalStorage()`](/_articles/info/api/WebTwain_IO.md#removelocalstorage) can help.
```javascript
var bExist = await DWTObject.localStorageExist(storageItemUid); // Determine whether the folder exists
if (bExist) {
var removeFolderSettings = {
uid: storageItemUid,
password: "XXXXXXXX",
};
await DWTObject.removeLocalStorage(removeFolderSettings);
}
else {
console.log("The storage folder does not exist.");
}
```
---
title: Dynamic Web TWAIN SDK Deployment - Dynamic Web TWAIN Service
description: Dynamic Web TWAIN SDK Documentation Dynamic Web TWAIN Service Page
source_url:
html: https://www.dynamsoft.com/web-twain/docs/extended-usage/dynamsoft-service-configuration.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/extended-usage/dynamsoft-service-configuration.md
---
# Configuring the Dynamic Web TWAIN Service
The Dynamic Web TWAIN Service is the core piece of Dynamic Web TWAIN. It handles the communication between hardware (scanner, webcam, etc.) and browser, manages the image buffer, and coordinates data between different modules.
## Installation of Dynamic Web TWAIN Service
On a desktop, when new users access a web page using Dynamic Web TWAIN SDK for the first time, they will be prompted to install the Dynamic Web TWAIN Service. This is a built-in behavior of the library. The prompt will display the download link. Once the installer is downloaded, the installation process will take just a few seconds.
The prompt comes up when you try to [create a WebTwain instance](/_articles/extended-usage/advanced-initialization.md#instantiating-webtwain-without-onwebtwainready).

On **Windows and macOS**, double click the downloaded installer to install the service.
On **Linux**, instead of double clicking, the downloaded installer needs to be run using one of the following commands:
- Debian / Ubuntu
```bash
sudo dpkg -i DynamicWebTWAINServiceSetup.deb
```
- Fedora
```bash
sudo rpm -ivh DynamicWebTWAINServiceSetup.rpm
```
Once the installation is done, the users can click the orange sentence 'click here to verify completion' or refresh the page to start using Dynamic Web TWAIN.

### Download Links for the Service Installers
Here is a table of links for the latest version.
| Platform | Download Link |
| ------------- | --------------- |
| Windows | [Dynamic-Web-TWAIN-Service-Setup.msi](https://demo.dynamsoft.com/DWT/DWTResources/dist/DynamicWebTWAINServiceSetup.msi) |
| macOS | [Dynamic-Web-TWAIN-Service-Setup.pkg](https://demo.dynamsoft.com/DWT/DWTResources/dist/DynamicWebTWAINServiceSetup.pkg) |
| Linux | [Dynamic-Web-TWAIN-Service-Setup.deb](https://demo.dynamsoft.com/DWT/DWTResources/dist/DynamicWebTWAINServiceSetup.deb) [Dynamic-Web-TWAIN-Service-Setup-arm64.deb](https://demo.dynamsoft.com/DWT/DWTResources/dist/DynamicWebTWAINServiceSetup-arm64.deb) [Dynamic-Web-TWAIN-Service-Setup-mips64el.deb](https://demo.dynamsoft.com/DWT/DWTResources/dist/DynamicWebTWAINServiceSetup-mips64el.deb) [Dynamic-Web-TWAIN-Service-Setup.rpm](https://demo.dynamsoft.com/DWT/DWTResources/dist/DynamicWebTWAINServiceSetup.rpm)|
You can find the download links for different versions of service installers on [GitHub](https://github.com/Dynamsoft/Dynamic-Web-TWAIN/releases) or [unpkg](https://app.unpkg.com/dwt/files/dist/dist).
## Installation Folder
The service is installed in the following folders on different platforms by default.
- Windows:
- version 19.0 and later: `C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service {versionnumber}`
- version 18.5.1 and earlier: `C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_{versionnumber}`)
- macOS:
- version 19.2 and later: `/Users/{username}/Applications/Dynamsoft/Dynamic Web TWAIN Service {versionnumber}`
- version 19.0-19.1: `/Applications/Dynamsoft/Dynamic Web TWAIN Service {versionnumber}`
- version 18.5.1 and earlier: `/Applications/Dynamsoft/DynamsoftServicex64_{versionnumber}/{installed version No.}`)
- Linux:
- version 19.0 and later: `/opt/dynamsoft/Dynamic Web TWAIN Service {versionnumber}`
- version 18.5.1 and earlier: `/opt/dynamsoft/DynamsoftService`
There are some files and folders you may pay attention to:
* `log`: the folder where the logs are kept.
* `DSConfiguration.ini`: the service's configuration file.
* `storage`: the folder used by [`createLocalStorage()`](/_articles/info/api/WebTwain_IO.md#createlocalstorage).
## IP and ports
The Dynamic Web TWAIN Service uses `localhost` and `18622` `18625` ports for HTTP connection and `18623` `18626` ports for HTTPS connection.
These ports can be configured in the `DSConfiguration.ini` file located in the service's installatin folder.
## Access-Control-Allow-Origin
For security purposes, you may want the Dynamic Web TWAIN Service to only respond to requests from specified origins. Starting from Dynamic Web TWAIN version 18.5, this can be achieved by adding `Access-Control-Allow-Origin` in the `DSConfiguration.ini` file.
By default, the `Access-Control-Allow-Origin` setting is not configured in the ini file. This means that the Dynamic Web TWAIN Service can respond to requests from any origin.
You can set multiple origins by using commas as the separator, and `http://` or `https://` needs to be specified before each origin. If there is a port for the origin, please remember to specify it. If not specified, the default port is 80.
No origin:
```bash
Access-Control-Allow-Origin=*
```
Single origin:
```bash
Access-Control-Allow-Origin=http://192.168.8.212
```
Multiple origins:
```bash
Access-Control-Allow-Origin=http://192.168.8.212, http://192.168.8.126:8033, https://www.dynamsoft.com
```

After configuring the origins in the `DSConfiguration.ini` file, please set [`IfCheckCORS`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#ifcheckcors) to `true` in `dynamsoft.webtwain.config.js`.
When a request comes from a different origin, a CORS error message will be displayed, both in a pop-up and in the console.


## Web Setup
The service provides a web page to know its status and make basic configurations. You can access it through .
For security reasons, the web setup is disabled by default. You modify the following line in `DSConfiguration.ini` to enable it. If you cannot find the line, you can add it manually.
```diff
- EnableWebSetup=FALSE
+ EnableWebSetup=TRUE
```
Screenshots:
* Default:

* External Access Tab:

On the left of the page, you can check the service's status and update the [`LogLevel`](/_articles/info/api/WebTwain_Util.md#loglevel).
On the right of the page, you can configure the service through the local access tab and the external access tab.
In the local access tab, you can update the SSL certificate for domains bound to `127.0.0.1` ([guide](/_articles/faq/change-dynamsoft-service-certificate.md)).
In the external access tab, you can update the following settings:
1. Host: configure an external IP so that it can be accessed by other devices.
2. Firewall exception: add exception rules to the firewall to avoid the traffic being blocked by the firewall (only for Windows).
3. Domain: bind a domain to the IP of your service and configure its SSL certificate.
4. Bonjour service: enable Bonjour service to allow service discovery in local networks. It is needed for the [Remote Scan solution](https://www.dynamsoft.com/remote-scan/docs/introduction/).
## Msg: Dynamic Web TWAIN Service is not installed / Dynamic Web TWAIN is not installed
If Dynamic Web TWAIN Service is not installed, users may receive the error 'The Dynamic Web TWAIN module is not installed' when accessing an application that uses Dynamic Web TWAIN.
## Msg: Dynamic Web TWAIN Service installed on your device is outdated
If the service is installed but you are using a new version of the JavaScript library, you may encounter this message. You need to install a new version of the service or downgrade the JavaScript library.
## Related Resources:
* [What does Dynamic Web TWAIN Service do?](/_articles/faq/what-does-dynamsoft-service-do-on-end-user-machine.md){:target="_blank"}
* [I have installed the Dynamic Web TWAIN Service on an end-user machine but still got asked to install it repeatedly. Why?](/_articles/faq/service-prompting-to-install-repeatedly.md){:target="_blank"}
* [How to uninstall Dynamic Web TWAIN Service?](/_articles/faq/how-to-uninstall-dynamsoft-service.md){:target="_blank"}
* [Can I install Dynamic Web TWAIN Service silently?](/_articles/faq/can-i-install-dynamsoft-service-silently.md){:target="_blank"}
---
title: Dynamic Web TWAIN SDK Basics - Loading Documents from Files
description: Dynamic Web TWAIN SDK General Usage Guide - Loading Documents from Files
source_url:
html: https://www.dynamsoft.com/web-twain/docs/extended-usage/file-import.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/extended-usage/file-import.md
---
# Loading Documents from Files
> [!TIP]
> Prerequisite: [DWT Initialization](/_articles/general-usage/initialization.md)
On top of scanning images, DWT can also load documents from files on the file system, or files shared over the network. It can display, edit, and export these documents just the same as scanned images. This flexible design caters to mixed use, scanner-only, or file-only scenarios. We support the following file types: BMP, JPG, TIF, PNG, and PDF. DWT does not support all PDFs due to the complexities of the format, but the PDF rasterizer add-on does provide extra compatibility on top of base support in DWT. We can load in files through the following methods:
> [!NOTE]
> The PDF rasterizer add-on provides compatibility for a broader range of PDFs. Here we use the add-on script in the `html` head. For any loaded PDFs, the add-on rasterizes every page at the set resolution of 200 DPI. The PDF rasterizer can also selectively rasterize images only - check [`Dynamsoft.DWT.EnumDWT_ConvertMode`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_convertmode) and [`SetReaderOptions()`](/_articles/info/api/Addon_PDF.md#setreaderoptions) for details.
## Loading Files from the Selection UI
The most common file loading method is by prompting the user with a file selection interface. DWT brings up this interface slightly differently for desktop and mobile platforms.
On desktop browsers, DWT brings up the file selection interface, where users can select files on the local file system, as well as accessible files on the local network. On mobile browsers, the prompt allows users to select files from the local file system, select images from the local file system, or to take a picture. This is done with either the [`LoadImageEx()`](/_articles/info/api/WebTwain_IO.md#loadimageex) or [`LoadImage()`](/_articles/info/api/WebTwain_IO.md#loadimage) API. Here we demonstrate with `LoadImageEx()`:
### Sample Code
```html
```
APIs used:
- [`RegisterEvent()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent)
- [`OnWebTwainReady`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#onwebtwainready)
- [`GetWebTwain()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#getwebtwain)
- [`LoadImageEx()`](/_articles/info/api/WebTwain_IO.md#loadimageex)
- [`IfShowFileDialog`](/_articles/info/api/WebTwain_IO.md#ifshowfiledialog)
- [`Dynamsoft.DWT.EnumDWT_ImageType`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_imagetype)
- [`Dynamsoft.DWT.EnumDWT_ConvertMode`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_convertmode)
- [`SetReaderOptions()`](/_articles/info/api/Addon_PDF.md#setreaderoptions)
### Explanation
We first enable file selection dialogue with the [`IfShowFileDialog`](/_articles/info/api/WebTwain_IO.md#ifshowfiledialog) property. Then, the call to [`LoadImageEx()`](/_articles/info/api/WebTwain_IO.md#loadimageex) can omit an explicit file path (the `""`). The second argument allows all DWT-supported file formats to appear in the selection dialogue.
[`LoadImage()`](/_articles/info/api/WebTwain_IO.md#loadimage), works similarly to `LoadImageEx()`, but it does not specify an image file format:
```javascript
DWTObject.LoadImage(
"", // File path empty while file selection dialog is enabled
function () { console.log("Successfully loaded file"); },
function (errorCode, errorString) { console.log(errorString) }
)
```
## Loading Files with File Paths
> This feature is only supported on desktop.
When the web application only needs to load a particular file, DWT can retrieve it using a file path directly, and skip the file selection dialog altogether with the `IfShowFileDialog` property found in the `WebTwain` instance:
> Note: This example uses [`LoadImage()`](/_articles/info/api/WebTwain_IO.md#loadimage), but [`LoadImageEx()`](/_articles/info/api/WebTwain_IO.md#loadimageex) works similarly.
### Sample Code
```html
```
APIs used:
- [`RegisterEvent()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent)
- [`OnWebTwainReady`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#onwebtwainready)
- [`GetWebTwain()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#getwebtwain)
- [`LoadImage()`](/_articles/info/api/WebTwain_IO.md#loadimage)
- [`IfShowFileDialog`](/_articles/info/api/WebTwain_IO.md#ifshowfiledialog)
- [`Dynamsoft.DWT.EnumDWT_ConvertMode`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_convertmode)
- [`SetReaderOptions()`](/_articles/info/api/Addon_PDF.md#setreaderoptions)
## Loading Files from Binary Blobs
The [`LoadImageFromBinary()`](/_articles/info/api/WebTwain_IO.md#loadimagefrombinary) is used to load images from Blobs. This sample converts a sample to a Blob with another API ([`ConvertToBlob()`](/_articles/info/api/WebTwain_IO.md#converttoblob)) in order to demonstrate loading Blobs - `ConvertToBlob()` is not necessary as a part of the normal workflow.
### Sample Code
```html
```
APIs used:
- [`RegisterEvent()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent)
- [`OnWebTwainReady`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#onwebtwainready)
- [`GetWebTwain()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#getwebtwain)
- [`LoadImageEx()`](/_articles/info/api/WebTwain_IO.md#loadimageex)
- [`IfShowFileDialog`](/_articles/info/api/WebTwain_IO.md#ifshowfiledialog)
- [`Dynamsoft.DWT.EnumDWT_ImageType`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_imagetype)
- [`LoadImageFromBinary()`](/_articles/info/api/WebTwain_IO.md#loadimagefrombinary)
- [`ConvertToBlob()`](/_articles/info/api/WebTwain_IO.md#converttoblob)
- [`Dynamsoft.DWT.EnumDWT_ConvertMode`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_convertmode)
- [`SetReaderOptions()`](/_articles/info/api/Addon_PDF.md#setreaderoptions)
### Explanation
This sample code loads an image from a file, and then converts that image into a Blob. This step is done to get an image Blob on hand. `LoadImageFromBinary()` can then load that Blob back into the `WebTwain` instance, which results in a second copy of the image. [`ConvertToBlob()`](/_articles/info/api/WebTwain_IO.md#converttoblob) must specify a particular target image format - in this case PNG.
## Loading Files from Base64 Strings
Base64 strings handle similarly to Blobs, but with [`LoadImageFromBase64Binary()`](/_articles/info/api/WebTwain_IO.md#loadimagefrombase64binary). Once again, we use an extra API ([`ConvertToBase64()`](/_articles/info/api/WebTwain_IO.md#convertobase64)) for demonstration purposes.
### Sample Code
```html
```
APIs used:
- [`RegisterEvent()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent)
- [`OnWebTwainReady`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#onwebtwainready)
- [`GetWebTwain()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#getwebtwain)
- [`LoadImage()`](/_articles/info/api/WebTwain_IO.md#loadimage)
- [`IfShowFileDialog`](/_articles/info/api/WebTwain_IO.md#ifshowfiledialog)
- [`Dynamsoft.DWT.EnumDWT_ImageType`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_imagetype)
- [`LoadImageFromBase64Binary()`](/_articles/info/api/WebTwain_IO.md#loadimagefrombase64binary)
- [`ConvertToBase64()`](/_articles/info/api/WebTwain_IO.md#convertobase64)
- [`Base64Result`](/_articles/info/api/interfaces.md#base64result)
- [`Dynamsoft.DWT.EnumDWT_ConvertMode`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_convertmode)
- [`SetReaderOptions()`](/_articles/info/api/Addon_PDF.md#setreaderoptions)
### Explanation
This sample code loads an image from a file, and then converts that image into a `Base64Result`. This step is done to get a Base64 string on hand. `LoadImageFromBase64Binary()` can then load that `Base64Result` back into the `WebTwain` instance, which results in a second copy of the image.
## Downloading Files over HTTP(S)
DWT supports files downloads over HTTP to access files over a network, either with a path to the file using the `HTTPDownload()` API, or a path to a server-side script that returns the file, with the `HTTPDownloadEx()` API. The following sample uses both to retrieve an image hosted by a local web server.
### Sample Code
```html
```
### Sample Server Script Code
```C#
<%@ Page Language="C#"%>
<%
try
{
String fileName = "sample.tif";
String filePath = Server.MapPath(".") + "\\files\\" + fileName;
System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePath);
Response.ClearContent();
Response.ClearHeaders();
Response.Clear();
Response.Buffer = true;
String fileNameEncode;
fileNameEncode = HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8);
fileNameEncode = fileNameEncode.Replace("+", "%20");
String appendedheader = "attachment;filename=" + fileNameEncode;
Response.AppendHeader("Content-Disposition", appendedheader);
Response.WriteFile(fileInfo.FullName);
}
catch (Exception)
{ }
%>
```
APIs used:
- [`RegisterEvent()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent)
- [`OnWebTwainReady`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#onwebtwainready)
- [`GetWebTwain()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#getwebtwain)
- [`Dynamsoft.DWT.EnumDWT_ImageType`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_imagetype)
- [`HTTPDownload()`](/_articles/info/api/WebTwain_IO.md#httpdownload)
- [`HTTPDownloadEx()`](/_articles/info/api/WebTwain_IO.md#httpdownloadEx)
- [`Dynamsoft.DWT.EnumDWT_ConvertMode`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_convertmode)
- [`SetReaderOptions()`](/_articles/info/api/Addon_PDF.md#setreaderoptions)
### Explanation
In the example above, the two APIs request the same file at the same location on the web server. [`HTTPDownload()`](/_articles/info/api/WebTwain_IO.md#httpdownload) requests it using the file path itself. [`HTTPDownloadEx()`](/_articles/info/api/WebTwain_IO.md#httpdownloadEx) is more flexible, and as well as direct file paths, it can also be pointed to any server-side script that returns a file. The sample server script we provide happens to be in C#, but this is not a language requirement.
Note that `HTTPDownload()` and `HTTPDownloadEx()` support **HTTPS**. This requires the property [`IfSSL`](/_articles/info/api/WebTwain_IO.md#ifssl) to be set to `true` - please check our API references on [`HTTPDownloadEx()`](/_articles/info/api/WebTwain_IO.md#httpdownloadEx) for more information.
## Loading Files over FTP
> This feature is only supported on desktop.
DWT can load files retrieved over FTP, and also handle authentication when needed. The sample found below demonstrates loading a file hosted on an FTP server (requiring user authentication).
### Sample Code
```html
```
APIs used:
- [`RegisterEvent()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent)
- [`OnWebTwainReady`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#onwebtwainready)
- [`GetWebTwain()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#getwebtwain)
- [`LoadImageEx()`](/_articles/info/api/WebTwain_IO.md#loadimageex)
- [`IfShowFileDialog`](/_articles/info/api/WebTwain_IO.md#ifshowfiledialog)
- [`Dynamsoft.DWT.EnumDWT_ImageType`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_imagetype)
- [`FTPDownloadEx()`](/_articles/info/api/WebTwain_IO.md#ftpdownloadex)
- [`FTPPort`](/_articles/info/api/WebTwain_IO.md#ftpport)
- [`FTPUserName`](/_articles/info/api/interfaces.md#ftpusername)
- [`FTPPassword`](/_articles/info/api/interfaces.md#ftppassword)
- [`Dynamsoft.DWT.EnumDWT_ConvertMode`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_convertmode)
- [`SetReaderOptions()`](/_articles/info/api/Addon_PDF.md#setreaderoptions)
## Drag/Dropping Files
> This feature is only supported on desktop.
Drag/drop is built into the desktop version of the `WebTwain` `Viewer`. Users can drag and drop file icons into the viewer to load files. This feature can be turned on or off with the property [`Viewer.acceptDrop`](/_articles/info/api/WebTwain_Viewer.md#acceptdrop), e.g. `DWTObject.Viewer.acceptDrop = false` prevents the `Viewer` from accepting dropped images. This property is `true` by default.
## Loading Files from the System Clipboard
> This feature is only supported on desktop.
This following sample loads the most recent file from the system clipboard with the [`LoadDibFromClipboard()`](/_articles/info/api/WebTwain_IO.md#loaddibfromclipboard) API. Note that this API only supports DIB files.
### Sample Code
```html
```
APIs used:
- [`RegisterEvent()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent)
- [`OnWebTwainReady`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#onwebtwainready)
- [`GetWebTwain()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#getwebtwain)
- [`LoadDibFromClipboard()`](/_articles/info/api/WebTwain_IO.md#loaddibfromclipboard)
- [`Dynamsoft.DWT.EnumDWT_ConvertMode`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_convertmode)
- [`SetReaderOptions()`](/_articles/info/api/Addon_PDF.md#setreaderoptions)
- [`CopyToClipboard()`](/_articles/info/api/WebTwain_Edit.md#copytoclipboard)
- [`CurrentImageIndexInBuffer`](/_articles/info/api/WebTwain_Buffer.md#currentimageindexinbuffer)
### Explanation
In addition to [`LoadDibFromClipboard()`](/_articles/info/api/WebTwain_IO.md#loaddibfromclipboard), we also use [`CopyToClipboard()`](/_articles/info/api/WebTwain_Edit.md#copytoclipboard) to copy the displayed image to the clipboard. The user can then click the paste button to load that image back in. Note that `CopyToClipboard()` does not accept success/failure callbacks.
---
title: Dynamic Web TWAIN SDK Extended Usage Guide
description: Extended Usage
source_url:
html: https://www.dynamsoft.com/web-twain/docs/extended-usage/index.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/extended-usage/index.md
---
# Extended Usage Guide
This set of guides builds on the fundamental features covered in the standard usage guide. Here we cover topics such as customizing features explained previously (user interface), extending existing features (various `WebTwain` instantiation methods), and exploring advanced features (using the `FileUploader`), and more.
### Table of Contents
- [Advanced DWT Initialization](/_articles/extended-usage/advanced-initialization.md)
- [Loading Documents from Files](/_articles/extended-usage/file-import.md)
- [Configuring System Messages](/_articles/extended-usage/system-message-configuration.md)
- [Set Up the Dynamic Web TWAIN Service](/_articles/extended-usage/dynamsoft-service-configuration.md)
- [UI Customization](/_articles/extended-usage/ui-customization.md)
- [Using the DWT RESTful API](/_articles/extended-usage/restful-api.md)
- [Barcode Recognition](/_articles/extended-usage/barcode-processing.md)
- [OCR](./ocr.md)
- [PDF Handling](/_articles/extended-usage/pdf-processing.md)
- [Buffer Caching](/_articles/extended-usage/buffer-caching.md)
- [Remote Scan](https://www.dynamsoft.com/remote-scan/docs/introduction/)
---
title: Dynamic Web TWAIN SDK Features - OCR
description: Dynamic Web TWAIN SDK Documentation OCR Page
source_url:
html: https://www.dynamsoft.com/web-twain/docs/extended-usage/ocr.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/extended-usage/ocr.md
---
# OCR
Dynamic Web TWAIN provides an OCR add-on to extract text from scanned images. It utilizes the latest deep learning techniques and delivers high accuracy. All processing occurs locally on end-user devices, with no data uploaded to cloud servers.
Read on to learn about how to use it.
## Requirements
* Windows 10 versions >= 1809 and all versions of Windows 11
* A license with the OCR module ([contact support to get a 30-day trial license](mailto:support@dynamsoft.com))
* [DynamicWebTWAINOCRResources.zip](https://download2.dynamsoft.com/dwt/DynamicWebTWAINOCRResources.zip)
## Online Demo
You can visit the [online demo](https://demo.dynamsoft.com/Samples/dwt/OCR/index.html) ([source code](https://download2.dynamsoft.com/Samples/DWT/Scan-Documents-and-Do-OCR.zip)) to try it.
## How to Use
### Step One - Install the OCR Package
Download [DynamicWebTWAINOCRResources.zip](https://download2.dynamsoft.com/dwt/DynamicWebTWAINOCRResources.zip), unzip it and run `Install.cmd` inside the `DynamicWebTWAINOCRPack.zip` file as admin to install the OCR package.
It will copy an `ocr` folder to Dynamic Web TWAIN Service's [installation folder](/_articles/extended-usage/dynamsoft-service-configuration.md#installation-folder). The `ocr` folder contains the runtime and model files that are required to perform on-device OCR.
> [!NOTE]
> * You need to [install Dynamic Web TWAIN Service](/_articles/extended-usage/dynamsoft-service-configuration.md#installation-of-dynamic-web-twain-service) beforehand.
> * Since only Windows is supported for now, you have to do this on a Windows client for testing.
### Step Two - Write a Basic Document Scanning Page
Create an HTML file with the following content. It can scan documents from scanners as well as loading local images.
```html
Dynamic Web TWAIN - OCR Demo
Input:
```
PS: You can find where the resources files are in this [FAQ](/_articles/faq/what-are-the-resources-files.md).
### Step Three - Include the Add-on
Reference the add-on's JavaScript with the following code. You can find the file in `DynamicWebTWAINOCRResources.zip`.
> If you are using the [npm package](https://www.npmjs.com/package/dwt), the OCR is already included in the main JavaScript file (`dynamsoft.webtwain.min.js` or `dynamsoft.webtwain.min.mjs`), which means you can skip this step.
```html
```
Then, you can run the following to check if it is installed correctly:
```js
async function CheckIsOCRInstalled(){
try {
let info = await DWTObject.Addon.OCRKit.GetInstalledOCRInfo();
console.log(info);
if (info.version) {
return true;
}
} catch (error) {
alert(error.message);
return false;
}
alert("OCR Add-on is not installed. Please install it to use OCR features.");
return false;
}
```
APIs used:
[`GetInstalledOCRInfo()`](/_articles/info/api/Addon_OCR.md#getinstalledocrinfo)
### Step Four - Detect Page Orientation
This is an optional step. If the scanned document is rotated, we can detect its orientation and rotate it.
```js
async function CorrectOrientationForOne(index){
let result = await DWTObject.Addon.OCRKit.DetectPageOrientation(index);
if (result.angle != 0) {
DWTObject.Rotate(index,-result.angle,true);
}
}
```
APIs used:
- [`DetectPageOrientation()`](/_articles/info/api/Addon_OCR.md#detectpageorientation)
- [`Rotate()`](/_articles/info/api/WebTwain_Edit.md#rotate)
### Step Five - Recognize Text
Recognize the text in one image and print it in a `pre` element.
```html
```
APIs used:
[`Recognize()`](/_articles/info/api/Addon_OCR.md#recognize)
### Step Six - Save as PDF
After recognition, we can save the OCR results and images as a PDF file. It will add an invisible text layer above the original content so that the text becomes selectable and searchable.
```js
let indicesOfAll = DWTObject.SelectAllImages();
await DWTObject.Addon.OCRKit.SaveToPath(indicesOfAll,Dynamsoft.DWT.EnumDWT_OCRKitOutputFormat.PDF_WITH_EXTRA_TEXTLAYER,"output.pdf");
```
APIs used:
[`SaveToPath()`](/_articles/info/api/Addon_OCR.md#savetopath)
### Step Seven - Review the Complete Code
Here is the complete code of the demo.
```html
Dynamic Web TWAIN - OCR Demo
Input:
Processing:
Output:
```
This complete code is different from the [online demo](#online-demo)'s code, which supports regional OCR. You can find the code for the online demo [here](https://download2.dynamsoft.com/Samples/DWT/Scan-Documents-and-Do-OCR.zip).
## FAQ
### What Languages are Supported?
The OCR add-on supports multiple languages including English, French, Spanish, German, Italian, and Portuguese.
Contact [support](mailto:support@dynamsoft.com) if you need to OCR documents in other languages.
### What are the Hardware Requirements?
The OCR add-on requires a 64-bit operating system and at least 4GB of RAM for optimal performance.
### Can I Limit the Region for OCR?
Yes. You can specify which regions for OCR using the `rects` option of the [`recognize()`](/_articles/info/api/Addon_OCR.md#recognize) function.
### Will My Document be Uploaded to a Remote Server?
No. The OCR process happens locally on your machine. No data is sent to any remote servers. Also, we do not collect data for training AI.
### What is Searchable PDF?
A searchable PDF is a type of PDF file where the text content is recognized by a computer. This means you can use the Find function (usually Ctrl+F or Cmd+F) to search for specific words or phrases within the document, just like you would on a webpage or in a Word document.
The OCR add-on supports two kinds of searchable PDF output.
* Plain-text PDF, which will only keep a text layer of the OCRed text for each page.
* Extra-text-layer PDF, which will add an extra invisible text layer of the OCRed text above each page.
### What are OCR Basic and OCR Pro?
OCR Basic and OCR Pro are previous OCR add-ons, which are deprecated in v16.2. But they are still usable in the latest version.
To differentiate from previous versions, the new OCR added since v19.3 uses `OCRKit` as the namespace.
### Why I Cannot Load Saved PDF Files
The searchable PDF saved has a text layer. You need to use [PDF Rasterizer](/_articles/info/api/Addon_PDF.md) to load it. A PDF Rasterizer license is required.
---
title: Dynamic Web TWAIN SDK Features - Handle PDF
description: Dynamic Web TWAIN SDK Documentation Handle PDF Page
source_url:
html: https://www.dynamsoft.com/web-twain/docs/extended-usage/pdf-processing.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/extended-usage/pdf-processing.md
---
# Processing PDFs
In this next section, we will address all the input and output operations that allow the user to properly handle PDF files.
## Environment
* Supported on [Desktop](/_articles/introduction/system-requirements.md).
## Including the PDF addon
To include the PDF addon, simply add a reference to the corresponding JavaScript file, included in the [resources folder](/_articles/faq/what-are-the-resources-files.md).
``` html
```
> If you are using the [dwt package](https://www.npmjs.com/package/dwt), the pdf addon is already included in the main JavaScript file ( `dynamsoft.webtwain.min.js` or `dynamsoft.webtwain.min.mjs` ) which means you can skip this step.
## Input
### Open an image-only PDF file
If the PDF file only has one image per page, it can load the file by extracting the images. Most of the PDF files are scanned documents.
### Open a PDF file with more than images
If the PDF file is not pure image, we need to make use of the PDF Rasterizer (`PDFR` for short) to render the PDF first.
> How PDFR works: As the name suggests, `PDFR` rasterizes a PDF file page by page much like a scanner. You set a resolution, and you get the resulting images in that resolution after the rasterization.
The following code shows the basic usage
``` javascript
var onSuccess = function() {
console.log("Loaded a file successfully!");
};
var onFailure = function(errorCode, errorString) {
console.log(errorString);
};
DWTObject.IfShowFileDialog = true;
// PDF Addon is used here to ensure text-based PDF support
DWTObject.Addon.PDF.SetReaderOptions({
convertMode: Dynamsoft.DWT.EnumDWT_ConvertMode.CM_RENDERALL,
renderOptions:{
renderAnnotations: true;
}
});
DWTObject.LoadImageEx("", Dynamsoft.DWT.EnumDWT_ImageType.IT_ALL, onSuccess, onFailure);
```
The method [`SetReaderOptions()`](/_articles/info/api/Addon_PDF.md#setreaderoptions) configures how a PDF will be rasterized when being loaded into Dynamic Web TWAIN.
#### Other methods
* [`GetReaderOptions()`](/_articles/info/api/Addon_PDF.md#getreaderoptions): This method returns the current [`ReaderOptions`](/_articles/info/api/interfaces.md#readeroptions).
## Output as PDF
### Save images as image-based PDFs
`Dynamic Web TWAIN` can output one or multiple images in the buffer as image-based PDF file(s). This feature is built into the core module, and no addon is required as was covered in the [output](/_articles/general-usage/image-export/index.md) section.
### PDF save settings
However, some advanced features are only possible with the help of the PDF addon. At present, that means configuring the resulting file(s) with the API [ `Write.Setup()` ](/_articles/info/api/Addon_PDF.md#writesetup) as shown below
``` javascript
DWTObject.Addon.PDF.Write.Setup({
author: "Dynamsoft-Support-Team",
compression: Dynamsoft.DWT.EnumDWT_PDFCompressionType.PDF_JP2000,
pageType:Dynamsoft.DWT.EnumPDF_Page_A4,
creator: "DWT",
creationDate: "D:20200930",
keyWords: "TWAIN, DWT, Dynamsoft",
modifiedDate: "D:20200930",
producer: "Dynamsoft Corporation",
subject: "Demoing File",
title: "Sample PDF Made by DWT",
version: 1.5,
quality: 80
});
DWTObject.IfShowFileDialog = true;
DWTObject.SaveAllAsPDF(' ', function() {}, function() {})
```
From version 18.5, `Dynamic Web TWAIN` supports the generation of encrypted PDF files. For example,
``` javascript
DWTObject.Addon.PDF.Write.Setup({
author: "Dynamsoft-Support-Team",
compression: Dynamsoft.DWT.EnumDWT_PDFCompressionType.PDF_JP2000,
pageType:Dynamsoft.DWT.EnumPDF_Page_A4,
creator: "DWT",
creationDate: "D:20200930",
keyWords: "TWAIN, DWT, Dynamsoft",
modifiedDate: "D:20200930",
producer: "Dynamsoft Corporation",
subject: "Demoing File",
title: "Sample PDF Made by DWT",
version: 1.5,
quality: 80,
password: "dwtpassword"
});
DWTObject.IfShowFileDialog = true;
DWTObject.SaveAllAsPDF(' ', function() {}, function() {})
```
When you set a password prior to generating a PDF file, that password becomes necessary each time you attempt to open the file thereafter. The password does not restrict the usage permissions of the PDF. The encryption algorithm utilized is AES256, ensuring robust security measures.
Note: Only the core module license is required to use this method.
## Append Pages to a PDF
If you need to append a scanned document to a PDF file and keep the rest pages unmodified. You can use the following code to read a PDF file by setting the `preserveUnmodifiedOnSave` property to `true`.
```js
DWTObject.Addon.PDF.SetReaderOptions({
convertMode: Dynamsoft.DWT.EnumDWT_ConvertMode.CM_RENDERALL,
preserveUnmodifiedOnSave: true, //only available for v19.0+
renderOptions:{
renderAnnotations: true //enable this to keep annotations
}
});
```
Then, it will keep the unmodified pages in the PDF file instead of converting them to images when saving a new PDF file with the scanned documents.
## PDF/A
PDF/A is a version of PDF specialized for use in the archiving and long-term preservation of electronic documents. For example, it does not allow using external fonts, which will change the appearance if opening it on another device.
Starting from Web TWAIN v19.3, it can save PDF as PDF/A-1b or PDF/A-2b by specifying `pdfaVersion` in [`PDFWSettings`](/_articles/info/api/interfaces.md#pdfwsettings).
Here is the code to do this:
```js
DWTObject.Addon.PDF.Write.Setup({
pdfaVersion:"pdf/a-1b"
});
DWTObject.IfShowFileDialog = true;
DWTObject.SaveAllAsPDF(' ', function() {}, function() {})
```
Both PDF/A-1b and PDF/A-2b are basic conformation level standards. PDF/A-1b is based on PDF version 1.4 and PDF/A-2b is based on PDF version 1.7. PDF/A-2b has the following new features compared to PDF/A-1b:
* JPEG 2000 image compression.
* support for transparency effects and layers.
* embedding of OpenType fonts.
* provisions for digital signatures in accordance with the PDF Advanced Electronic Signatures – PAdES standard.
* the option of embedding PDF/A files to facilitate archiving of sets of documents with a single file.
It is recommended to use PDF/A-2b because of the support for more features.
Related FAQ:
* [How can I generate PDF/A files?](/_articles/faq/generate-pdf-files.md)
* [How can I load PDF/A files into the Dynamic Web TWAIN SDK?](/_articles/faq/load-pdf-files.md)
---
title: Using the RESTful API
description: RESTful API
source_url:
html: https://www.dynamsoft.com/web-twain/docs/extended-usage/restful-api.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/extended-usage/restful-api.md
---
# Using the RESTful API
By default, Dynamic Web TWAIN consists of the Dynamic Web TWAIN Service installed and running on a system, connected to a web application which integrates the Dynamic Web TWAIN SDK. To use DWT to access scanners on other platforms and using other programming languages, you can use the [DWT Service RESTful API](/_articles/info/api/restful.md). This allows desktop, mobile, and server-side applications to access the DWT Service installed on the scanner host (local or server) in a simple, stateless, and standardized manner.
The RESTful API simply returns scanned documents as streams of image files to the client, and **does not use the DWT Viewer**. This is because **the RESTful API functions entirely using the DWT Service**, and is viewer-agnostic. You may choose to feed the scanned images to any viewer, including a DWT Viewer in your application that you instantiate separately, if desired.
Here is a collection of tutorials on creating sample applications that use the DWT RESTful API in various platforms and languages.
- [.NET](https://github.com/Dynamsoft/Dynamic-Web-TWAIN-REST-dotnet)
- [Node.js](https://www.dynamsoft.com/codepool/rest-api-node-document-scanning.html)
- [Flutter](https://www.dynamsoft.com/codepool/flutter-twain-scanner-digitize-document.html)
- [Java](https://www.dynamsoft.com/codepool/java-twain-document-scanning.html)
- [Python](https://www.dynamsoft.com/codepool/python-twain-wia-sane-document-scanner.html)
---
title: Configuring System Messages
description: Configuring System Messages
source_url:
html: https://www.dynamsoft.com/web-twain/docs/extended-usage/system-message-configuration.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/extended-usage/system-message-configuration.md
---
# Configuring System Messages
DWT provides various system messages during all parts of runtime. Some of these messages are errors which are useful for debugging/reporting purposes, such as indicating that the [Dynamic Web TWAIN Service](/_articles/faq/what-does-dynamsoft-service-do-on-end-user-machine.md) has not been installed on end user's system. Other messages provide information directly to the end user, such as labelling the image source selection prompt overlay (scanner selection).
These system messages are configurable. Notably, we recommend changing these system messages for the purposes of translating the default English messages to other localizations.
## Configuring the `CustomizableDisplayInfo` Object
Most system messages are configurable with the `Dynamsoft.DWT.CustomizableDisplayInfo` object, which may be modified within the **`dynamsoft.webtwain.config.js`** configuration resource file. This resource file has a commented-out definition of the object, which contains the default system messages. To alter the default messages, simply un-comment the object and change its properties:
```javascript
Dynamsoft.DWT.CustomizableDisplayInfo = {
errorMessages: {
// launch
ERR_MODULE_NOT_INSTALLED:
"Error: The Dynamic Web TWAIN module is not installed.",
ERR_BROWSER_NOT_SUPPORT: "Error: This browser is currently not supported.",
ERR_CreateID_MustNotInContainers:
"Error: Duplicate ID detected for creating Dynamic Web TWAIN objects, please check and modify.",
ERR_CreateID_NotContainer:
"Error: The ID of the DIV for creating the new DWT object is invalid.",
ERR_DWT_NOT_DOWNLOADED:
"Error: Failed to download the Dynamic Web TWAIN module.",
// image view
limitReachedForZoomIn: "Error: You have reached the limit for zooming in",
limitReachedForZoomOut: "Error: You have reached the limit for zooming out",
// image editor
insufficientParas: "Error: Not enough parameters.",
invalidAngle: "Error: The angle you entered is invalid.",
invalidHeightOrWidth: "Error: The height or width you entered is invalid.",
imageNotChanged: "Error: You have not changed the current image.",
},
// launch
generalMessages: {
checkingDWTVersion: "Checking WebTwain version ...",
updatingDService: "Dynamic Web TWAIN Service is updating ...",
downloadingDWTModule: "Downloading the Dynamic Web TWAIN module.",
refreshNeeded: "Please REFRESH your browser.",
downloadNeeded: "Please download and install the Dynamic Web TWAIN.",
DWTmoduleLoaded: "The Dynamic Web TWAIN module is loaded.",
},
customProgressText: {
// html5 event
upload: "uploading...",
download: "Downloading...",
load: "Loading...",
decode: "Decoding...",
decodeTIFF: "Decoding tiff...",
decodePDF: "Decoding pdf...",
encode: "Encoding...",
encodeTIFF: "Encoding tiff...",
encodePDF: "Encoding pdf...",
// image control
canvasLoading: "Loading ...",
},
// image editor
buttons: {
titles: {
previous: "Previous Image",
next: "Next Image",
print: "Print Image",
scan: "Acquire new Image(s)",
load: "Load local Image(s)",
rotateleft: "Rotate Left",
rotate: "Rotate",
rotateright: "Rotate Right",
deskew: "Deskew",
crop: "Crop Selected Area",
cut: "Cut Selected Area",
changeimagesize: "Change Image Size",
flip: "Flip Image",
mirror: "Mirror Image",
zoomin: "Zoom In",
originalsize: "Show Original Size",
zoomout: "Zoom Out",
stretch: "Stretch Mode",
fit: "Fit Window",
fitw: "Fit Horizontally",
fith: "Fit Vertically",
hand: "Hand Mode",
rectselect: "Select Mode",
zoom: "Click to Zoom In",
restore: "Restore Original Image",
save: "Save Changes",
close: "Close the Editor",
removeall: "Remove All Images",
removeselected: "Remove All Selected Images",
},
},
dialogText: {
dlgRotateAnyAngle: [
"Angle :",
"Interpolation:",
"Keep size",
" OK ",
"Cancel",
],
dlgChangeImageSize: [
"New Height :",
"New Width :",
"Interpolation method:",
" OK ",
"Cancel",
],
saveChangedImage: [
"You have changed the image, do you want to keep the change(s)?",
" Yes ",
" No ",
],
selectSource: [
"Select Source:",
"Select",
"Cancel",
"There is no source available!",
],
},
};
```
The messages are grouped into categories:
- `errorMessages` mainly contains loading/instantiation error messages.
- `customProgressText` are loading messages that appear during processes such as data IO and image encoding/decoding.
- `buttons` `Viewer` editor/DDV element tooltip labels?
- `dialogText` provides confirmation messages and the source selection message to the user.
## Configuring the `_show_install_dialog()` Function
The `Dynamsoft._show_install_dialog()` function defined in the `dynamsoft.webtwain.install.js` resource file generates the [Dynamic Web TWAIN Service](/_articles/faq/what-does-dynamsoft-service-do-on-end-user-machine.md) installation dialog box, pictured here:

As the dialog box contains instructions for installing the Dynamic Web TWAIN Service, consider altering the message strings for localization purposes. Generally we discourage directly modifying the resource files, but this dialogue function contains styling and messaging which may be tailored the web application itself. Try not to alter the platform detection logic too greatly, as this may interfere with the Dynamic Web TWAIN Service installation procedure. Please contact the [support team](/_articles/about/getsupport.md) for any further questions.
---
title: Dynamic Web TWAIN SDK Features - UI Elements
description: Dynamic Web TWAIN SDK Documentation UI Page
source_url:
html: https://www.dynamsoft.com/web-twain/docs/extended-usage/ui-customization.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/extended-usage/ui-customization.md
---
# UI Elements
In this section, we'll explore the UI Elements that are built into the `Dynamic Web TWAIN` library for user interactions.
Generally speaking, most UI elements are configured in the file **dynamsoft.webtwain.install.js**. This file is already referenced inside the **dynamsoft.webtwain.initiate.js**.
## Installation Dialog

This dialog comes up when using `Dynamic Web TWAIN` scanner module under one of the following conditions:
* The Dynamic Web TWAIN Service is not installed
* The Dynamic Web TWAIN Service is not running
* A failure to connect to the Dynamic Web TWAIN Service
If needing to disable the default dialog or come up with your own install dialog, you can make changes to `Dynamsoft._show_install_dialog()` in the **dynamsoft.webtwain.install.js** file.
## Indicators
### Loading bar and backdrop

This loading bar and backdrop shows up when creating a `WebTwain` instance or when you try to scan. The functions `Dynamsoft.DWT.OnWebTwainPreExecute()` and `Dynamsoft.DWT.OnWebTwainPostExecute()` are called before and after the process. You can customize the behavior like this
``` javascript
Dynamsoft.DWT.OnWebTwainPreExecute = function() {
// Show your own progress indicator
console.log('An operation starts!');
};
Dynamsoft.DWT.OnWebTwainPostExecute = function() {
// Hide the progress indicator
console.log('An operation ends!');
};
```
On the other hand, you can also call the functions `Dynamsoft.DWT.OnWebTwainPreExecute()` and `Dynamsoft.DWT.OnWebTwainPostExecute()` to show and hide the loader bar and backdrop when you need it in your own workflow.
If you just want to change the loading bar, you can use the `Dynamsoft.DWT.CustomizableDisplayInfo.loaderBarSource` .
### Progress bar
When `Dynamic Web TWAIN` performs a time-consuming task, it'll show a progress bar. This progress bar is either like this

or like this (with a `Cancel` button)

The 1st bar shows up when saving, loading or converting and can be hidden by setting [ `IfShowProgressBar` ](/_articles/info/api/WebTwain_IO.md#ifshowprogressbar) to `false` .
Both bars show up when uploading or downloading and can be hidden by setting [ `IfShowCancelDialogWhenImageTransfer` ](/_articles/info/api/WebTwain_IO.md#ifshowcanceldialogwhenimagetransfer) to `false` .
For uploading or downloading, you can also build your own progress bar with the help of the built-in event [ `OnInternetTransferPercentage` ](/_articles/info/api/WebTwain_IO.md#oninternettransferpercentage).
``` javascript
DWTObject.RegisterEvent('OnInternetTransferPercentage',
function(percentage) {
console.log(percentage);
// Use the percentage to build your own progress bar
}
);
```
## Language
### Error Messages
`Dynamic Web TWAIN` has many built-in error messages as shown [here](/_articles/info/api/appendix.md#error-list). Each `ErrorString` has its own `ErrorCode` . To change the language of the message, you can read the `ErrorCode` and output the error string you have customized. For example
``` javascript
if (DWTObject.ErrorCode === -2359) {
// ErrorString "The index is out of range."
// To Spanish
console.log("El índice está fuera de rango.")
}
```
---
title: Only 24-bit true color bmp and 8-bit gray-scaled images are supported for JPEG compression
description: Only 24-bit true color bmp and 8-bit gray-scaled images are supported for JPEG compression
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/JPEG-compression.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/JPEG-compression.md
---
# Error Troubleshooting
## Only 24-bit true color bmp and 8-bit gray-scaled images are supported for JPEG compression
### Symptom
When you save or upload an image as a JPEG file, you may receive the error.
### Cause
You are saving a black and white image as a JPEG file but JPEG standard only allows the compression of grayscale and RGB images.
### Resolution
Make sure the pixel type of the image in the buffer is Gray or RGB. If it is not, you can either save it in another format or convert the image to grayscale using the method [ConvertToGrayScale()](/_articles/info/api/WebTwain_Edit.md#converttograyscale).
```javascript
if ( /*If save in JPEG*/ ) {
//Check whether the current image is B&W
//1 is B&W, 8 is Gray, 24 is RGB
if (DWTObject.GetImageBitDepth(DWTObject.CurrentImageIndexInBuffer) == 1)
//If so, convert the image to Gray
DWTObject.ConvertToGrayScale(DWTObject.CurrentImageIndexInBuffer);
//Save image in JPEG
DWTObject.SaveAsJPEG("DynamicWebTWAIN.jpg", DWTObject.CurrentImageIndexInBuffer);
}
```
---
title: Can I install Dynamic Web TWAIN Service silently?
description: Can I install Dynamic Web TWAIN Service silently?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/can-i-install-dynamsoft-service-silently.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/can-i-install-dynamsoft-service-silently.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# Can I install Dynamic Web TWAIN Service silently?
Yes. You can install Dynamic Web TWAIN Service silently by running the appropriate command for your version and operating system.
- [v19.0+](#19plus)
- [Versions below 19.0](#19min)
* Windows
Run Command Prompt as administrator, then execute:
``` shell
msiexec /i "/path/to/DynamicWebTWAINServiceSetup.msi" /qn
```
* macOS
``` shell
// Install
sudo installer -pkg /path/to/DynamicWebTWAINServiceSetup.pkg -target /Applications
// Stop service
sudo launchctl unload /Library/LaunchAgents/com.dynamsoft.dynamicwebtwainservicex64.plist
// Start service
launchctl load /Library/LaunchAgents/com.dynamsoft.dynamicwebtwainservicex64.plist
```
* Linux
``` shell
sudo dpkg -i /path/to/DynamicWebTWAINServiceSetup.deb
```
or
``` shell
sudo rpm -i path/to/DynamicWebTWAINServiceSetup.rpm
```
* Windows
Run Command Prompt as administrator, then execute:
``` shell
msiexec /i "/path/to/DynamsoftServiceSetup.msi" /qn
```
* macOS
``` shell
// Install
sudo installer -pkg /path/to/DynamsoftServiceSetup.pkg -target /Applications
// Stop service
sudo launchctl unload /Library/LaunchAgents/com.dynamsoft.dynamsoftservicex64.plist
// Start service
launchctl load /Library/LaunchAgents/com.dynamsoft.dynamsoftservicex64.plist
```
* Linux
``` shell
sudo dpkg -i /path/to/DynamsoftServiceSetup.deb
```
or
``` shell
sudo rpm -i path/to/DynamsoftServiceSetup.rpm
```
In a controlled environment, you can distribute Dynamic Web TWAIN Service to all client machines at once, as you would with other software. [Group Policy](https://docs.microsoft.com/en-us/troubleshoot/windows-server/group-policy/use-group-policy-to-install-software) is one option for Windows deployments.
---
title: How can I send additional form fields with images to my server or database?
description: How can I send additional form fields with images to my server or database?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/additional-form-fields.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/additional-form-fields.md
---
# Document Saving
## How can I send additional form fields with images to my server or database?
You can use [SetHTTPFormField](/_articles/info/api/WebTwain_IO.md#sethttpformfield){:target="_blank"} to set meta data as form fields and use [HTTPUpload](/_articles/info/api/WebTwain_IO.md#httpupload){:target="_blank"} to send it to the server side with the scanned document.
```javascript
// Clear old fields before adding new ones
DWTObject.ClearAllHTTPFormField();
DWTObject.SetHTTPFormField("FileType", "Insurance Doc");
```
You can check out this demo project for sending additional form fields when uploading the scanned document.
[SetHTTPFormField](/_articles/info/api/WebTwain_IO.md#sethttpformfield){:target="_blank"} can also be used to send image data in base64 or BLOB to the server side.
By design, the method [HTTPUpload()](/_articles/info/api/WebTwain_IO.md#httpupload){:target="_blank"} only contains one file. But as it essentially sends an HTTP form to the server, you can attach multiple files in that form using the methods [ConvertToBlob()](/_articles/info/api/WebTwain_IO.md#converttoblob){:target="_blank"} and [SetHTTPFormField()](/_articles/info/api/WebTwain_IO.md#sethttpformfield){:target="_blank"} .
Check out the following snippet on how it is done. NOTE that the method [HTTPUpload()](/_articles/info/api/WebTwain_IO.md#httpupload){:target="_blank"} only has 3 parameters as it doesn't need to specify a file anymore.
```javascript
/**
* Upload the images specified by their indices in the specified file type as separate files.
* @param indices Specify the images
* @param type Specify the file type
*/
function uploadSeparateFiles(indices, type) {
var protocol = Dynamsoft.Lib.detect.ssl ? "https://" : "http://",
port = window.location.port === "" ? 80 : window.location.port,
actionPage = "/upload.aspx";
// path to the server-side script
var url = protocol + window.location.hostname + ":" + port + actionPage;
if (DWTObject) {
var done = 0,
count = indices.length;
var toBlob = function (index) {
var fieldName = "SampleFile_" + index;
var fileName = fieldName + getExtension(type);
DWTObject.ConvertToBlob(
[index],
type,
function (result, _indices, type) {
DWTObject.SetHTTPFormField(fieldName, result, fileName);
done++;
if (done === count) {
DWTObject.HTTPUpload(
url,
function () {
console.log("Success");
},
function (errCode, errString, responseStr) {
console.log(errString);
}
);
} else {
toBlob(indices[done]);
}
},
function (errorCode, errorString) {
console.log(errorString);
}
);
};
toBlob(indices[done]);
}
}
```
---
title: Uncaught ReferenceError - DVS is not defined
description: Uncaught ReferenceError - DVS is not defined
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/DVS-is-not-defined.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/DVS-is-not-defined.md
---
# Error Troubleshooting
## Uncaught ReferenceError - DVS is not defined
You may see this error if the Dynamic Web TWAIN resources are deployed in a custom manner. The error is thrown when one or more resources cannot be loaded when trying to load the Dynamic Web TWAIN environment.
Please make sure the path to Resources folder is defined correctly and that you can find `\*.viewer.js` under the `{ResourcesPath}/src` folder. If `viewer.js` does not exist in the target directory, please verify that the Dynamic Web TWAIN resources are deployed correctly and all files have been deployed.
Please refer to [Dynamic Web TWAIN Deployment - Server Deployment](/_articles/general-usage/server-deployment.md){:target="_blank"} for more details on server deployment
---
title: HTTP process error
description: HTTP process error
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/HTTP-process-error.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/HTTP-process-error.md
---
# Error Troubleshooting
## HTTP process error
### Symptom
When attempting to upload images using any of the HTTPUpload\*\*\* methods the upload fails and you receive this error.
### Cause
1. The write permission is not granted to the specified directory on the web server.
2. The action page is incorrect or returns something from the web server.
3. The port specified for uploading is incorrect.
4. The size of the images you are trying to upload is larger than the maximum allowed size set by the server.
### Solution
1. Make sure the users who are uploading have permission to write images to the specified directory on the web server. (For example, give "Write" permission to the Authenticated Users.)
2. Check the response string returned from the HTTP server to determine the cause of the HTTP process error. You can get this string by using the [HTTPPostResponseString](/_articles/info/api/WebTwain_IO.md#httppostresponsestring) property.
3. Set the port to the correct one using [HTTPPort](/_articles/info/api/WebTwain_IO.md#httpport). We recommend you get the Port and Server values this way:
```javascript
var strHTTPServer = location.hostname;
DWTObject.HTTPPort = location.port == "" ? 80 : location.port;
```
- If you have set [IfSSL](/_articles/info/api/WebTwain_IO.md#ifssl) to true, you must set a secure port for the HTTPPort property. For example,
```javascript
DWTObject.IfSSL = true;
DWTObject.HTTPPort = 443;
```
> For example: If the URL for the scan page is "http://localhost:3253/....", you should set the port to 3253.
4. Check the server-side configuration
- Please reset the maximum transferable data size. If you are using `ASP.NET` , you can change the value in the following line in the `Web.Config` file.
```xml
// In kilobytes
```
This line may also be required
```xml
// In bytes
```
The following is an example config file
```xml
```
If you are using `PHP` , you can change the value in the following lines in the `php.ini` file and `web.config` file:
- **php.ini**
```shell
file_uploads = On ; Enable file uploads
upload_max_filesize = 50M ; Max single file size for uploads
post_max_size = 60M ; Max size for POST data (includes all fields and files)
max_execution_time = 300 ; Max script execution time (in seconds)
```
- **web.config**
```xml
```
---
title: HTTP request error
description: HTTP request error
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/HTTP-request-error.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/HTTP-request-error.md
---
# Error Troubleshooting
## HTTP request error
### Symptom
When attempting to upload images via HTTP Put the images fail to upload and this error is received.
### Cause
- The problem may occur if write permission is not provided on the server.
- If you use Tomcat, the value of the `readonly` property is `false` by default, in this case the HTTP Put operation is not allowed.
### Solution
- Check the write permission of the server.
- Start Internet Information Services (IIS).
- Click Web Sites.
- Right-click the specified work folder, select Properties.
- Select the Write option at the Directory tab.
- If you are using Tomcat, the `doPut()` will check to see if the `readonly` property has been changed to `false`. If it has not, the HTTP Put operation is not allowed. Please go to {Tomcat installation directory} -> conf -> web.xml, find the default servlet configuration (org.apache.catalina.servlets. DefaultServlet) and change the `readonly` property to `true` .
```xml
readonlyfalse
```
---
title: XMLHttpRequest cannot load XXX
description: XMLHttpRequest cannot load XXX
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/XMLHttpRequest-cannot-load.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/XMLHttpRequest-cannot-load.md
---
# Error Troubleshooting
## XMLHttpRequest cannot load XXX
### Symptom
You get the error
```shell
XMLHttpRequest cannot load xxxxx. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://xxxxxxx' is therefore not allowed access.
```
### Cause
You are uploading or downloading to/from a web server which is in a different domain than your current website and that web server doesn't allow accessing from a different domain.
### Solution
Try uploading to the same domain or update the server-side configuration to allow cross-domain requests. If you are using IIS, you can refer to the following configuration.
```xml
```
> Note
>
> After updating the server configuration file, you'll need to restart the server (i.e. IIS).
>
> If you are downloading a file, you might need to clear the browser cache because a cached file will not be requested again from the server, thus still no 'Access-Control-Allow-Origin' header will be presented.
>
> If you need to send cookies/credentials (e.g., Windows Authentication), enable credentials via code:
>
> ```javascript
> DWTObject.HTTPRequestswithCredentials = true; // adds withCredentials:true on upload requests
> ```
---
title: Is the AcquireImage() method synchronous or asynchronous?
description: Is the AcquireImage() method synchronous or asynchronous?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/acquireimage-sync-or-async.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/acquireimage-sync-or-async.md
---
# Capture/Image Source
## Is the AcquireImage() method synchronous or asynchronous?
[AcquireImage()](/_articles/info/api/WebTwain_Acquire.md#acquireimage){:target="_blank"} is an asynchronous method, regardless of whether it includes a callback function or not.
---
title: Can the Dynamic Web TWAIN SDK automatically detect borders of the scanned document and crop it out?
description: Can the Dynamic Web TWAIN SDK automatically detect borders of the scanned document and crop it out?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/automatically-detect-border.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/automatically-detect-border.md
---
# Capture/Image Source
## Can the Dynamic Web TWAIN SDK automatically detect borders of the scanned document and crop it out?
Yes, Dynamic Web TWAIN SDK can automatically detect borders of the scanned document if it is supported by the device and its driver. You can check whether your device supports this capability from its user manual.
Please use [IfAutomaticBorderDetection](/_articles/info/api/WebTwain_Acquire.md#ifautomaticborderdetection){:target="_blank"} property to enable this functionality.
> Note: Once enabled, the data source (scanner) will automatically detect the borders of the document so that no extra margins are scanned.
---
title: Can the Dynamic Web TWAIN SDK automatically rotate upside-down pages during the document scanning process?
description: Can the Dynamic Web TWAIN SDK automatically rotate upside-down pages during the document scanning process?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/automatically-rotate-upside-down-pages.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/automatically-rotate-upside-down-pages.md
---
# Capture/Image Source
## Can the Dynamic Web TWAIN SDK automatically rotate upside-down pages during the document scanning process?
Dynamic Web TWAIN does not auto-rotate pages by default, but you can rotate images in code using the API covered in [this example](/_articles/general-usage/image-processing/image-editing.md#example---rotating-images){:target="_blank"}.
If you have the OCR Add-on (v19.3+), you can call [`DetectPageOrientation()`](/_articles/info/api/Addon_OCR.md#detectpageorientation){:target="_blank"} to detect the page orientation from recognized text and use that result to decide how to rotate.
Some scanners also offer an AutoDeskew/AutoRotate capability that runs on the device. If your scanner supports it, enable that option (see [our de-skew guidance](/_articles/faq/support-image-deskew.md) for scanner-side setup); otherwise, use the rotation API noted above based on your own detection logic.
---
title: Can I add annotation to an image (e.g. add watermark or text)?
description: Can I add annotation to an image (e.g. add watermark or text)?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/add-annotation-to-image.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/add-annotation-to-image.md
---
# Image Editing
## Can I add annotation to an image (e.g. add watermark or text)?
In 2023, Dynamsoft introduced Dynamsoft Document Viewer, a feature-rich web-based document viewer that supports document annotation. When used in conjunction with Dynamic Web TWAIN, it enables users to annotate scanned documents seamlessly. For more information, please refer to: [Dynamic Web TWAIN with Annotations](https://www.dynamsoft.com/web-twain/docs/faq/dwt-with-annotation.html).
---
title: How to run Dynamic Web TWAIN ActiveX in Microsoft Edge Internet Explorer (IE) mode
description: How to run Dynamic Web TWAIN ActiveX in Microsoft Edge Internet Explorer (IE) mode
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/activeX-in-Edge-IE-mode.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/activeX-in-Edge-IE-mode.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# How to run Dynamic Web TWAIN ActiveX in Microsoft Edge Internet Explorer (IE) mode
> ActiveX support was removed starting in Dynamic Web TWAIN v19. This article is archived for customers running versions earlier than 19. For supported browsers in v19 and later, please migrate to the HTML5 edition.
Microsoft is retiring Internet Explorer 11 on June 15, 2022. To support Dynamic Web TWAIN ActiveX, please configure IE mode in Edge following the steps below. For better browser compatibility, we strongly recommend [updating your web application with our HTML5 edition](/_articles/indepth/development/activex.md#move-away-from-activex){:target="_blank"}.
### Step by step instructions to configure Microsoft Edge IE mode
1. Update Edge Default Browser settings per the screenshot:

2. Download and install Enterprise Mode Site List Manager to add and export a site list to a XML file.

3. Turn on Enterprise Mode using Group Policy
4. Run the following command to force the update of the group policy
``` shell
`gpupdate /force`
```
5. Go to edge://compat/iediagnostic to open the Microsoft Edge Compatibility tab. Check under the Group policy settings to make sure the policy is applied.
6. Run your web application.
7. You can debug the content of an IE mode tab by using IEChooser to open Internet Explorer DevTools: Open the Windows Run dialog box and enter "%systemroot%\system32\f12\IEChooser.exe".
For more details, please visit Microsoft's documentation: What is Internet Explorer (IE) mode?
---
title: Are admin privileges required to install the end-user component?
description: Are admin privileges required to install the end-user component?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/admin-privileges-needed-to-install.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/admin-privileges-needed-to-install.md
---
View all FAQs about [Project Deployment and End-user Installation](
https://www.dynamsoft.com/web-twain/docs/faq/#project-deployment-and-end-user-installation)
# Are admin privileges required to install the end-user component?
- [v19.0+](#19plus)
- [Versions below 19.0](#19min)
Yes, the Dynamic Web TWAIN Service installer is a `.msi` file which requires administrator privileges to install as the install target is `C:\Program Files (x86)`. Once the Dynamic Web TWAIN Service is installed with admin privileges, every user on that machine can has access to the Dynamic Web TWAIN Service.
If your organization does not allow end users to have admin privileges, you can contact [Dynamsoft Support](/_articles/about/getsupport.md) to get a special "User Installer" that does not require admin privileges.
The "User Installer", will install to the user's `C:\Users\{UserName}\AppData\Roaming\` folder.
For Web TWAIN versions lower than 19.3, please be aware that only one user per machine is able to have the service installed via this method. The service cannot be installed to multiple user profiles, and only the user that installs the Services in this manner will have access to the Dynamic Web TWAIN Service.
Yes, the Dynamsoft Service installer is a `.msi` file which requires administrator privileges to install as the install target is `C:\Windows\SysWOW64\`. Once the Dynamsoft Service is installed with admin privileges, every user on that machine can has access to the Dynamsoft Service.
If your organization does not allow end users to have admin privileges, you can contact [Dynamsoft Support](/_articles/about/getsupport.md) to get a special "User Installer" that does not require admin privileges.
The "User Installer", will install to the user's `C:\Users\{UserName}\AppData\Roaming\` folder. Please be aware that only one user per machine is able to have the service installed via this method. The service cannot be installed to multiple user profiles, and only the user that installs the Services in this manner will have access to the Dynamsoft Service.
---
title: Dynamic Web TWAIN SDK FAQ
description: Dynamic Web TWAIN SDK Documentation FAQ
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/index.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/index.md
---
# FAQ
## SDK Download/Free Trial
1. [How can I extend my free trial?](/_articles/faq/extend-free-trial.md)
2. [Where can I download an older version of the Dynamic Web TWAIN SDK?](/_articles/faq/download-older-version-sdk.md)
3. [Do you provide free trial versions of the Dynamic Web TWAIN SDK?](/_articles/faq/provide-free-trial-version.md)
4. [Can I run the scanning service on an ARM-based embedded device, such as Raspberry Pi?](/_articles/faq/run-on-arm-based-embedded-device.md)
5. [Do you also provide an SDK download for Linux and Mac developers?](/_articles/faq/sdk-download-for-linux-and-mac.md)
6. [Is the free trial version fully functional?](/_articles/faq/trial-fully-functional.md)
7. [Can I use the Dynamic Web TWAIN SDK to create a PWA application?](/_articles/faq/use-with-PWA.md)
## Capture/Image Source
1. [Download virtual scanner for testing](/_articles/faq/download-virtual-scanner-for-testing.md)
2. [What physical document scanners does the Dynamic Web TWAIN SDK support?](/_articles/faq/what-physical-scanners-are-supported.md)
3. [How can I verify if my physical document scanner works with the Dynamic Web TWAIN SDK?](/_articles/faq/verify-if-device-is-supported.md)
4. [How to use TWACKER to check if your device is TWAIN Compliant?](/_articles/faq/how-to-use-TWACKER-to-check-if-your-device-is-TWAIN-Compliant.md)
5. [How to test if your scanner supports ICA scanning on Mac OS?](/_articles/faq/how-to-test-if-your-scanner-supports-ICA-scanning-on-Mac-OS.md)
6. [How to test if your device is SANE compliant?](/_articles/faq/how-to-test-if-your-device-is-SANE-compliant.md)
7. [How to test if your camera is DirectShow compliant?](/_articles/faq/how-to-test-if-your-camera-is-DirectShow-compliant.md)
8. [Can I set scanning settings without using the default scanner's UI? What pre-scanning settings do you support?](/_articles/faq/setting-scan-settings-without-ui.md)
9. [Can I hide offline scanner devices from the select source list?](/_articles/faq/hide-offline-scanners-from-source-list.md)
10. [Can I hide webcam devices from the select source list?](/_articles/faq/hide-webcam-from-source-list.md)
11. [What are the differences between TWAIN and WIA?](/_articles/faq/difference-between-Twain-and-wia.md)
12. [How to exclude WIA sources in the source list?](/_articles/faq/how-to-exclude-wia-sources-in-the-source-list.md)
13. [How can I set the last selected source as the default source for an end user?](/_articles/faq/last-selected-sourcename.md)
14. [How can I limit all users to use a specific scanner model?](/_articles/faq/limit-to-specific-scanner.md)
15. [Can the Dynamic Web TWAIN SDK automatically remove blank pages during the document scanning process?](/_articles/faq/remove-blank-page-automatically.md)
16. [Can the Dynamic Web TWAIN SDK automatically rotate upside-down pages during the document scanning process?](/_articles/faq/automatically-rotate-upside-down-pages.md)
17. [Can the Dynamic Web TWAIN SDK automatically detect borders of the scanned document and crop it out?](/_articles/faq/automatically-detect-border.md)
18. [Can I set my document scanner to scan x number of pages instead of all pages from the automatic document feeder (ADF)?](/_articles/faq/scan-x-pages-from-automatic-document-feeder.md)
19. [Can the Dynamic Web TWAIN SDK detect whether papers exist on the flatbed?](/_articles/faq/detect-paper-on-flatbed.md)
20. [How can I get a list of supported resolution/DPI values from the document scanner?](/_articles/faq/list-supported-resolution-DPI.md)
21. [How can I use a custom capability of my scanner hardware when there is no direct API to set it?](/_articles/faq/custom-capability.md)
22. [Is there a limit on the number of pages I can scan at a time? Where do you store them after scanning?](/_articles/faq/limit-on-scanned-pages.md)
23. [Document scanning via the Dynamic Web TWAIN SDK is slower than using the native scanner application. How can I speed it up?](/_articles/faq/document-scanning-slow-than-native.md)
24. [Can I use built-in or USB webcam to capture document?](/_articles/faq/use-usb-webcam-to-capture.md)
25. [Can I import existing images or PDF documents using the Dynamic Web TWAIN SDK?](/_articles/faq/import-existing-documents-or-images.md)
26. [Can I download an image from a FTP or HTTP server using the Dynamic Web TWAIN SDK?](/_articles/faq/download-image-from-FTP-or-HTTP-server.md)
27. [How can I trigger an automatic workflow right after document scanning or image importing?](/_articles/faq/trigger-automatic-workflow-after-scanning.md)
28. [Do you support capturing documents from mobile cameras?](/_articles/faq/support-capture-from-mobile-camera.md)
29. [How to scan documents on mobile devices?](/_articles/faq/how-to-scan-documents-on-mobile-devices.md)
30. [Do you support fingerprint or medical imaging devices?](/_articles/faq/fingerprint-medical-imaging.md)
31. [Is the AcquireImage() method synchronous or asynchronous?](/_articles/faq/acquireimage-sync-or-async.md)
32. [Why is my scanner not shown or not responding in the browser?](/_articles/faq/scanner-not-shown-or-not-responding-in-the-browser.md)
33. [How can I support WIA scanner drivers in my application?](/_articles/faq/support-wia-scanner-drivers.md)
34. [Why are my images coming out distorted in MacOS Sonoma?](/_articles/faq/macos-sonoma-distorted-scans.md)
## Image Viewer
1. [Where is the image viewer object defined?](/_articles/faq/image-viewer-object-defined.md)
2. [Can the size of the image viewer auto resize when the browser window size changes?](/_articles/faq/viewer-size-auto-resize.md)
3. [How can I create a thumbnail viewer to view images?](/_articles/faq/create-thumbnail-viewer-to-navigate-images.md)
4. [How can I change the background color of the image viewer?](/_articles/faq/change-background-color.md)
5. [How can I reorder images in the viewer?](/_articles/faq/resort-images-in-viewer.md)
6. [How can I disable drag and drop images in the viewer?](/_articles/faq/disable-drag-and-drop-in-images.md)
7. [How can I show multiple images at a time?](/_articles/faq/show-multiple-images.md)
8. [How can I show page number on each image?](/_articles/faq/show-page-number.md)
9. [How can I resize the view of image (e.g. zoom in/out on an image)?](/_articles/faq/resize-view-of-image.md)
10. [What mouse click events does the viewer support?](/_articles/faq/mouse-click-events-supported.md)
11. [How can I insert an image after a selected image in the viewer?](/_articles/faq/insert-image-after-selected-image.md)
12. [Can I protect sensitive information of an image from being seen?](/_articles/faq/protect-sensitive-information.md)
13. [Can I hide the Dynamsoft image viewer and use my own image viewer?](/_articles/faq/hide-image-viewer.md)
14. [Can I print images from the viewer?](/_articles/faq/print-images-from-viewer.md)
15. [How to get the coordinates of the selected area on an image?](/_articles/faq/coordinates-of-selected-area.md)
## Image Editing
1. [What image editing operations does the Dynamic Web TWAIN SDK support?](/_articles/faq/what-image-editing-operation-supported.md)
2. [How can I show the default image editor tool?](/_articles/faq/show-default-image-editor.md)
3. [Do you support image deskew?](/_articles/faq/support-image-deskew.md)
4. [How can I configure all scanned images to conform to a specific size standard (e.g., A4)?](/_articles/faq/set-page-size.md)
5. [Can I add annotation to an image (e.g. add watermark or text)?](/_articles/faq/add-annotation-to-image.md)
6. [Can I change the resolution/DPI of an image in the viewer?](/_articles/faq/change-resolution-of-image.md)
7. [Can I convert a color image to grayscale or black & white?](/_articles/faq/convert-color-image-to-grayscale.md)
8. [Is there an undo functionality?](/_articles/faq/undo-functionality.md)
9. [How can I remove only the selected images?](/_articles/faq/remove-selected-images.md)
## UI Customization
1. [Is the UI of the Dynamic Web TWAIN SDK fully customizable? What cannot be customized?](/_articles/faq/is-ui-customizable.md)
2. [How can I change the display language of all messages from English to another language?](/_articles/faq/change-display-language.md)
3. [How can I change/hide the spinner which shows during document scanning?](/_articles/faq/change-hide-spinner.md)
4. [How can I change/hide the UI of the progress bar when importing or uploading images?](/_articles/faq/hide-progress-bars.md)
5. [Can I customize UI elements of the built-in image editor?](/_articles/faq/customize-ui-elements-of-image-editor.md)
6. [Can I stop the scanner from showing its default popup when there is a paper jam?](/_articles/faq/stop-default-scanner-popup.md)
7. [Why I cannot hide the loading bar (spinner)?](/_articles/faq/unable-hide-loading-bar.md)
## Document Saving
1. [What image and document formats can I save my documents as?](/_articles/faq/image-document-formats-save.md)
2. [What type of HTTP servers do your support? Do you support other server types?](/_articles/faq/http-servers-support.md)
3. [How can I enable HTTPS support?](/_articles/faq/enable-https-support.md)
4. [How can I get the smallest size of documents in PDF, TIFF or JPEG format?](/_articles/faq/smallest-size-documents.md)
5. [How can I send additional form fields with images to my server or database?](/_articles/faq/additional-form-fields.md)
6. [How can I automatically trigger actions when images arrive on my server side?](/_articles/faq/trigger-actions-server-side.md)
7. [Can I upload documents to a different website domain?](/_articles/faq/upload-documents-to-different-domain.md)
8. [How can I get a response string from my HTTP Server if the upload succeeds or fails?](/_articles/faq/response-string-from-server-on-upload.md)
9. [Can I upload documents via a background service outside the web browser?](/_articles/faq/upload-using-background-service.md)
10. [Can I insert newly scanned pages to an existing document?](/_articles/faq/insert-new-pages-to-existing-document.md)
11. [How can I upload a JSON file to my server?](/_articles/faq/upload-json-files-to-server.md)
12. [How can I save selected images instead of all images to my server or database?](/_articles/faq/save-selected-images-to-server.md)
13. [How to use a blank page as a separator?](/_articles/faq/use-blank-page-as-a-separator.md)
14. [How to upload multiple files at a time?](/_articles/faq/upload-multiple-files-at-a-time.md)
15. [How to deploy your own upload server with ASP.NET?](/_articles/faq/deploy-your-own-upload-server-with-asp.net.md)
16. [How to deploy your own upload server with JSP?](/_articles/faq/deploy-your-own-upload-server-with-jsp.md)
17. [How to deploy your own upload server with Node.js?](/_articles/faq/deploy-your-own-upload-server-with-node.js.md)
18. [How to deploy your own upload server with PHP?](/_articles/faq/deploy-your-own-upload-server-with-php.md)
## Security
1. [Where does the Dynamic Web TWAIN SDK store images on end-user machines? Are they encrypted?](/_articles/faq/where-images-are-stored.md)
2. [Can I prompt the end-user when the Dynamic Web TWAIN SDK attempts to visit any local resources (scanner, camera, or disk drive)?](/_articles/faq/prompt-end-user-when-local-resources-used.md)
3. [When are the locally cached images destroyed?](/_articles/faq/local-cached-images-destroyed.md)
4. [The license key is set in JavaScript. How can I protect it?](/_articles/faq/license-key-protection.md)
5. [Does the Dynamic Web TWAIN SDK use any deprecated technologies like NPAPI or ActiveX?](/_articles/faq/use-deprecated-technology.md)
6. [How can I securely transfer scanned documents to my server?](/_articles/faq/securely-transfer-to-server.md)
7. [Can I generate/load an encrypted file in PDF format?](/_articles/faq/encrypt-pdf-files.md)
8. [Can I limit the size of documents to be uploaded to my server?](/_articles/faq/limit-upload-size-to-server.md)
9. [Is the Dynamic Web TWAIN SDK ISO 27001 compliant?](/_articles/faq/iso-27001-compliant.md)
10. [Is the Dynamic Web TWAIN SDK GDPR compliant?](/_articles/faq/gdpr-compliant.md)
11. [Is the Dynamic Web TWAIN SDK HIPAA compliant?](/_articles/faq/hipaa-compliant.md)
12. [How can I change the certificate of the Dynamic Web TWAIN Service?](/_articles/faq/change-dynamsoft-service-certificate.md)
## Addon
1. [Do I need a separate license for each addon?](/_articles/faq/separate-license-for-addon.md)
2. [When do I need PDF Rasterizer Addon? Can I load existing PDF files into the Dynamic Web TWAIN SDK without the PDF Rasterizer addon?](/_articles/faq/when-is-pdf-rasterizer-needed.md)
3. [How can I load PDF/A files into the Dynamic Web TWAIN SDK?](/_articles/faq/load-pdf-files.md)
4. [Can I load specific page numbers of a PDF file into the viewer?](/_articles/faq/load-specific-page-of-pdf-to-viewer.md)
5. [Do I need the PDF Rasterizer addon to convert scanned documents to PDF files?](/_articles/faq/is-pdf-rasterizer-needed-to-convert-scanned-documents-to-pdf.md)
6. [How can I generate PDF/A files?](/_articles/faq/generate-pdf-files.md)
7. [Does your Barcode Reader addon support patch code?](/_articles/faq/does-barcode-addon-support-patch-code.md)
8. [How can I separate my documents automatically by barcode?](/_articles/faq/separate-documents-by-barcode.md)
9. [Is there any way to speed up the barcode reading process?](/_articles/faq/speed-up-barcode-reading-process.md)
10. [What types of webcams does the Webcam Capture addon support](/_articles/faq/webcam-supported-by-webcam-capture-addon.md)
11. [How can I prompt users for a password when loading a password-protected PDF?](/_articles/faq/prompt-password-for-protected-pdf.md)
## Project Deployment and End-user Installation
1. [What are the Resources files?](/_articles/faq/what-are-the-resources-files.md)
2. [What resources of the SDK should be included in my web application?](/_articles/faq/resources-to-be-included-in-SDK.md)
3. [How can I change the reference path to the Dynamsoft's resources in my project?](/_articles/faq/change-reference-path.md)
4. [What is Remote Scan and how do I enable it?](https://www.dynamsoft.com/remote-scan/docs/introduction/)
5. [How can I use Dynamic Web TWAIN in a Citrix environment?](/_articles/faq/use-dwt-in-citrix-env.md)
6. [Is there any component of the Dynamic Web TWAIN SDK that needs to be installed on end-user machines?](/_articles/faq/component-needs-to-be-installed-on-end-user-machine.md)
7. [What does the Dynamic Web TWAIN Service do on the end-user machine?](/_articles/faq/what-does-dynamsoft-service-do-on-end-user-machine.md)
8. [Are admin privileges required to install the end-user component?](/_articles/faq/admin-privileges-needed-to-install.md)
9. [Can I install Dynamic Web TWAIN Service silently?](/_articles/faq/can-i-install-dynamsoft-service-silently.md)
10. [Is there an easy way to deploy the end-user components to all users?](/_articles/faq/deploy-to-all-users.md)
11. [How to uninstall Dynamic Web TWAIN Service?](/_articles/faq/how-to-uninstall-dynamsoft-service.md)
12. [I have installed the Dynamic Web TWAIN Service on an end-user machine but still got asked to install it repeatedly. Why?](/_articles/faq/service-prompting-to-install-repeatedly.md)
13. [Dynamic Web TWAIN Service installation and uninstallation issue](/_articles/faq/service-installation-issue.md)
14. [Can I use two different websites integrated with two different versions of Dynamic Web TWAIN on the same computer?](/_articles/faq/service-backward-compatibility.md)
15. [How do I upgrade my project to use the latest version of the Dynamic Web TWAIN SDK?](/_articles/faq/upgrade-to-latest-version.md)
16. [How do I upgrade the end-user installation for all end users once I upgrade my project?](/_articles/faq/upgrade-end-user-installations.md)
17. [Can I still use Dynamic Web TWAIN on non-HTTPS (insecure HTTP) sites with Chrome?](/_articles/faq/http-insecure-websites-in-chromium-browser.md)
18. [How to resolve Dynamic Web TWAIN issue in Chrome 101?](/_articles/faq/private-network-access-in-chrome101.md)
19. [Dynamic Web TWAIN – Content-Security-Policy violated](/_articles/faq/content-security-policy-violated.md)
20. [Scanner source is listed on XSane application but not on my web application on Linux machines](/_articles/faq/source-not-listed-on-linux.md)
21. [How to run Dynamic Web TWAIN ActiveX in Microsoft Edge Internet Explorer (IE) mode](/_articles/faq/activeX-in-Edge-IE-mode.md)
22. [The scanner's UI or the system's file dialog does not open when scanning](/_articles/faq/service-is-blocked.md)
23. [How do I know which SDK version I am using?](/_articles/faq/find-SDK-version.md)
24. [Where can I download the Dynamic Web TWAIN Service installers only?](/_articles/faq/download-service-only.md)
25. [Error message - CORS Errors caused by local network access permissions when using Chromium 142 and later](/_articles/faq/chromium-142-local-network-access-issue.md)
26. [macOS Rosetta Discontinuation and Dynamic Web TWAIN Service](/_articles/faq/mac-rosetta-discontinuation.md)
## Error Troubleshooting
1. [General troubleshooting steps](/_articles/faq/general-troubleshooting-steps.md)
2. [General failure](/_articles/faq/general-failure.md)
3. [A connection with the server could not be established](/_articles/faq/connection-couldnt-be-established.md)
4. [HTTP request error](/_articles/faq/HTTP-request-error.md)
5. [HTTP process error](/_articles/faq/HTTP-process-error.md)
6. [Only 24-bit true color bmp and 8-bit gray-scaled images are supported for JPEG compression](/_articles/faq/JPEG-compression.md)
7. [XMLHttpRequest cannot load XXX](/_articles/faq/XMLHttpRequest-cannot-load.md)
8. [Source is connected to the maximum supported number of applications](/_articles/faq/source-connected-to-maximum.md)
9. [Sequence error](/_articles/faq/sequence-error.md)
10. [Request header field dwt-md5 is not allowed by Access-Control-Allow-Headers in preflight response](/_articles/faq/dwt-md5-is-not-allowed.md)
11. [The handle is in the wrong state for the requested operation](/_articles/faq/the-handle-is-in-the-wrong-state-for-the-requested-operation.md)
12. [The connection with the server was terminated abnormally](/_articles/faq/the-connection-with-the-server-was-terminated-abnormally.md)
13. [Syntax error – Unexpected Token "<"](/_articles/faq/syntax-error-unexpected-token.md)
14. [Uncaught ReferenceError - DVS is not defined](/_articles/faq/DVS-is-not-defined.md)
15. [Error message - The current product key does not support XXX, please contact the site administrator](/_articles/faq/error-message-current-product-key-does-not-support.md)
16. [Error message - The current product key does not support current OS for embed device, please contact the site administrator](/_articles/faq/error-message-product-key-does-not-support-current-os.md)
17. [Error message - The current product key is empty or invalid, please contact the site administrator](/_articles/faq/error-message-current-product-key-is-empty-or-invalid.md)
18. [Error message - The current product key is missing the core license, please contact the site administrator](/_articles/faq/error-message-product-key-is-missing-the-core-license.md)
19. [Error message - The domain of your current site does not match the domain bound in the current product key, please contact the site administrator](/_articles/faq/error-message-domain-of-site-doesnt-match-domain-bound-to-product-key.md)
20. [Error message - The current product key is invalid because it's generated with the licenses of a different major version](/_articles/faq/error-message-license-generated-with-license-of-major-version.md)
21. [Error message - The current product key is not for full/trial version, please contact the site administrator](/_articles/faq/error-message-product-key-is-not-for-full-version.md)
22. [Error message – Your Dynamic Web TWAIN product key expired](/_articles/faq/error-message-product-key-expired.md)
23. [Error Message - Failed to load resource: net::ERR\_CERT\_DATE\_INVALID](/_articles/faq/failed-to-load-resource.md)
24. [Error Message - The connection from the insecure (HTTP) web page to the local 'Dynamsoft Service' failed](/_articles/faq/connection-from-the-insecure-HTTP-to-service-failed.md)
25. [Error Message - Source has nothing to capture](/_articles/faq/source-has-nothing-to-capture.md)
26. [Warning Message - Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true](/_articles/faq/chrome-106-107-warning.md)
27. [Error Message - Uncaught TypeError: Cannot read properties of null (reading 'appendChild') or Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'](/_articles/faq/type-error-appendchild.md)
28. [Error Message - User cancelled the operation](/_articles/faq/error-message-user-cancelled-the-operation.md)
29. [The loading bar keeps spinning when capture the image with iPhone.](/_articles/faq/the-loading-bar-keeps-spinning-when-capture-the-image-with-iphone.md)
30. [How to debug on Dynamic Web TWAIN online demo?](/_articles/faq/debug-on-online-demo.md)
31. [Dynamic Web TWAIN prompts the .deb installer for Windows](/_articles/faq/incorrect-installer-for-windowsARM64.md)
32. [Why am I unable to load the TIFF file into Dynamic Web TWAIN?](/_articles/faq/unable-to-load-4-bit-tiff.md)
33. [Error message - CORS Errors caused by local network access permissions when using Chromium 142 and later](/_articles/faq/chromium-142-local-network-access-issue.md)
34. [Error message - File is Damaged and Can’t Be Opened in macOS](/_articles/faq/file-damaged-on-macos.md)
35. [Safari 26.2 Regression Causing Dynamic Web TWAIN v19.3 Auto-Reconnect Failure on macOS](/_articles/faq/safari-26-2-regression.md)
## Licensing and Purchase
1. [Is internet connectivity required to use all licenses?](/_articles/faq/is-internet-connectivity-required.md)
2. [Does the per-server license allow unlimited number of client devices and end users?](/_articles/faq/does-per-server-allow-unlimited.md)
3. [What license should I purchase if I am providing SaaS?](/_articles/faq/which-license-purchase-needed-for-saas.md)
4. [For the per-client-device licensing model, can seats taken by retired/unused devices be released from the license?](/_articles/faq/release-license-seats.md)
5. [Will a client machine take an additional license seat if its operating system is reinstalled?](/_articles/faq/seat-taken-if-os-reinstalled.md)
6. [What if I reach the limit of the granted number of license seats?](/_articles/faq/license-limit-reached.md)
7. [Do you offer lifetime/perpetual licenses?](/_articles/faq/offer-perpetual-license.md)
8. [Do I need to purchase a license for my dev or testing environment?](/_articles/faq/purchase-dev-or-test-license.md)
9. [I need to resell the SDK within my application to my customers. What options do you offer?](/_articles/faq/resell-sdk.md)
10. [Are you flexible to discuss custom licensing models?](/_articles/faq/flexible-to-custom-license.md)
11. [Do you have any local resellers from whom I can purchase a license of the Dynamic Web TWAIN SDK?](/_articles/faq/local-resellers.md)
12. [Do I get free upgrade if there is a newer version available?](/_articles/faq/free-upgrade.md)
13. [What is your discount policy?](/_articles/faq/discount-policy.md)
14. [What's your refund policy?](/_articles/faq/refund-policy.md)
## Annotation
1. [How can I add annotations to an image and then save/upload it?](/_articles/faq/dwt-with-annotation.md)
---
title: How can I prompt users for a password when loading a password-protected PDF?
description: How can I prompt users for a password when loading a password-protected PDF?
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/prompt-password-for-protected-pdf.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/prompt-password-for-protected-pdf.md
---
# Addon
## How can I prompt users for a password when loading a password-protected PDF?
Dynamic Web TWAIN does not provide a built-in password prompt UI for encrypted PDFs.
You need to handle the prompt and retry flow in your application code.
### Recommended workflow (`LoadImage()` / `LoadImageEx()`)
1. Call [`LoadImage()`](/_articles/info/api/WebTwain_IO.md#loadimage) or [`LoadImageEx()`](/_articles/info/api/WebTwain_IO.md#loadimageex).
2. In the failure callback, treat the error as "password required" only when either condition is true:
- (`errorCode` is `-1119` and `errorString` contains
`"Failed to read the PDF file because it's encrypted and the correct password is not provided."`)
- OR `errorCode` is `-1120`.
3. Prompt the user for a password.
4. Set the password via [`SetReaderOptions()`](/_articles/info/api/Addon_PDF.md#setreaderoptions).
5. Retry loading the same PDF.
### Helper function for password-required errors
Use this helper in both API-based loading and drag-and-drop handling:
```javascript
function isPasswordRequired(errorCode, errorString) {
return (
(errorCode === -1119 &&
(errorString || "").includes(
"Failed to read the PDF file because it's encrypted and the correct password is not provided.",
)) ||
errorCode === -1120
);
}
```
### `LoadImage()` / `LoadImageEx()` example
```javascript
function loadProtectedPdf(path, password) {
DWTObject.Addon.PDF.SetReaderOptions({ password: password || "" });
DWTObject.LoadImageEx(
path,
Dynamsoft.DWT.EnumDWT_ImageType.IT_PDF,
function () {
console.log("PDF loaded successfully.");
},
function (errorCode, errorString) {
if (!isPasswordRequired(errorCode, errorString)) {
console.error(errorCode, errorString);
return;
}
var userPassword = window.prompt(
"This PDF is password-protected. Please enter the password:",
"",
);
if (!userPassword) return;
loadProtectedPdf(path, userPassword);
},
);
}
```
### Drag-and-drop workflow (`OnPostLoad`)
Use [`OnPostLoad`](/_articles/info/api/WebTwain_IO.md#onpostload) and check `DWTObject.ErrorCode` / `DWTObject.ErrorString`.
```javascript
DWTObject.RegisterEvent("OnPostLoad", function (path, name, type) {
if (!isPasswordRequired(DWTObject.ErrorCode, DWTObject.ErrorString)) return;
var userPassword = window.prompt(
"This PDF is password-protected. Please enter the password:",
"",
);
if (!userPassword) return;
DWTObject.Addon.PDF.SetReaderOptions({ password: userPassword });
if (!path) {
alert("Password saved. Please drag and drop the file again.");
return;
}
var fullPath = path + "\\" + name;
loadProtectedPdf(fullPath, userPassword);
});
```
> [!NOTE]
> `-1119` can represent multiple PDF load issues, so do not use it alone.
> Starting in Dynamic Web TWAIN 19.4, encrypted-PDF load failures will use `-1120`.
>
> In `OnPostLoad`, `path` is empty for drag-and-drop files, so the code cannot directly retry with a file path.
> In this case, prompt for password, save it with `SetReaderOptions()`, and ask the user to drag and drop the file again.
---
title: macOS Rosetta Discontinuation and Dynamic Web TWAIN Service
description: Apple is phasing out Rosetta for Intel apps on Apple Silicon Macs. Learn how this affects the Dynamic Web TWAIN Service and what steps to take.
source_url:
html: https://www.dynamsoft.com/web-twain/docs/faq/mac-rosetta-discontinuation.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/faq/mac-rosetta-discontinuation.md
---
# Error Troubleshooting
## macOS Rosetta Discontinuation and Dynamic Web TWAIN Service
### Overview
Apple has announced that Rosetta support for Intel-based applications will be phased out in future macOS releases. Rosetta will remain fully available through macOS 27. Starting with macOS 28, Intel-only applications will no longer be supported.
Starting with macOS 26.4, users may also see system notifications warning that Intel-based applications will not be supported in future macOS versions.

### What is Apple’s timeline?
| macOS Version | Expected Availability | Rosetta Status |
|---|---|---|
| macOS 26.4+ | Already released | System notifications appear for Intel-only apps |
| macOS 27 | September 2026 | Rosetta remains fully functional — last version to support it |
| macOS 28 | 2027 | Intel-only apps will no longer run on Apple Silicon Macs |
For the official Apple announcement, see: [Using Intel-based apps on a Mac with Apple silicon — Apple Support](https://support.apple.com/en-us/102527)
### Does Dynamic Web TWAIN Service still work on macOS?
Yes. The current version of Dynamic Web TWAIN Service continues to function normally on supported macOS versions, including macOS 26 and macOS 27.
### What is Dynamsoft doing to address this?
Dynamsoft has released a Universal Binary version of Dynamic Web TWAIN Service with native Apple Silicon support.
**Dynamic Web TWAIN 19.4 is now available**, shipping the Universal Binary service installer that runs natively on Apple Silicon — no Rosetta required. This ensures full compatibility ahead of macOS 27.
### I'm on Dynamic Web TWAIN v18.x. Do I need to upgrade my SDK to v19.4+?
Not necessarily. The v19.4 service installer includes the **DWT 18.6 service module**, which is **backward compatible with DWT 18.x**. This means you can install the v19.4 Dynamic Web TWAIN Service on end-user machines to get Apple Silicon native support while continuing to use your existing v18.x SDK integration.
You do not need to change your application code or upgrade your JavaScript SDK to v19 just to resolve the Rosetta notification.
### Do end-users need to take any action now?
Yes. Now that Dynamic Web TWAIN 19.4 is available, we recommend upgrading the Dynamic Web TWAIN Service on end-user machines to get native Apple Silicon support and eliminate the macOS system notification about Intel-based apps. See the deployment section below for details.
### How do I deploy the updated service to end users?
The deployment process is the same as the current service. Download the v19.4 macOS service installer and distribute it to your end users. If you use silent installation or enterprise deployment methods, the process remains the same — only the installer binary changes.
For details on deployment options, see: [How to deploy the end-user components to all users](/_articles/faq/deploy-to-all-users.md)
### Do I need to renew my license or maintenance to get the update?
- **Active annual license or maintenance plan**: You are entitled to upgrade to v19.4 at no additional cost. Download and deploy the updated service installer now.
- **Perpetual license without active maintenance**: You will need to renew your maintenance plan to access the v19.4 release. Please contact [Dynamsoft Sales](https://www.dynamsoft.com/company/contact/) to discuss renewal options.
### Does this affect Intel-based Macs?
No. Intel-based Macs run Intel binaries natively without Rosetta. The current service installer continues to work on Intel-based Macs regardless of macOS version.
> Note: Apple has announced that macOS 26 is the last macOS release to support Intel-based Mac hardware.
---
title: Dynamic Web TWAIN SDK Features - Exporting Images
description: Dynamic Web TWAIN SDK Image Export Documentation
source_url:
html: https://www.dynamsoft.com/web-twain/docs/general-usage/image-export/index.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/general-usage/image-export/index.md
---
# Exporting Images
> Prerequisite: [DWT Initialization](/_articles/general-usage/initialization.md)
> Prerequisite: [Managing the Image Buffer](/_articles/general-usage/image-processing/buffer-management.md)
DWT provides a variety of simple methods to export data both externally (uploading to the server) and locally (i.e. within the web application to expose to other web components). DWT provides built-in APIs to support uploading scanned (and otherwise imported) images to the server via both `HTTP` and `FTP`. Locally, DWT can save images to the end user's file system in a many supported file formats. Read on for explanations and examples.
### Table of Contents
- [Uploading to the Web Server](/_articles/general-usage/image-export/server-upload.md)
- [Exporting Locally](/_articles/general-usage/image-export/local-export.md)
---
title: Dynamic Web TWAIN SDK Features - Exporting Locally
description: Dynamic Web TWAIN SDK Documentation Local Export
source_url:
html: https://www.dynamsoft.com/web-twain/docs/general-usage/image-export/local-export.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/general-usage/image-export/local-export.md
---
# Exporting Locally
> Prerequisite: [DWT Initialization](/_articles/general-usage/initialization.md)
> Prerequisite: [Managing the Image Buffer](/_articles/general-usage/image-processing/buffer-management.md)
DWT offers several methods to save images from the `WebTwain` image buffer locally. This includes saving the images to files on the end user's file system, exporting from the image buffer to binary Blobs and Base64 strings, and also printing to connected printers.
## Saving Locally
The `WebTwain` image buffer can output images directly to disk, and supports `BMP` , `JPG` , `TIF` , `PNG` and `PDF` formats. Of note, `TIF` and `PDF` come with multi-image support. Learn more about supported file formats [here]({{site.getstarted}}filetype.html).
Each file format has its own file saving API, as shown here:
- [`SaveAsBMP()`](/_articles/info/api/WebTwain_IO.md#saveasbmp)
- [`SaveAsJPEG()`](/_articles/info/api/WebTwain_IO.md#saveasjpeg)
- [`SaveAsPDF()`](/_articles/info/api/WebTwain_IO.md#saveaspdf)
- [`SaveAsPNG()`](/_articles/info/api/WebTwain_IO.md#saveaspng)
- [`SaveAsTIFF()`](/_articles/info/api/WebTwain_IO.md#saveastiff)
- [`SaveSelectedImagesAsMultiPagePDF()`](/_articles/info/api/WebTwain_IO.md#saveselectedimagesasmultipagepdf)
- [`SaveSelectedImagesAsMultiPageTIFF()`](/_articles/info/api/WebTwain_IO.md#saveselectedimagesasmultipagetiff)
- [`SaveAllAsPDF()`](/_articles/info/api/WebTwain_IO.md#saveallaspdf)
- [`SaveAllAsMultiPageTIFF()`](/_articles/info/api/WebTwain_IO.md#saveallasmultipagetiff)
Note that multi-page saving requires separate APIs from their single page counterparts.
## Exporting to Binary
The image buffer can export images as Blobs or Base64 strings, which are useful for processing images outside of DWT, whether for [custom image upload logic](/_articles/general-usage/image-export/server-upload.md), or other purposes within the web application.
### Exporting to Blob
[`ConvertToBlob()`](/_articles/info/api/WebTwain_IO.md#ConvertToBlob) converts selected images to a Blob, as demonstrated here:
``` javascript
DWTObject.ConvertToBlob(
[0, 1, 2],
Dynamsoft.DWT.EnumDWT_ImageType.IT_PDF,
function(result, indices, type) {
console.log(result.size);
},
function(errorCode, errorString) {
console.log(errorString);
}
);
```
APIs used:
- [`ConvertToBlob()`](/_articles/info/api/WebTwain_IO.md#ConvertToBlob)
- [`Dynamsoft.DWT.EnumDWT_ImageType`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_imagetype)
Here, `ConvertToBlob()` takes a zero-indexed array of image indices (of the image buffer) which indicates the images it exports, and uses the [`Dynamsoft.DWT.EnumDWT_ImageType`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_imagetype) enum to specify the file format (in this case, single-page PDF). Just as when saving to files locally, use the dedicated multi-page enums when saving multi-page `PDF`s and `TIF`s.
The Blob accessible through the `result` argument of the success callback.
### Exporting to Base64 String
Likewise, [`ConvertToBase64()`](/_articles/info/api/WebTwain_IO.md#converttobase64) outputs a Base64 string:
``` javascript
DWTObject.ConvertToBase64(
[0, 1, 2],
Dynamsoft.DWT.EnumDWT_ImageType.IT_PDF,
function(result, indices, type) {
console.log(result.getData(0, result.getLength()));
},
function(errorCode, errorString) {
console.log(errorString);
}
);
```
APIs used:
- [`ConvertToBase64()`](/_articles/info/api/WebTwain_IO.md#converttobase64)
- [`Dynamsoft.DWT.EnumDWT_ImageType`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_imagetype)
The Base 64 string accessible through the `result` argument of the success callback. Note that this is a [Base64Result](/_articles/info/api/interfaces.md#base64result) object.
## Print
Finally, DWT can also print directly to a printer through the [ `Print()` ](/_articles/info/api/WebTwain_IO.md#print) API. This API brings all images from the image buffer into the browser's print dialog. Alternatively, while running on Windows, the API can also take an argument to use the Windows OS print dialog instead.
---
title: Dynamic Web TWAIN SDK Features - Uploading Images to Web Server
description: Dynamic Web TWAIN SDK Documentation Output Page
source_url:
html: https://www.dynamsoft.com/web-twain/docs/general-usage/image-export/server-upload.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/general-usage/image-export/server-upload.md
---
# Uploading Images to the Web Server
> Prerequisite: [DWT Initialization](/_articles/general-usage/initialization.md)
> Prerequisite: [Managing the Image Buffer](/_articles/general-usage/image-processing/buffer-management.md)
DWT contains data upload APIs that allow uploading to web servers with just a few lines of code. DWT supports uploading via both `HTTP` and `FTP`.
## Uploading over `HTTP`
DWT provides a variety of built-in `HTTP ` upload APIs. Here, we demonstrate using [`HTTPUpload()`](/_articles/info/api/WebTwain_IO.md#httpupload)to upload all
### Sample Code
```html
```
APIs used:
- [`RegisterEvent()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent)
- [`OnWebTwainReady`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#onwebtwainready)
- [`SelectSourceAsync()`](/_articles/info/api/WebTwain_Acquire.md#selectsourceasync)
- [`AcquireImageAsync()`](/_articles/info/api/WebTwain_Acquire.md#acquireimageasync)
- [`IfCloseSourceAfterAcquire`](/_articles/info/api/Device.md#deviceobjectacquireimage)
- [`SelectAllImages()`](/_articles/info/api/WebTwain_Buffer.md#selectallimages)
- [`SelectedImagesIndices`](/_articles/info/api/WebTwain_Buffer.md#selectedimagesindices)
- [`HTTPUpload()`](/_articles/info/api/WebTwain_IO.md#httpupload)
- [`HTTPPort`](/_articles/info/api/WebTwain_IO.md#httpport)
- [`IfSSL`](/_articles/info/api/WebTwain_IO.md#ifssl)
- [`Dynamsoft.DWT.EnumDWT_UploadDataFormat`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_uploaddataformat)
- [`Dynamsoft.DWT.EnumDWT_ImageType`](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_imagetype)
### Explanation
This sample uploads the scanned images to the server as a PDF in binary form, and hands the data off to the server for further processing. Note that the upload handler script (here `https://demo.dynamsoft.com/sample-uploads/`) must be defined in order to receive the data accordingly, but is otherwise language- and logic-agnostic. Read our [server-side scripting guide](/_articles/general-usage/server-side-scripting.md) for more information.
We use [`HTTPUpload()`](/_articles/info/api/WebTwain_IO.md#httpupload) to perform the following tasks:
> Note: Only `PDF` and `TIF` support multi-page documents. When using other image formats, `HTTPUpload()` can only upload one image per API call - it will fail when selecting more than one image.
- Target images in the buffer specified by the `indices` array for uploading.
- We can only use more than one index when the target image format is `PDF` or `TIF`.
- Encode the images in the image format specified by `type`. In this case, we call it with the `Dynamsoft.DWT.EnumDWT_ImageType.IT_PDF` enum to encode to PDF.
- This API supports `BMP` , `JPG` , `TIF` , `PNG` and `PDF` formats. Learn more about supported file formats [here]({{site.getstarted}}filetype.html).
- Only `TIF`s and `PDF`s support multi-page files, and they use the `Dynamsoft.DWT.EnumDWT_ImageType.IT_TIF` and `Dynamsoft.DWT.EnumDWT_ImageType.IT_PDF` values, respectively.
- Convert the encoded images into a type specified by the `Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary` (either binary or Base64 strings). In this case we convert to binary.
- Create an HTTP Form and perform an asynchronous HTTP (Ajax) request to send the form to the server-side script at the location specified by `url`.
- Wait for the confirmation from the server, then execute the callback.
- Note that `HTTPUpload()` appends the correct file extension to the file name if it does not detect the correct ending in the `fileName` argument. For example, passing `example.jpg` for a `PDF` results in the file `example.jpg.pdf`, whereas passing the correct `example.pdf` in the first place will not result in changes to the file name.
Before calling `HTTPUpload()`, we first select all images in the buffer using `SelectAllImages()`. `HTTPUpload()` receives the full list of image indices from `SelectedImagesIndices`.
Also, note that `HTTPUpload()` supports `HTTPS` when there is an SSL certificate. In this case, the sample upload site supplies an SSL certificate, so we enable `HTTPS` with `Dynamsoft.DWT.IfSSL = true`. (the default value is `false`)
DWT provides other `HTTP` uploading APIs as well, such as for specifically uploading multi-page PDFs, or for uploading via `HTTP` post requests, among others. Read more about them in detail in our [API reference](/_articles/info/api/WebTwain_IO.md).
### Using Existing Upload Logic with DWT
We can also continue to use existing AJAX-style upload logic to upload images from DWT. The following example block assumes the existing logic is AJAX and uses [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData):
``` javascript
function uploadThroughAJAX(imageBufferIndices, fileFormat) {
DWTObject.ConvertToBlob(
imageBufferIndices,
fileFormat,
function(result, _indices, fileFormat) {
var url = "https://YOUR-SITE:PORT/PATH/TO/SCRIPT.aspx";
var fileName = "SampleFile" + getExtension(fileFormat);
var formData = new FormData();
formData.append('RemoteFile', result, fileName);
var response = await fetch(url, {method: "POST", body: formData});
// Check response
},
function(errorCode, errorString) {
console.log(errorString);
}
);
}
function getExtension(fileFormat) {
switch (fileFormat) {
case Dynamsoft.DWT.EnumDWT_ImageType.IT_BMP:
return ".bmp";
case Dynamsoft.DWT.EnumDWT_ImageType.IT_JPG:
return ".jpg";
case Dynamsoft.DWT.EnumDWT_ImageType.IT_TIF:
return ".tif";
case Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG:
return ".png";
case Dynamsoft.DWT.EnumDWT_ImageType.IT_PDF:
return ".pdf";
default:
return ".unknown";
}
}
```
APIs used:
- [`ConvertToBlob()`](/_articles/info/api/WebTwain_IO.md#converttoblob)
#### Explanation
The only DWT API used in this example is [`ConvertToBlob()`](/_articles/info/api/WebTwain_IO.md#converttoblob), which takes care of file format encoding and binary conversion of the images, with a given array of image buffer indices and a file format enum.
## Uploading over FTP
Aside from `HTTP`, DWT also supports `FTP`, which is much simpler to use. The [`FTPUpload()`](/_articles/info/api/WebTwain_IO.md#ftpupload) is used to upload a single image like so:
``` javascript
DWTObject.FTPUserName = 'username';
DWTObject.FTPPort = 21;
DWTObject.FTPPassword = 'password';
DWTObject.FTPUpload(
'192.168.8.222', //The FTP Host
imageIndex,
'test.pdf', // The path & name of the file
function () { console.log('Successful FTP upload'); },
function (errorCode, errorString) { console.log('Failed FTP upload'); }
);
```
APIs used:
- [ `FTPUserName` ](/_articles/info/api/WebTwain_IO.md#ftpusername)
- [ `FTPPort` ](/_articles/info/api/WebTwain_IO.md#ftpport)
- [ `FTPPassword` ](/_articles/info/api/WebTwain_IO.md#ftppassword)
- [ `FTPUpload()` ](/_articles/info/api/WebTwain_IO.md#ftpupload)
Note that the FTP port (and credentials) are set using `WebTwain` instance properties, unlike the host address which is passed as an argument.
DWT provides other HTTP upload APIs, for example, to better handle multi-page files (in the case of `TIF` and `PDF` formats). Please read more in our [API reference](/_articles/info/api/WebTwain_IO.md).
## `FileUploader`
The `FileUploader` is a special feature that uploads files using the Dynamic Web TWAIN Service, rather than directly from the web application. This is useful for uploading large amounts of data which may otherwise degrade browser performance. Here is a quick run-down of its operation:
1. `Dynamic Web TWAIN` will prepare the file to upload with the method [ `GenerateURLForUploadData()` ](/_articles/info/api/WebTwain_Util.md#generateurlforuploaddata)
2. Create a File Uploader instance with the method [ `Init()` ](/_articles/info/api/Dynamsoft_FileUploader.md#init)
3. Create an upload job with [ `CreateJob()` ](/_articles/info/api/Dynamsoft_FileUploader.md#createjob)
- Define the target URL [ `ServerUrl` ](/_articles/info/api/Dynamsoft_FileUploader.md#serverurl)
- Define the upload content [ `SourceValue` ](/_articles/info/api/Dynamsoft_FileUploader.md#sourcevalue)
- (Optional) Define callback functions [ `OnUploadTransferPercentage` ](/_articles/info/api/Dynamsoft_FileUploader.md#onuploadtransferpercentage) , [ `OnRunSuccess` ](/_articles/info/api/Dynamsoft_FileUploader.md#onrunsuccess), [ `OnRunFailure` ](/_articles/info/api/Dynamsoft_FileUploader.md#onrunfailure)
4. Run the job
5. Wait for the confirmation from the server
Check out how to use the Uploader in the following code snippets
``` html
```
Check out [Server-side Scripting](/_articles/general-usage/server-side-scripting.md) for more information on the target URL.
---
title: Dynamic Web TWAIN SDK Basics - Managing the Image Buffer
description: Dynamic Web TWAIN SDK General Usage Guide - Managing the Image Buffer
source_url:
html: https://www.dynamsoft.com/web-twain/docs/general-usage/image-processing/buffer-management.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/general-usage/image-processing/buffer-management.md
---
# Managing the Image Buffer
> Prerequisite: [DWT Initialization](/_articles/general-usage/initialization.md)
Images scanned by a `WebTwain` instance are stored inside the `WebTwain`'s image buffer, which stores images in memory in the `DIB` format. This guide explains commonly-used features to manipulate the data, from reordering pages, to retrieving metadata, and more.
## Querying Buffer Status
The first step in managing the buffer is to examine its state. Images in the buffer can be identified both with its index (which may change over time), or by its image ID, which is immutable once an image enters the buffer. These buffer state querying APIs are typically used in conjunction with other buffer APIS, such as image reordering and image tagging, which we will come to discuss.
- [`DWTObject.HowManyImagesInBuffer`](/_articles/info/api/WebTwain_Buffer.md#howmanyimagesinbuffer) holds the number of images in the buffer of the `WebTwain` instance.
- [`MaxImagesInBuffer`](/_articles/info/api/WebTwain_Buffer.md#maximagesinbuffer) controls the maximum number of images allowed within the buffer. The default value is 32767.
- [`DWTObject.CurrentImageIndexInBuffer`](/_articles/info/api/WebTwain_Buffer.md#currentimageindexinbuffer) returns the index of the currently active image (which is also the one being displayed by the `Viewer`). This property can also be used to **set** the active image by setting it to a different index.
- [`IndexToImageID(imageIndex)`](/_articles/info/api/WebTwain_Buffer.md#indextoimageid) and [ `ImageIDToIndex(imageID)` ](/_articles/info/api/WebTwain_Buffer.md#imageidtoindex) can get the image ID (a string) of an image at a given position in the buffer index (a number), and vice versa.
- Images in the buffer also have an internal URL with which they can be referenced (in [desktop browsers only]({{site.getstarted}}platform.html#browsers-on-desktop-devices)). This comes in two flavors:
- [`GetImageURL(imageIndex)`](/_articles/info/api/WebTwain_Buffer.md#getimageurl) retrieves the URL of the image at the specified index using the `https://` scheme. This is useful to display images outside the `WebTwain` `Viewer`.
- [`GetImagePartURL(imageIndex)`](/_articles/info/api/WebTwain_Buffer.md#getimageparturl) retrieves the URL of the image at the specified index, but using the `dwt://` scheme, which can only be used by other DWT APIs.
- [`GetSkewAngle(imageIndex)`](/_articles/info/api/WebTwain_Buffer.md#getskewangle) estimates the skew angle of scanned documents in degrees. This can be used to de-skew scanned images, which may be useful for last minute touch-ups. (see image rotation in our [image editing guide](/_articles/general-usage/image-processing/image-editing.md#example---rotating-images))
- [`GetSkewAngleEx(imageIndex, leftmost, topmost, rightmost, bottommost)`](/_articles/info/api/WebTwain_Buffer.md#getskewangleex) calculates the skew angle of a rectangle (specified by its outermost pixel coordinates) within the image. This feature is only supported in [desktop browsers]({{site.getstarted}}platform.html#browsers-on-desktop-devices).
Some buffer management APIs work on images that have been "selected", for example, calculating the disk space required by selected images. The user may also select images through the `Viewer` interface, which also visually indicates selected images. The selection APIs are described below:
- [`SelectImages(indexArray)`](/_articles/info/api/WebTwain_Buffer.md#selectimages) selects images using an array of image indices. Note that there is no dedicated API for selecting a single image, so we use the form `SelectImages([singleImageIndex])` instead.
- [`SelectAllImages()`](/_articles/info/api/WebTwain_Buffer.md#selectallimages) selects all the images in the buffer.
- [`SelectedImagesIndices`](/_articles/info/api/WebTwain_Buffer.md#selectedimagesindices) is a read-only array containing the indices of the currently selected images.
## Reordering Images
The `WebTwain` instance provides a set of simple buffer reordering APIs to move images around. Note that users also have the option to click and drag images in the `Viewer` to reorder images as well. The following sample demonstrates moving images, switching images, and removing images in the buffer.
### Sample Code
```html
```
APIs used:
- [`Dynamsoft.DWT.RegisterEvent()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent)
- [`Dynamsoft.DWT.GetWebTwain()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#getwebtwain)
- [`OnWebTwainReady`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#onwebtwainready)
- [`cursor`](/_articles/info/api/WebTwain_Viewer.md#cursor)
- [`setViewMode()`](/_articles/info/api/WebTwain_Viewer.md#setviewmode)
- [`AcquireImageAsync()`](/_articles/info/api/WebTwain_Acquire.md#acquireimageasync)
- [`IfCloseSourceAfterAcquire`](/_articles/info/api/Device.md#deviceobjectacquireimage)
- [`MoveImage()`](/_articles/info/api/WebTwain_Buffer.md#moveimage)
- [`SwitchImage()`](/_articles/info/api/WebTwain_Buffer.md#switchimage)
- [`RemoveImage()`](/_articles/info/api/WebTwain_Buffer.md#removeimage)
- [`RemoveAllImages()`](/_articles/info/api/WebTwain_Buffer.md#removeallimages)
- [`HowManyImagesInBuffer`](/_articles/info/api/WebTwain_Buffer.md#howmanyimagesinbuffer)
- [`SelectImages()`](/_articles/info/api/WebTwain_Buffer.md#selectimages)
- [`RemoveAllSelectedImages()`](/_articles/info/api/WebTwain_Buffer.md#removeallselectedimages)
### Explanation
After scanning a few images using DWT, the user can use buttons to move images around within the buffer. These APIs identify images using their indices within the buffer (zero-indexed). These APIs return their success state upon completion, as they do not support success callbacks. Note that this sample wraps the API to check for the number of images within the buffer before attempting to move images. This prevents moving or selecting invalid indices.
For illustration purposes, we set the `Viewer` to show multiple images at a time, and changed the cursor shape for this sample.
## Tagging Images
DWT can tag images for custom grouping, sorting, and other data management tasks, using the [TagImages()](/_articles/info/api/WebTwain_Buffer.md#tagimages) API. Tags are strings associated with images for identification purposes. Images may have multiple tags as well.
### Setting Tags
For example, we may tag individual images with the "title" tag to identify title pages with [TagImages()](/_articles/info/api/WebTwain_Buffer.md#tagimages), like so:
```javascript
DWTObject.TagImages([0, 1], "title");
```
This applies the tag to the first and second images in the buffer (zero-indexed). If image indices are not known ahead of time, it's also useful to apply the tag to the currently displayed image in the viewer, via the [`CurrentImageIndexInBuffer`](/_articles/info/api/WebTwain_Buffer.md#currentimageindexinbuffer) property. This allows the user to tag the image upon inspection.
```javascript
DWTObject.TagImages([DWTObject.CurrentImageInBuffer], "title");
```
Rather than applying tags to existing images, it is possible to tag images as they enter the buffer via [SetDefaultTag()](/_articles/info/api/WebTwain_Buffer.md#setdefaulttag). By changing the default tag in reaction to application state, the web application can create rich image tagging logic:
```javascript
DWTObject.SetDefaultTag("title");
```
Every image entering the buffer after this will automatically receive this tag.
### Organizing Images with Tags
Tags are only useful if they can be interacted with. Once images have been tagged, we can filter them by their tags. For example, a user may need to display only the title pages for preview purposes. Once title pages have been tagged (either as they were scanned or after the fact), we can use [FilterImagesByTag()](/_articles/info/api/WebTwain_Buffer.md#filterimagesbytag) to selectively display just the title pages:
```javascript
DWTObject.FilterImagesByTag("title");
```
Once the user finishes with the preview, DWT can revert to displaying all images by clearing the filter with [ClearFilter()](/_articles/info/api/WebTwain_Buffer.md#clearfilter):
```javascript
DWTObject.ClearFilter();
```
Be sure to visit our [buffer API reference](/_articles/info/api/WebTwain_Buffer.md) to learn more about various tagging features.
## Organizing Images with Documents
Documents are another way to organize images within the image buffer. We may create multiple documents to group images, but unlike tags, images can each only belong to one document. Documents also preserve image order. First, we create a document with [CreateDocument()](/_articles/info/api/WebTwain_Buffer.md#createdocument):
```javascript
DWTObject.CreateDocument("documentName");
```
To add images into the document, we first open the document with [OpenDocument()](/_articles/info/api/WebTwain_Buffer.md#opendocument), and specifying the document by name:
```javascript
DWTObject.OpenDocument("documentName");
```
Subsequently, all images entering the buffer will belong to this document. Only one document may be open at a time - opening another document would close the previously open one.
We may also move images after they have entered documents, for example, to copy images from one document to another with [CopyToDocumentAsync()](/_articles/info/api/WebTwain_Buffer.md#coppytodocumentasync):
```javascript
DWTObject.CopyToDocumentAsync("sourceDocumentName", "destinationDocumentName", sourceIndices, targetIndex)
```
Which copies the selected images from `sourceDocumentName` with `sourceIndices` and moves them to the destination at the `targetIndex`. This API has a few overloads to specify targets and sources in different ways, refer to our [documentation](/_articles/info/api/WebTwain_Buffer.md#coppytodocumentasync) for more details.
DWT also provides other document-related APIs, check them out in our [buffer API reference](/_articles/info/api/WebTwain_Buffer.md).
## Querying Image Data
DWT provides APIs to quickly retrieve image metadata. The following retrieves data for an image at the specified buffer index:
* Pixel bit depth: [`GetImageBitDepth(imageIndex)`](/_articles/info/api/WebTwain_Buffer.md#getimagebitdepth)
* Image pixel height: [`GetImageHeight(imageIndex)`](/_articles/info/api/WebTwain_Buffer.md#getimageheight)
* Image pixel width: [`GetImageWidth(imageIndex)`](/_articles/info/api/WebTwain_Buffer.md#getimagewidth)
* Horizontal image resolution (in DPI): [`GetImageXResolution(imageIndex)`](/_articles/info/api/WebTwain_Buffer.md#getimagexresolution)
* Vertical image resolution (in DPI): [`GetImageYResolution(imageIndex)`](/_articles/info/api/WebTwain_Buffer.md#getimageyresolution)
Additionally, the following APIs used calculate image sizes are only supported by [desktop browsers]({{site.getstarted}}platform.html#browsers-on-desktop-devices):
* Calculate the number of bytes the image would take up when resized to the specified dimensions: [ `GetImageSize(imageIndex, width, height)` ](/_articles/info/api/WebTwain_Buffer.md#getimagesize)
* Calculate the number of bytes the image would take up upon conversion to a specific image format: [ `GetImageSizeWithSpecifiedType(imageIndex, imageType)` ](/_articles/info/api/WebTwain_Buffer.md#getimagesizewithspecifiedtype)
* Refer to [Dynamsoft.DWT.EnumDWT_ImageType](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_imagetype) for image formats.
* Calculate the total number of bytes of all selected images given an expected file format: [ `GetSelectedImagesSize(imageType)` ](/_articles/info/api/WebTwain_Buffer.md#getselectedimagessize)
* Refer to [Dynamsoft.DWT.EnumDWT_ImageType](/_articles/info/api/Dynamsoft_Enum.md#dynamsoftdwtenumdwt_imagetype) for image formats.
* Images must first be selected by index via [SelectImages()](/_articles/info/api/WebTwain_Buffer.md#selectimages). There must be at least one image selected for a valid call to `GetImageSize()`.
## Detecting Blank Pages
The buffer also comes with a set of APIs specifically to detect blank pages:
- [`IsBlankImage(imageIndex)`](/_articles/info/api/WebTwain_Buffer.md#isblankimage) determines whether or not the given page is blank. This is relatively accurate.
- [`IsBlankImageExpress(imageIndex)`](/_articles/info/api/WebTwain_Buffer.md#isblankimageexpress) detects whether or not the given page is blank, but it trades worse accuracy for higher speed.
- [`IsBlankImageAsync(imageIndex, { minBlockHeight, maxBlockHeight })`](/_articles/info/api/WebTwain_Buffer.md#isblankimageasync) can optionally detect blank pages with a certain tolerance for markings within the specified size range.
> Tip: At times, blank page detection APIs will still fail to detect some pages as blank. We can loosen the detection tolerance by reading [`BlankImageCurrentStdDev`](/_articles/info/api/WebTwain_Buffer.md#blankimagecurrentstddev) to get the tolerance for the current image, then increasing the tolerance by setting a new value for the [`BlankImageMaxStdDev`](/_articles/info/api/WebTwain_Buffer.md#blankimagemaxstddev) property. Note that the first property is read-only for safety reasons.
## Using Buffer Event Callbacks
The image buffer provides event callbacks which can be used to customize buffer behavior. Listeners can be attached to these events via the `WebTwain` object's [RegisterEvent()](/_articles/info/api/WebTwain_Util.md#registerevent) API. Note that this is distinct from the global [RegisterEvent()](/_articles/info/api/Dynamsoft_WebTwainEnv.md#registerevent) which is called from `Dynamsoft.DWT`.
- [`OnBufferChanged`](/_articles/info/api/WebTwain_Buffer.md#onbufferchanged) triggers whenever the state of the buffer changes. The details on how the buffer changes are provided in [`BufferChangeInfo`](/_articles/info/api/interfaces.md#bufferchangeinfo):
```javascript
DWTObject.RegisterEvent('OnBufferChanged',
function (bufferChangeInfo: BufferChangeInfo) {
}
): boolean;
```
- [`OnBitmapChanged`](/_articles/info/api/WebTwain_Buffer.md#onbitmapchanged) triggers whenever image data changes. Specifically, when:
- an image enters the buffer
- an image is removed from the buffer
- an image image in the buffer is edited
* [`OnTopImageInTheViewChanged`](/_articles/info/api/WebTwain_Buffer.md#ontopimageintheviewchanged) triggers when the first image visible in the `Viewer` changes. (The viewer may be configured to show more than one image at a time, see the [`Viewer` guide](/_articles/general-usage/viewer-configuration.md) for details).
```javascript
DWTObject.RegisterEvent(
'OnBitmapChanged',
function(
updatedIndices,
operationType,
currentIndex) {
console.log(updatedIndices);
}
)
```
* [ `OnIndexChangeDragDropDone` ](/_articles/info/api/WebTwain_Buffer.md#onindexchangedragdropdone) triggers when the user reorders images by dragging them around using the `Viewer`.
These events are useful for enhancing and customizing the graphical user experience.
---
title: Dynamic Web TWAIN SDK Basics - Editing Images
description: Dynamic Web TWAIN SDK General Usage Guide - Image Editing
source_url:
html: https://www.dynamsoft.com/web-twain/docs/general-usage/image-processing/image-editing.html
md: https://github.com/dynamsoft-docs/web-twain-docs/blob/master/_articles/general-usage/image-processing/image-editing.md
---
# Editing Images
> Prerequisite: [DWT Initialization](/_articles/general-usage/initialization.md)
> Prerequisite: [Managing the Image Buffer](/_articles/general-usage/image-processing/buffer-management.md)
DWT provides a wide range of common image editing features to modify scanned documents in web applications. The editing APIs are straight-forward for developers to implement rich editing features.
## Example - Rotating Images
We first demonstrate the use of our image rotation API, which allows users to rotate scanned images and immediately view the results in the `Viewer`. We also provide a list of other editing APIs which can be easily substituted into the sample shown below.
### Sample Code
```html