How to Acquire from the TWAIN Source

After the user has initialized a TWAIN session, selected a TWAIN source, and set the desired capabilities of the TWAIN source, he or she is ready to acquire images or image data from that source. LEADTOOLS provides the following for acquiring images and image data from a TWAIN source:

1. The user sets the SaveAcquiredBitmap property to TRUE before calling the Acquire method. In this case, when calling the Acquire method, the AcquiredBitmapList and AcquiredBitmap properties will be updated with the acquired images(s), but will not trigger the AcquirePageEvent event.

 

2. The user sets the SaveAcquiredBitmap property to FALSE before calling the Acquire method. In this case, for each image acquired by the Acquire method, an AcquirePageEvent event occurs and the image is passed to the event. The AcquiredBitmapList and AcquiredBitmap properties will not be valid and will not be updated with the acquired images(s). Within the AcquirePageEvent event, the user can call the GetExtImageInfo method to get extended image information that is included if the TWAIN source is a barcode reader or a digital camera.

If you are using the ADF, you can stop feeding pages during the acquisition process by setting the StopFeedPages property value to TRUE in the AcquirePageEvent event. To continue feeding pages during image acquisition, set this property value to FALSE.

The GetExtImageInfo method will store the acquired image information in a pointer to an ItwExtImageInfo interface. This interface has the following properties:

The ItwInfo is an interface used in getting information data from an ItwExtImageInfo interface. It has the following properties:

In addition, the parameters passed to the AcquireMulti method dictate the actions of the method. If the file format used does not support multi-page files, then the images will be saved to a series of files named by appending the image number to a base file name. If the file format used does support multi-page files, then the image(s) will be saved to one or more files based on the bMulti parameter. If this parameter is FALSE, then images will be saved to a series of files named by appending the image number to a base file name. If this parameter is TRUE, the image(s) will be saved to one multi-page file named using only the base file name.

For each page scanned using the AcquireMulti method, the AcquireMultiEvent event is fired twice, if the EnableAcquireMultiEvent property is set to TRUE before calling the AcquireMulti method. The AcquireMultiEvent event is fired first when the Twain source begins scanning the page. The event is fired the second time when the Twain source finishes scanning the page.

The Acquire method can acquire images in the following transfer modes:

NATIVE

Gets the bitmaps being scanned into the memory as a whole.

MEMORY BUFFERED

Gets images from the source as strips of data. These strips can be merged to get the whole image.

FILE

Gets the images from the source to a disk file.

The following properties are used depending on the transfer mode set.:

To stop acquire process, you can call CancelAcquire method inside AcquirePageEvent event for acquire process started by Acquire method.

Also, to stop acquire process, you can call CancelAcquire method inside AcquireMultiEvent event for acquire process started by AcquireMulti method.