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, L_WiaAcquireSimple, to let you acquire pages without having to initialize and end a session and select a device. When you call L_WiaAcquireSimple, 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 L_WiaAcquire 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 L_WiaAcquire 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 LWIAACQUIRECALLBACK function has been defined and a pointer to this function to L_WiaAcquire 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 L_WiaAcquireToFile 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.

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 the user has defined an LWIAACQUIREFILECALLBACK function and passed a pointer to this function to L_WiaAcquireToFile, 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 L_WiaAcquireImageFromVideo 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 the acquire process return ERROR_USER_ABORT inside the LWIAACQUIRECALLBACK (for an acquire process started by the L_WiaAcquire or L_WiaAcquireSimple function) or inside LWIAACQUIREFILECALLBACK (for an acquire process started by the L_WiaAcquireToFile function).

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

LEADTOOLS WIA C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.