Acquire Pages 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, LWia::AcquireSimple, to let you acquire pages without having to initialize and end a session and select a device. When you call LWia::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 L_WIA_SHOW_USER_INTERFACE 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 LWia::Acquire function acquires one or more images from a WIA source. To use it, define a variable of type LWIAACQUIREOPTIONS structure and pass the address of that variable to the LWia::Acquire function to specify the acquire function behavior and set properties like the transfer mode, format and other settings.

Note that a callback is always available when using WIA version 1.0 and only available for WIA 2.0 when the flag L_WIA_SHOW_USER_INTERFACE is NOT set. If an LWia::AcquireCallBack function has been defined and a pointer to this function to LWia::Acquire is passed, the behavior of the callback function varies depending upon the transfer mode, as follows:

  1. Memory Transfer: If memory transfer is used, the callback function will receive a concatenation of the transferred chunks of data as BITMAPHANDLE. This allows the user to process each image as desired. It will also receive some 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 callback function 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 LWia::AcquireToFile function 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 multipage files, then the images will be saved to a series of files named by appending "(N)" to the end of the base file name, where N represents an incremented number.

Similar to LWia::Acquire, a callback for LWia::AcquireToFile is always available when using WIA version 1.0 and only available for WIA 2.0 when the flag L_WIA_SHOW_USER_INTERFACE is NOT set. If the user has defined an LWia::AcquireFileCallBack function and passed a pointer to this function to LWia::AcquireToFile, the callback function will receive some information about the acquisition process like 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 LWia::AcquireImageFromVideo function 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 acquisition, return ERROR_USER_ABORT inside the LWia::AcquireCallBack (for acquisition started by the LWia::Acquire or LWia::AcquireSimple function) or inside LWia::AcquireFileCallBack (for acquisition started by the LWia::AcquireToFile function).

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

LEADTOOLS WIA C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.