Home : Can DotTwain access custom capabilities?
Q10124 - FAQ: Can DotTwain access custom capabilities?

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 "<setresult>TWRC_SUCCESS</setresult>" 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 "<itemtype>" 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 Integer
Me.device.Controller.GetCapabilityValue(cap, val)
See also: Q10398 - HOWTO: Tracking down a TWAIN Custom Capability
Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2017. InstantASP Ltd. All Rights Reserved