LEAD Technologies, Inc

Programming with LEADTOOLS TWAIN

TWAIN is a standard for image input devices, such as scanners and digital cameras. Getting an image from a TWAIN device can be very simple. First, there is a standard facility for selecting the input device. It is similar to selecting a default printer, and you can skip this step if you know that the default is right. Then, each TWAIN device has its own user interface, which you invoke to acquire an image.

Some complexity is introduced only when acquiring multiple images or when bypassing the user interface. If you acquire multiple images, you must code a callback function or event procedure to handle each image. If you bypass the user interface, you must set some standard TWAIN parameters to provide the information that the TWAIN driver would normally get from the user interface. The tricky part is that some TWAIN drivers implement the standard more fully than others. If you do not know in advance how the TWAIN device will behave, it is a good idea to add logic to your program to test the success of setting the TWAIN parameters. LEADTOOLS provides functions for all of this.

Please note that TWAIN support requires TWAIN_32.DLL for 32-bit and requires TwainDSM.dll for 64-bit. These files must be obtained from the TWAIN device manufacturer.

Once the TWAIN driver is installed and configured to the system, the user is ready to begin programming with LEADTOOLS TWAIN. LEADTOOLS provides properties, methods, and events for:

Getting Started

To begin using the available features in the LEADTOOLS TWAIN toolkit, the user should start-up a TWAIN session. For more information, refer to Initializing a TWAIN Session.

The user can now select a specific TWAIN source from the sources installed on the system, or use the default TWAIN source. This must be done after the user has started-up a TWAIN session. For more information, refer to Managing the TWAIN Source.

Setting and Getting Capabilities Values

Each TWAIN source has a set of supported capabilities. The user may set these capabilities to some desired value before acquiring the image(s) or the user may elect to use the TWAIN source's default values for the capabilities. LEADTOOLS provides properties, methods and events for working with capabilities in the following ways:

For more information, refer to Getting and Setting Capabilities.

Acquiring Images or Image Data

After the desired TWAIN source capabilities have been set, the user can start acquiring raster images and/or image data. Image data is related to the data acquired from a barcode, if the selected TWAIN source is the barcode reader.

For more information, refer to How to Acquire from the TWAIN Source.

Save Settings to Files

The user can save the capability settings, used when acquiring images, in a template file. These capability settings can then obtained from the template file and used to acquire images from the same TWAIN source later, instead of getting and setting the TWAIN capabilities each time. For more information, refer to Handling Template Files.

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.