TwainPRO 9 for .NET - User Guide > How To > Debug |
If you have a problem with a TWAIN device we recommend trying the following things:
Get the latest version of the scanner's drivers from the manufacturer's web site and re-install them.
Get the latest TWAIN Data Source Manager files from www.Twain.org and put them in your windows directory (NOT the windows\system directory). Also, make sure you don't have older versions of those DLLs or EXEs anywhere else in your path.
Make sure you have the latest version of TwainPRO™.
If you still have a problem with a particular scanner, let us know, but remember, not all TWAIN capabilities are supported by all devices and there are TWAIN drivers out there that have bugs in them and are not fully TWAIN compliant.
There are a couple of reasons this issue may be occurring:
Please make sure that you call OpenSession before setting the capabilities. For example:
Example |
Copy Code
|
---|---|
ICAP TwainPRO1.SelectSource TwainPRO1.ShowUI = False TwainPRO1.OpenSession |
Not all TWAIN devices support all TWAIN capabilities. Because of this, you must check to see if a TWAIN capability is supported by your device before setting it.
To do this, TwainPRO™ provides a method called IsCapabilitySupported, which will return True if the capability is supported and False if not. Note that if a scanner supports a capability, it might only support getting it and does not necessarily support setting it.
Below is an example of how to check this property:
Example |
Copy Code
|
---|---|
if (twainDevice.IsCapabilitySupported(Capability.IcapPixelType) == true) { // If the capability is supported this code will be executed. } |
Kofax VirtualReScan (VRS) works best with an ISIS driver and only supports some scanners with TWAIN drivers. Documentation for Kofax VRS can be found at www.kofax.com.
This section includes error codes and extended error codes.
7000 |
TWAIN error, check ConditionCode & ConditionDescription properties. The Data Source has returned an error. Check the ConditionCode and ConditionDescription properties to see if the Data Source has returned an error code. |
|
7001 |
Can't find or load TWAIN DSM (TWAINDSM.dll, Version 2). The 32-bit version should be installed in the SYSTEM32 directory on native 32-bit Windows systems. On native 64-bit Windows systems, the 32-bit version should be installed in the SYSWOW64 directory. The latest version can be found at www.twain.org. Possible causes: The file is missing. The file is in use by another application. |
|
7002 |
TwainPRO can’t open an existing TIFF file to append pages. Possible causes: The file is open in another control or application. The file is read-only |
|
7003 |
TwainPRO was unable to allocate memory for the requested operation. Possible causes: The image being transferred is too large to fit in memory. Too many applications are open. |
|
7004 |
The user cancelled the requested operation. Possible causes: The user clicked the cancel button on the source selection dialog invoked by the TwainDevice.SelectSource method. |
|
7005 |
TwainPRO was unable to create the file specified in the ScannedImage.SaveFile method. Possible causes: The drive or path specified doesn’t exist. The file exists and is in use by another application. No file extension or an invalid file extension was specified. |
|
7006 |
An error occurred while TwainPRO was attempting to save a file to the path specified in the ScannedImage.SaveFile method. Possible causes: The drive or path became invalid during the write. This can occur if the drive is a network drive. The disk is full. |
|
7007 |
A file extension for specified for a file type not supported by TwainPRO. Supported file types are: BMP, JPEG, ePIC, and TIFF. |
|
7008 |
A string with too many characters was set to a TwainPRO property. Possible causes: The application identity properties can accept a maximum length of 32 characters. The SaveOptionsPic.Password property can accept a maximum length of 8 characters. |
|
7009 |
The value is out of range. An invalid value was set to a TwainPRO property. Possible causes: Many TwainPRO properties can only accept values in a specified range. For example, the SaveOptionsJpeg.Luminance property must be in the range 0-255. |
|
7010 |
No image is available for the requested operation or an unsupported DIB format was returned in response to a StartSession. Possible causes: The ScannedImage.ToHdib property has already been read. The ScannedImage.SaveFile method was invoked after the hDIB property was read. |
|
7011 |
The required Accusoft dll file(s) are missing. Possible causes: Accusoft dll files are required when saving JPEG, ePIC, or TIFF files. They are listed in the dependencies section. |
|
7012 |
The required Internet dll file(s) are missing. Possible causes: The following files are not present on the system. These files are not shipped with TwainPRO and are not needed unless an FTP address is specified in the ScannedImage.SaveFile method. These files are included with other software such as Internet Explorer, and if the machine has a TCP/IP connection, it should have these files:
|
|
7013 |
An error occurred trying to FTP an image. Possible causes: The machine is not currently connected to a network. The FtpOptions.NetworkCredentials property settings are not correct for the requested host specified in the ScannedImage.SaveFile method. The host and or path specified in the ScannedImage.SaveFile method doesn’t exist. The path was not specified in the ScannedImage.SaveFile method. A fully qualified URL containing both the servername and file path must be specified. For example, "http://ftp.myserver.com/ftp/public/test.jpg" contains both the server and file information, but "http://ftp.myserver.com" does not. |
|
7014 |
Illegal operation for current Source Manager or Source state. The requested action cannot be performed in the current state of the TWAIN session. Possible causes: Certain methods and properties are only valid during certain states. For example, the DataSourceCollection is invalid unless the TwainDevice.OpenDataSourceManager method was called to open the Data Source Manager. |
|
7015 |
The requested index was out of range for the property array. |
|
7016 |
A property was set or queried that was not valid for the current capability type. Please see the Negotiate Capabilities section for more information. |
|
7017 |
An error occurred trying to open the clipboard with the ScannedImage.CopyToClipboard or ScannedImage.CutToClipboard method. Possible causes: Another application has the clipboard open. |
|
7018 |
Internal error. |
|
7019 |
Invalid image resolution for selected file format or an unsupported bits per pixel was returned from a StartSession. Possible causes: Tried to save a 1-bit or Black and White image to a jpg or pic file. |
|
7020 |
The property or method requested is not currently available. Possible causes: This exception may occur when the requested capability function is not available for the current capability. For example, this may occur for the TwainDevice.GetCapabilityConstantDescription() method when using an Advanced Capability. |
|
7021 |
No compressed image is available for the requested operation or an unsupported compressed image format was returned in response to a StartSession. Possible causes: The requested Source compression may not be available on the device. Or it may occur if either of the deprecated ScannedImage.SaveFile() or ScannedImage.SaveStream() methods is used. |
|
7022 |
The Data Source performed an operation that caused an exception. This error is a critical error. If this error is received then the application should be terminated immediately. No other TwainPRO calls should be made after this error is received. This does give the application the chance to do any non-TWAIN clean-up processing as well as inform the user that a critical error has occurred. Possible causes: The Data Source TWAIN driver executed an illegal operation, such as an illegal memory access, a divide by zero, etc. |
|
7023 |
Invalid license. |
|
7024 |
TIFF tag not found. |
|
7025 |
TIFF tag item not found. |
|
7026 |
Error reading file. |
|
7027 |
An error occurred while initializing the settings file reader system. |
|
7028 |
An error occurred while terminating the settings file reader system. |
|
7029 |
An error occurred when opening the settings file. |
|
7030 |
The TwainDevice Name attribute was not found in the settings file. |
|
7031 |
Settings for the current scanner were not found in the settings file. |
|
7032 |
The Capability Enum attribute was not found in the settings file. |
|
7033 |
Invalid file name. |
|
7034 |
The specified file was not found for the current LoadOptions operation. |
|
7035 |
The specified path of the filename was not found. |
|
7036 |
The file is in use by another process and cannot be opened. |
|
7037 |
The file close operation could not be completed. |
|
7038 |
The file reset operation could not be completed. |
|
7039 |
The Capability Type attribute was not found in the settings file. |
|
7040 |
The Capability is not supported. |
|
7101 | TwainDllLoadException | Can't find or load TWAIN DSM (twain_32.dll, Version 1) in the Windows directory. The latest version can be found at www.twain.org. |
7102 | TwainDllLoadException | Can't find or load any version of the Twain Data Source Manager. The latest version can be found at www.twain.org. |
7103 | TwainDllLoadException | On native 64-bit systems, Version 1 of the DSM (twain_32.dll) can't be used, you must use at least Version 2 (TWAINDSM.dll). |
7104 | TwainDllLoadException | Can't find or load TWAIN DSM (TWAINDSM.dll, Version 2). The 64-bit version of TwainDSM.dll should be installed in the SYSTEM32 directory. The latest version can be found at www.twain.org. |
7105 | ArgumentException | TwainDevice.DataSourceManagerVersion can't be set to None, please choose a valid version to use. |
7106 | SourceCompressedImageOnlyException | The image was compressed directly in hardware by the source and not by TwainPro, please use ScannedImage.SaveSourceCompressedImageToFile() or SaveSourceCompressedImageToStream() to save the scanned image. |
7107 | TwainProCompressedImageOnlyException | Hardware compression isn't available so only TwainPro can compress the image, please use ScannedImage.SaveToFile() or SaveToStream() to save the scanned image. |
7108 | ValueOutOfRangeException | The JPEG Luminance value is out of range. It should be within the range of 0 to 255. |
7109 | ValueOutOfRangeException | The JPEG Chrominance value is out of range. It should be within the range of 0 to 255. |
7110 | ValueOutOfRangeException | The JPEG Subsampling value is incorrect. It should be one of the available SubSampling enumeration values: 111, 211, 411, or 211v. |
7111 | ValueOutOfRangeException | The PNG Filter value is incorrect. Please check the enumeration declaration for supported values. |
The following are error codes and strings that can be returned in the ConditionCode and ConditionDescription properties when TwainPRO returns a TWERR_TWAIN error.
1 |
TWCC_BUMMER |
General failure. Unload Source immediately. |
2 |
TWCC_LOWMEMORY |
Not enough memory to complete operation. |
3 |
TWCC_NODS |
Source Manager unable to find the specified Source. |
4 |
TWCC_MAXCONNECTIONS |
Source is connected to maximum supported number of applications. |
5 |
TWCC_OPERATIONERROR |
Source or Source Manager reported an error to the user and handled the error; no application action required. |
6 |
TWCC_BADCAP |
Capability not supported by Source. |
9 |
TWCC_BADPROTOCOL |
Unrecognized operation triplet. |
10 |
TWCC_BADVALUE |
Data parameter out of supported range. |
11 |
TWCC_SEQERROR |
Illegal operation for current Source Manager or Source state. |
12 |
TWCC_BADDEST |
Unknown destination in DSM_Entry. |
13 |
TWCC_CAPUNSUPPORTED |
Capability not supported by Source. |
14 |
TWCC_CAPBADOPERATION |
Operation not supported on capability. |
15 |
TWCC_CAPSEQERROR |
Capability has dependencies on other capabilities and cannot be operated upon at this time. |
16 |
TWCC_DENIED |
File System operation is denied (file is protected). |
17 |
TWCC_FILEEXISTS |
Operation failed because file already exists. |
18 |
TWCC_FILENOTFOUND |
File not found. |
19 |
TWCC_NOTEMPTY |
Operation failed because directory is not empty. |
20 |
TWCC_PAPERJAM |
Transfer failed because of a feeder error. |
21 |
TWCC_PAPERDOUBLEFEED |
Transfer failed because of a feeder error. |
22 |
TWCC_FILEWRITEERROR |
Error writing the file. |
23 |
TWCC_CHECKDEVICEONLINE |
The device went off-line prior to or during this operation. |
24 | TWCC_INTERLOCK | Operation failed because the cover or door is open. |
25 | TWCC_DAMAGEDCORNER | Operation failed because the document has a damaged corner. |
26 | TWCC_FOCUSERROR | Operation failed because of a focusing error during document capture. |
27 | TWCC_DOCTOOLIGHT | Operation failed because the document is too light. |
28 | TWCC_DOCTOODARK | Operation failed because the document is too dark. |
29 | TWCC_NOMEDIA | Operation failed because no media is present for the source to capture. |