Using csXImage with Twain compatible scanners - Troubleshooting.

Although Twain is supposed to be a universal standard for interfacing with scanners there can be problems on some systems and with some devices. We will try to address some of the possible causes of errors when using the csXImage control.

Using the correct Twain Data Source Manager (DSM)

All communication between csXImage and the scanner must pass through the Data Source Manager, which is a DLL, but there are two different DLLs used by different versions of Twain. Before Twain 2.0, the DLL used was twain_32.dll. From Twain 2.0, the DLL is twaindsm.dll. csXImage will attempt to use the later version of the DSM by default.

Sometimes an older scanner will perform badly with the later DSM and there are properties in csXImage to handle this. Setting the TwainUseNewDSM property to false will force the use of the earlier DSM. This property must be set before selecting the scanner. An alternative to setting TwainUseNewDSM is to change the value of TwainCallBackMode. The callback is a feature of Twain 2.x but it can be turned off by setting TwainCallBackMode to 3. This setting must also be made before selecting the scanner.

Sometimes a newer scanner will perform better with the new DSM, but the twaindsm.dll file is not present on the system. It should be in the Windows System folder. With the introduction of 64 bit Windows there are now two System folders. Windows\SysWOW64 for 32 bit DLLs and Windows\System32 for 64 bit DLLs. Most scanner drivers are currently 32 bit so check SysWOW64 for the file twaindsm.dll. We supply a copy of this file with our installer, although we do not install it. If you ran our installer with the default settings it will be in Program Files (x86)\Chestysoft\csXImage\x86DSM.

In summary, try using both Twain Data Source Managers. csXImage will attempt to use the later version by default, but it must be present. The older version will be used if TwainUseNewDSM is set to false.

Check the scanner drivers

Sometimes a scanner will not function properly because the driver is outdated or corrupt. Make sure you have the latest driver and it is correctly installed.

Run the calling application as the Administrator

We are increasingly seeing security related issues where the system is preventing the calling application from having full access to the Twain DLLs and this can lead to a variety of errors. The solution is to run the calling application as the administrator. If the application has a shortcut, the properties has a tick box to "Run as Administrator", which means the application will always run with the elevated permissions when run from this shortcut. For browser based applications with scanning problems, try running Internet Explorer as the administrator. For applications that are being developed in environments such as Visual Studio, try running the IDE itself as the administrator.

Browser Applications - Trusted Zone

Another security issue is specific to browser based applications. It appears to only affect a small minority of systems and shows itself when scanners that are installed are not available for selection. The fix is to add the website to the Trusted Zone in Internet Options, and then reduce the security level on the Trusted Zone.

Developing a 64 bit application

Currently many scanners only provide 32 bit drivers. This means that a 64 bit application running csXImage might not be able to see any installed devices. Visual Studio will now produce a 64 application by default and the project options need to be changed to make a 32 bit application. It is not possible to call a 32 bit scanner driver from a 64 bit application.


This site uses cookies for functionality, traffic analysis and for targeted advertising. Click the Accept button to accept our Cookie Policy. The Cookie Policy page offers configuration for a reduced set of cookies for this site.