Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.21
How to Acquire from the Twain Source

After the user has established 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 methods for acquiring images and image data from a TWAIN source:

  • The TwainSession.Acquire method acquires one or more images from a TWAIN source. If the user has overridden the AcquirePage event, the AcquirePage event will receive each image acquired from the source. This allows the user to process each image as desired, when the user acquires an image, the TwainAcquirePageEventArgs.Image property is updated with the acquired image.
  • Within the AcquirePage event the user can call the UpdateExtraImageInformation method to get extended image information that is included if the TWAIN source is a barcode reader or a digital camera.
  • The TwainSession.AcquireFast method acquires one or more images from a TWAIN source and saves the image(s) to one or more files. 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 multiPage 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.

The AcquireMultiPage event is called twice for each page scanned using the AcquireFast method. 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 methods listed above 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.