This package has been deprecated

Author message:

Package no longer supported. Contact Support at for more info.

TypeScript icon, indicating that this package has built-in type declarations

18.0.3 • Public • Published

Dynamic Web TWAIN Mobile Web Capture SDK

version downloads jsdelivr

Dynamic Web TWAIN Mobile Web Capture SDK is a web document capture SDK for iOS and Android browsers. It is designed for developers to build document scanning web applications for mobile users to load, edit, save, upload files, and capture images from the camera right in mobile browsers.

To see it in action, please visit this online demo.

Note: Dynamic Web TWAIN SDK v18.0 is built in this package.

Table of Contents

Supported Environments

Supported Mobile Web Browsers

  • Chrome
  • Edge
  • Safari

Supported OSs

  • Android
  • iOS

License Key


  • Packages from the official website

    Dynamic Web TWAIN SDK

  • NPM

    npm install mobile-web-capture


Dynamic Web TWAIN relies on the files in the /dist/ folder to work. Make sure to put these files on your server and correctly refer to them by specifying the path with ResourcesPath (relative and absolute paths are both okay).

Quick Start

Step 1. Create an HTML page and load dynamsoft.webtwain.min.js into your page:

<!DOCTYPE html>
 <title>Hello World</title>
 <script src="dist/dynamsoft.webtwain.min.js"></script>

Note that a relative path is used. You might want to change it based on where you are putting your code. The best practice is to put all the files on your own server and under the same domain as your web application.

Step 2. Add a script tag and make initial settings:

<!DOCTYPE html>
 <title>Hello World</title>
 <script src="dist/dynamsoft.webtwain.min.js"></script>
 <script type="text/javascript">
   //Dynamsoft.DWT.ProductKey = "YOUR-PRODUCT-KEY";  // Put your own key here
   Dynamsoft.DWT.ResourcesPath = "dist";
   Dynamsoft.DWT.Containers = [{ ContainerId: 'dwtcontrolContainer', Width: 270, Height: 350 }];
   Dynamsoft.DWT.UseLocalService = false;

Note that ResourcesPath must be set in order to use the library.

  1. ResourcesPath is a relative path to where you put the directory "/dist/" and all the files in it.
  2. If you don't have a valid ProductKey, you can request a trial key to use.
  3. To better use the mobile web capture, the UseLocalService must be set to false.

Step 3. Write code to use the package to do a simple document scan

The following code demonstrates the minimum code needed to use the package. Note the addition of HTML elements as well as JavaScript code. For more sophisticated sample or demo, check out our Github Repositories.

<!DOCTYPE html>
 <title>Hello World</title>
 <script src="dist/dynamsoft.webtwain.min.js"></script>
 <input type="button" value="Scan" onclick="ScanDocument();" />
 <div id="dwtcontrolContainer"></div>
 <script type="text/javascript">
   //Dynamsoft.DWT.ProductKey = "YOUR-PRODUCT-KEY";  // Put your own key here
   Dynamsoft.DWT.ResourcesPath = "dist";
   Dynamsoft.DWT.Containers = [{ ContainerId: 'dwtcontrolContainer', Width: 370, Height: 450 }];
   Dynamsoft.DWT.UseLocalService = false;
   window.onload = function () {
   var DWObject;
   function Dynamsoft_OnReady() {
     // dwtcontrolContainer is the id of the DIV to create the WebTwain instance in.
     DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer');
   function ScanDocument() {
     var showVideoConfigs = {
           enableAutoDetect: true
     if (DWObject) {
       if(!DWObject.UseLocalService) {
           }, function (error) { 

Step 4. Configure the Server

  • Set the MIME type for .wasm as application/wasm on your webserver.

    The goal is to configure your server to send the correct Content-Type header for the wasm file so that it is processed correctly by the browser.

    Different types of webservers are configured differently, for example:

    • Apache
    • IIS
    • NGINX
  • Enable HTTPS

    To use the library, you must access your website / web application via a secure HTTPS connection. This is due to browser security restrictions which only grant camera video streaming access to a secure context.

For convenience, self-signed certificates can be used during development and testing.



Features Mobile
Document capture ✔️
Document edge detection ✔️
Document perspective correction ✔️
Document post-processing by filters ✔️
Front and rear camera switching ✔️
Dedicated image and PDF viewer ✔️
Built-in ready-to-use UI ✔️
SIMD and WebGL acceleration ✔️
Multi-Format export and sharing ✔️


Contact Us

Contact Dynamsoft to resolve any issue you encounter with the library.

License Agreement


Check out the release notes of the Dynamic Web TWAIN library.

Package Sidebar


npm i mobile-web-capture

Weekly Downloads






Unpacked Size

38.2 MB

Total Files


Last publish


  • ellie-dynamsoft