After establishing a TWAIN session, selecting a TWAIN source, and setting the desired capabilities of the TWAIN source, the system is ready to acquire images or image data from that source. LEADTOOLS provides the following functions for acquiring images and image data from a TWAIN source:
The LTwain::Acquire function acquires one or more images from a TWAIN source. Override the LTwain::BitmapCallBack function in order to receive each image acquired from the source. This makes it possible to process each image as desired.
If only one image is acquired and a callback function has not been supplied, the pBitmap parameter of LTwain::Acquire is updated with the acquired image.
Within the LTwain::BitmapCallBack function, call LTwain::GetExtendedImageInfo to get the extended image information that is included if the TWAIN source is a barcode reader or a digital camera. Use LTwain::FreeExtendedImageInfoStructure to free the TW_EXTIMAGEINFO structure that the LTwain::GetExtendedImageInfo function retrieves. For more information about TW_EXTIMAGEINFO, refer to the TWAIN 1.9 specification from the site "https://twain.org/".
The LTwain::AcquireList function acquires one or more images from the TWAIN source and stores them in the specified LEAD bitmap list.
The LTwain::AcquireMulti and LTwain::FastAcquire functions acquire one or more images from a TWAIN source and saves them to one or more files.
The LTwain::AcquireMulti and LTwain::FastAcquire functions take an optional parameter, a pointer to an LTwain::AcquireCallBack function. This callback function is called twice for each page scanned using the LTwain::AcquireMulti or LTwain::FastAcquire functions. It is called the first time when the TWAIN source begins scanning the page. It is called the second time when the TWAIN source has finished scanning the page.
The functions listed above can acquire images in the following transfer modes:
Transfer Mode | Description |
---|---|
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. |
To stop acquisition started by the LTwain::Acquire function, call LTwain::CancelAcquire inside the LTwain::BitmapCallBack callback.
To stop acquisition started by the LTwain::AcquireMulti or LTwain::FastAcquire functions, call LTwain::CancelAcquire inside the LTwain::AcquireCallBack.
To stop acquiring images only from the feeder of the TWAIN source using the LTwain::Acquire function, call the LTwain::StopFeeder within the LTwain::BitmapCallBack function when it is fired.
To stop acquiring images only from the feeder of the TWAIN source using the LTwain::AcquireMulti or LTwain::FastAcquire functions, call LTwain::StopFeeder within the LTwain::AcquireCallBack callback when it is fired.