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

LEADTOOLS WIA provides both high-level and low-level methods for acquiring pages from WIA sources.

High-level

LEADTOOLS WIA offers the high-level method, AcquireSimple, to let you acquire pages without having to initialize and end a session and select a device. When you call AcquireSimple, the following functions are called internally:

Note that when using any acquire function to acquire pages from a scanner under WIA Version 2.0 while the WiaAcquireFlags.ShowUserInterface flag is set, page count and margins will be ignored and all pages existing in the feeder will be acquired.

Low-level

LEADTOOLS WIA also offers the following low-level methods for acquiring from a WIA source:

If you are using one of these functions, prior to calling them it is necessary to first establish a WIA session, select a WIA source, and set the desired properties for the WIA source (for more information, refer to Initializing a WIA Session and Managing WIA Sources). Use these functions as follows:

  • The Acquire method acquires one or more images from a WIA source. To use it, change the default values of the AcquireOptions property (as necessary) to specify the acquire function behavior. Then set the properties like the transfer mode, format and other settings either using the GetProperties and SetProperties methods or using any of the SetPropertyXXX methods to change specific properties individually.

    Note that the acquire events will always be available when using WIA version 1.0 but for WIA 2.0 they will be available only if the WiaAcquireFlags.ShowUserInterface flag is NOT set. If you added the AcquireEvent event to your code then your should know that this event behavior varies depending upon the transfer mode, as follows:

    1. Memory Transfer: If memory transfer is used, the acquire event will receive a concatenation of the transferred chunks of data as RasterImage. This allows the user to process each image as desired. It will also receive extra information like the percent completion of the transfer process and a flag that determines whether the transfer is at the start of the page or the end of the page.
    2. File Transfer: If file transfer is used, the acquire event will receive the path and file name of the file that is going to be saved to the HDD; the percent completion of the transfer process and a flag that determines whether the transfer is at the start of the page or the end of the page.
  • The AcquireToFile method acquires one or more images from the WIA source and saves the image(s) to one or more files. If the currently set transfer format does not support multi-page files, then the images will be saved to a series of files named by appending "(N)" to the end of the base filename, where N represents an incremented number.

    Note that the AcquireFileEvent event will always be available when using WIA version 1.0 but for WIA 2.0 they will be available only if the WiaAcquireFlags.ShowUserInterface is NOT set. If you added the AcquireFileEvent event to your code then it will receive some information about the acquisition process like path and filename of the file that is going to be saved to the HDD, the percent completion of the transfer process and a flag that determines whether the transfer is at the start of the page or the end of the page.

  • The AcquireImageFromVideo method extracts a still image from the video stream, and saves the image as a JPEG file. For more information, refer to Working with Video Devices.

Stopping Acquisition

To stop the acquire process you should add the acquire event related to the acquire method you are using and from inside the event you should set the Cancel member of the event argument parameter to true.