Getting and Setting Capabilities

Each TWAIN source may support a number of capabilities. These capabilities dictate the behavior of the TWAIN source. Before acquiring images from the selected TWAIN source, the user may wish to examine and change the capability settings for that source.

It is possible to check whether the installed scanner to the system supports certain capabilities. For more information, refer to How to Find Out Whether Your Scanner Supports Certain Capabilities Using Twacker, found on http://support.leadtools.com/SupportPortal/cs/forums/3781/ShowPost.aspx.

LEADTOOLS provides both low-level and high-level functions for getting and setting capabilities. The low-level functions get and set capabilities individually. The high-level functions let the user get and set specific capabilities, either singularly, or in groups.

Low-Level:

image\sqrblit.gif To get information about the capabilities supported by the selected TWAIN source, call the LTwain::EnumCapabilities function. For each capability enumerated by LTwain::EnumCapabilities, this function will call the LTwain::CapabilityCallBack function. Within this callback function the user can process the capability information.

image\sqrblit.gif To get information on a specific capability (current, default, or all possible values) call LTwain::GetCapability. This function gets information about the capability specified in a TW_CAPABILITY structure. For more information about TW_CAPABILITY, refer to www.twain.org/download.htm and click on TWAIN Specification (Version 1.9).

image\sqrblit.gif To set a specific capability to a new value or to reset the value of a capability to the default value, call LTwain::SetCapability.

High-Level:

image\sqrblit.gif LTwain::GetProperties and LTwain::SetProperties allow the user to set and get a number of capabilities through the LTWAINPROPERTIES structure. If this structure does not have the capability needed to negotiate, the user may use the low-level functions to do so.

image\sqrblit.gif The LTwain::QueryProperty function lets the user get the available values for a specific capability from the selected source.

image\sqrblit.gif There are several transfer option capabilities that control the file name, compression, transfer mode, and file format. These can be obtained or set collectively using the LTwain::GetTransferOptions and the LTwain::SetTransferOptions functions.

image\sqrblit.gif In addition to the transfer options mentioned above, the transfer modes supported by the TWAIN source can be obtained by calling the LTwain::GetSupportedTransferMode function.

image\sqrblit.gif When transferring files from the TWAIN source there is a maximum number of files that can be transferred. To get the current value, call the LTwain::GetMaxXferCount function. To change that value, call the LTwain::SetMaxXferCount function.

image\sqrblit.gif There are many capabilities associated with various image characteristics, such as image resolution, image frame, image unit, bits per pixel, etc. The current values for these can be obtained using the following functions:

LTwain::GetResolution

LTwain::GetImageFrame

LTwain::GetImageUnit

LTwain::GetImageBitsPerPixel

image\sqrblit.gif To change the values of these capabilities, use the following functions:

LTwain::SetResolution

LTwain::SetImageFrame

LTwain::SetImageUnit

LTwain::SetImageBitsPerPixel

image\sqrblit.gif Image contrast, highlight and brightness capabilities can be set simultaneously by calling LTwain::SetImageEffects. To find out the current settings for contrast, highlight and brightness, call LTwain::GetImageEffects.

image\sqrblit.gif The RGB elements used by the TWAIN source can be set by calling the LTwain::SetRGBResponse function.

image\sqrblit.gif If the TWAIN source supports duplex scanning, a specific duplex mode can be enabled or disabled by calling LTwain::EnableDuplex. To get the current duplex mode and the enabled status of that mode, call LTwain::GetDuplexOptions.

image\sqrblit.gif The page size and orientation used during image acquisition can be set by calling LTwain::SetAcquirePageOptions. To get the current settings for these page options, call LTwain::GetAcquirePageOptions.

image\sqrblit.gif During the actual acquisition process, you can elect to have a progress indicator displayed. The LTwain::ShowProgress function lets you hide or display the progress indicator.

image\sqrblit.gif After setting the desired capabilities call LTwain::Acquire to scan the pages.

When working with TW_CAPABILITY structures it may be necessary to create a container associated with that structure. For more information on containers, refer to How to Work with the Containers.