VintaSoft Twain .NET SDK v10.2
Acquire images from scanner in Internet Explorer using IEHost support

Internet Explorer allows to use .NET 2.0 managed controls in JavaScript. This allows to use VintaSoft Twain .NET SDK in a client-side (in JavaScript) of web application.

1. Acquisition of images from scanner

Acquisition of images from scanner (a TWAIN device) can be divided to the following steps:
  1. JavaScript: Web application creates an instance of DeviceManager class. Instance is necessary for acquiring images from scanner.
  2. JavaScript: Web application creates an instance of AcquiredImageCollection class if necessary. Instance is necessary for storing images acquired from scanner.
  3. JavaScript: Web application creates an instance of TwainImageEncoderSettingsFactory class if necessary. Instance is necessary for encoding acquired images.
  4. JavaScript: Web application creates an instance of HttpUpload class if necessary. Instance is necessary for uploading acquired images to a HTTP server.
  5. JavaScript: Web application creates an instance of FtpUpload class if necessary. Instance is necessary for uploading acquired images to a FTP server.
  6. JavaScript: Web application acquires images from scanner.
  7. JavaScript: Web application saves acquired images to a file or uploads acquired images to a HTTP or FTP server if necessary.

2. Demo applications

The AspNetTwainDemos project (located in the distributive package of VintaSoft Twain .NET SDK) contains the demo (WebTwainDemoWithIEHostSupport ASPX page) that demonstrates how to acquire images from scanner in Internet Explorer using IEHost support.


3. Deploying SDK with web application

Only Vintasoft.Twain.dll compiled under .NET 2.0 can be deployed with web application.
Vintasoft.Twain.dll compiled under .NET 4.0 cannot be used because .NET Framework 4.0 does not allow to use .NET controls in Internet Explorer (IEHost support is removed from .NET Framework 4.0).

3.1. System requirements for a server-side

  1. Web server based on Windows or Unix can be used.

On a server-side you should do the following:
  1. Place your web page onto the server.
  2. Place Vintasoft.Twain.dll file onto the server.
  3. Use the following code in your web page:
      <object id="TwainDeviceManager"
              codebase="http://your-server/path-on-server/Vintasoft.Twain.dll"
              classid="http://your-server/path-on-server/Vintasoft.Twain.dll#Vintasoft.Twain.DeviceManager"
              width="1" height="1">
        <param name="_Version" value="10,2,0,1" />
      </object>
    

    Correct version number of DLL is very important. With wrong version number your clients will download the assembly each time when they open your web page.

  4. The subfolder where you plan to store images must be granted write privileges to Everyone.
  5. Make sure that DLL file can be downloaded from the path you specified.

3.2. System requirements for a client-side

System requirements and installation-specific settings for client computer based on Windows XP or Vista, Windows Server 2003 (32-bit):
  1. .NET Framework 2.0 must be installed.
  2. Web site of web application must be added to trusted sites in security policy of .NET Framework 2.0 (32-bit).
  3. Internet Explorer 6.0 or higher must be used as browser.
  4. Web site of web application must be added to the Trusted Zone in Internet Explorer if IE 8.0 or higher is used.

System requirements and installation-specific settings for client computer based on Windows XP or Vista, Windows Server 2003 (64-bit):
  1. .NET Framework 2.0 must be installed.
  2. Web site of web application must be added to trusted sites in security policy of .NET Framework 2.0 (32-bit).
  3. Web site of web application must be added to trusted sites in security policy of .NET Framework 2.0 (64-bit).
  4. Internet Explorer 6.0 or higher must be used as browser.
  5. Web site of web application must be added to the Trusted Zone in Internet Explorer if IE 8.0 or higher is used.

System requirements and installation-specific settings for client computer based on Windows 7 or 8, Windows Server 2008 or 2012 (32-bit):
  1. .NET Framework 2.0 must be installed.
  2. Web site of web application must be added to trusted sites in security policy of .NET Framework 2.0 (32-bit).
  3. Internet Explorer 6.0 or higher must be used as browser.
  4. Web site of web application must be added to the Trusted Zone in Internet Explorer if IE 8.0 or higher is used.

System requirements and installation-specific settings for client computer based on Windows 7 or 8, Windows Server 2008 or 2012 (64-bit):
  1. .NET Framework 2.0 must be installed.
  2. Web site of web application must be added to trusted sites in security policy of .NET Framework 2.0 (32-bit).
  3. Web site of web application must be added to trusted sites in security policy of .NET Framework 2.0 (64-bit).
  4. Internet Explorer 6.0 or higher must be used as browser.
  5. Web site of web application must be added to the Trusted Zone in Internet Explorer if IE 8.0 or higher is used.
  6. Hosting of WinForms controls in Internet Explorer must be enabled.

For more information on Windows 8 and .NET 2.0, please read this article "Installing the .NET Framework 3.5 on Windows 8 or 8.1".

3.3. Add you web site to trusted sites in security policy of .NET Framework 2.0 (32-bit or 64-bit)

For more information, please read this article "Code Access Security Policy Tool (Caspol.exe)".


3.4. Add your web site to trusted sites/zone in Internet Explorer

  1. Open Internet Explorer and go to "Tools => Internet Options" menu, a window will open.
  2. Click the "Security" tab and choose the "Trusted Sites" icon. Click on the button "Sites", a window will open.
  3. Enter your web site in the line provided. Remove the check by the entry "Require server verification (https:)...." if this is necessary. Click the "Add" button.
  4. Click on the "Close" button. You web site is now added to the list of trusted sites.
For more information, please read this article "How Internet Explorer determines permissions for .NET Framework assemblies".

3.5. Enable hosting of WinForms controls in Internet Explorer

  1. Open the Registry Editor (common location "%windir%\System32\regedt32.exe") with administrative privileges.
  2. Add a DWORD (32-bit) entry called "EnableIEHosting" under:
    • "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework" for 32-bit or 64-bit system:

    • "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework" additionally for 64-bit system:

  3. Set value of the EnableIEHosting entry to 1.