Dynamic Web TWAIN: How to enable remote scan

With Dynamic Web TWAIN v12 or above, it's possible to set up a Dynamic Web TWAIN service that can be accessed remotely from other computers or even mobile devices. To learn more about this feature, please refer to How "Remote Scan" Works in Dynamic Web TWAIN 12.0

The following are the steps to do this.

Step 1. Download and install version 12.x or above of Dynamic Web TWAIN on the machine that has a scanner connected.

To get a 30-day free trial version, please check this page. If you are an existing customer, please email sales@dynamsoft.com for a full version installer.

Step 2. Find a local sample to get started with.

For example, you can start with this local demo under C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN SDK 12.0 Trial\Samples\Scan\CustomScan.html

Step 3. Configure the following to enable the remote scanning feature.

  1. For v12.x, update the file DWTConfiguration.ini. It is typically under C:\Windows\SysWOW64\Dynamsoft\DynamicWebTwain\ForChrome\DWTConfiguration.ini
    Note: here we assume the machine has the IP 192.168.3.7.[DynamicWebTWAIN]
    LogLevel=6
    Port=18618
    PortSSL=18619
    Server=192.168.3.7
    EnableScannerAccessAuth=FALSE
    EnableFileAccessAuth=FALSE
    EnableWebcamAccessAuth=FALSE
  2. For v13.x, update the file DSConfiguration.ini. It is typically under C:\Windows\SysWOW64\Dynamsoft\DynamsoftService\DSConfiguration.ini
    Note: here we assume the machine has the IP 192.168.3.7.[DS]
    Server=192.168.3.7
    LogLevel=14
    Port_mn_0=dcp
    Port_mp_0=18625
    Port=3
    SSLPort_mn_0=dcp
    SSLPort_mp_0=18626
    SSLPort=3
    Port_mn_1=dcs
    Port_mp_1=18646
    SSLPort_mn_1=dcs
    SSLPort_mp_1=18647
    Port_mn_2=dwt
    Port_mp_2=18622
    SSLPort_mn_2=dwt
    SSLPort_mp_2=18623
  3. Find the service Dynamsoft WebTWAIN Service in Windows services list and restart it.
  4. In your code, use the method CreateDWTObject to create the Web TWAIN object to connect to the remote server like this
    Dynamsoft.WebTwainEnv.CreateDWTObject( 
      "dwtcontrolContainer", 
      "192.168.3.7", 18622, 18623,
      function(dwtObject){ 
        DWObject = dwtObject; 
        DWObject.Width = 750; 
        DWObject.Height = 600; }, 
      function(errorString){ 
        console.log(errorString); 
      } 
    ); 
    

Step 4. Modify your scan page code to better fit in the use in remote scanning.

Still take the "CustomScan.html" sample as an example, please remove the "Show UI" option and modify related JavaScript code.

<input type="checkbox" id="ShowUI" checked="checked">Show UI<br />

if (document.getElementById("ShowUI").checked)
DWObject.IfShowUI = true;
else
DWObject.IfShowUI = false;

Reason: if the Show UI is used for scanning, then when you scan from a remote web browser, the popup scanner UI dialog is actually shown on the host machine (where installs the web twain service and physically connects with scanners). You won't be able to see the dialog or close it remotely.  In fact, all popup dialogs from the scanner can't be controlled remotely.

Step 5. Deploy the web scan app to your web server (such as IIS).

Once done, you can access the scan page locally to see if the scanning is working fine. Then you can go on testing the scanning from a remote browser.

For any issues found, please report to support@dynamsoft.com.

 

Is this page helpful?

Leave a Reply

Your email address will not be published.