ImageGear for Silverlight
Setting String Type Capabilities with an Array Container
Send Feedback
ImageGear for Silverlight User Guide > Using ImageGear for Silverlight > Using ImageGear.TWAIN Namespace > Differences between ImageGear for Silverlight and ImageGear for .NET TWAIN > Setting String Type Capabilities with an Array Container

Glossary Item Box

In ImageGear for Silverlight, an array container (see ImGearCapArray) or an enumeration container (see ImGearCapEnumeration) cannot be used to set a capability with string values. If calling code attempts to do this, then an exception will be thrown from the ImGearTWAIN.SetCapability method. However, when getting the value of a string capability, an array or enumeration can be returned with string values, from the ImGearTWAIN.GetCapability method.

The following example demonstrates attempting to set a capability with a string in an array container.

C# Copy Code
<code>
ImGearCapArray arrayCapContainer = new ImGearCapArray(ImGearCapabilities.ICAP_HALFTONES);
ImGearCapOneValueString oneValueCapContainer =
                      new ImGearCapOneValueString(ImGearCapabilities.ICAP_HALFTONES);
oneValueCapContainer.Value = "NONE";
arrayCapContainer.Values.Add(oneValueCapContainer);
myImGearTWAIN.SetCapability(arrayCapContainer); // this line results in an ImGearException being thrown
</code>

Alternative

An alternative to setting a string capability with an array or enumeration container would be to set the capability with a one-value container. The following code demonstrates setting a capability with a one-value container.

C# Copy Code
<code>
ImGearCapOneValueString oneValueCapContainer =
                      new ImGearCapOneValueString(ImGearCapabilities.ICAP_HALFTONES);
oneValueCapContainer.Value = “NONE”;
myImGearTWAIN.SetCapability(oneValueCapContainer);
</code>

How does this effect you?

In the TWAIN 2.0 specification, the only capabilities that are string value types and can be set with an array or enumeration container are ICAP_HALFTONES and CAP_PRINTERSTRING.

For ICAP_HALFTONES this will prevent you from setting the legal values of the capability.

For CAP_PRINTERSTRING this will restrict you to specifying printer strings of one line.

©2013. Accusoft Corporation. All Rights Reserved.