Yes it can.
Many scanners have custom capabilities that extend the TWAIN specification. These capabilities can be accessed through DotTwain's TwainController object (which can be accessed through the Device.Controller property), but it requires that you know what these capabilities are and how to use them.
Search the manufacturer's web site to see if they provide information on the driver capabilities, including the numeric value and data type for the capability you want to use.
If you can't find this information, you can use our Inspector TWAIN product (distributed with DotTwain 2.0 and above) to check out the capabilities of the device. Looking at the log it produced, search for "CAP_" followed by a number. Any of those tags that contain "TWRC_SUCCESS" are custom capabilities that can be set.
Once you have a list of values that can be set, try using DotTwain to set those values then show the driver interface and see if the feature you're looking for was modified. The "" tag will tell you what data type was used for the capability. The table below provides which .NET type is used for these TWAIN data types.
TWAIN |
.NET |
TWTY_BOOL |
System.Boolean |
TWTY_FIX32 |
System.Single |
TWTY_FRAME |
System.Drawing.RectangleF |
TWTY_INT8
TWTY_UINT8
TWTY_INT16
TWTY_INT32
TWTY_UINT16
TWTY_UINT32 |
System.Int32 |
TWTY_STR1024
TWTY_STR128
TWTY_STR255
TWTY_STR32
TWTY_STR64
TWTY_UNI512 |
System.String |
The TwainController has GetCapabilityValue and SetCapabilityValue methods that will allow access to this custom capabilities. You will need to cast the numeric value of the custom capability to a DeviceCapability in order to use these methods.
The following code would get the value of a custom capability with the value of 1234 that is of type Int32:
C#
DeviceCapability cap = (DeviceCapability)1234;
int val;this.device.Controller.GetCapabilityValue(cap, out val);
VB.NET
Dim cap As DeviceCapability = CType(1234, DeviceCapability)
Dim val As IntegerMe.device.Controller.GetCapabilityValue(cap, val)
See also: HOWTO: Track down a TWAIN Custom Capability
Original Article:
Q10124 - FAQ: Can DotTwain access custom capabilities?