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. For more information, refer to Setting Which TWAIN Specification Version to Use.

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

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

Next, either select a specific TWAIN source from the sources installed on the system, or use the default TWAIN source. This must be done after the TWAIN session has been started. For more information, refer to Managing the TWAIN Source.

Setting and Getting Capabilities Values Each TWAIN source has a set of supported capabilities. Before acquiring the image(s), either use the default values or set the capabilities to desired values. 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, acquisition of raster images and/or image data can begin. Image data is 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 Capability settings used to acquire images can be saved to a template file. Later, these capability settings can be obtained from the template file and used to acquire images from the same TWAIN source, instead of getting and setting the TWAIN capabilities each time. For more information, refer to Handling Template Files.

Help Version 21.0.2021.11.1
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Imaging, Medical, and Document
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.