ImageGear for C and C++ on Windows v19.0
Set Scanning Capabilities

This section provides the following information:

Setting the Filename and Format Type for Disk File Transfer

When the Disk File Transfer mode is used, the Data Source will save an image directly to a file. You must use the TWAIN capabilities to set all parameters involved in using Disk File Transfer. To do this, use the IG_TWAIN_cap_set() and IG_TWAIN_ctrl_set() functions. Below are two sample calls. The first sets the filename; the second sets the file format to TIFF.

 
Copy Code
AT_ERRCOUNT SetForDiskFileTransfer(char *filename)
{
    AT_ERRCOUNT errorCount = 0;
    HTWAINCAP hTWAINCap = (HTWAINCAP)NULL;
    AT_LMODE nFileFormat = IG_FORMAT_TIF;

    errorCount = IG_TWAIN_ctrl_set(IG_TW_CTRL_IMAGE_FILE_NAME, filename, strlen(filename));
    errorCount += IG_TWAIN_cap_create(IG_TW_ICAP_IMAGEFILEFORMAT, IG_TW_ON_ONEVALUE,
            AM_TID_META_UINT16, &hTWAINCap);
    errorCount += IG_TWAIN_cap_value_set(hTWAINCap, (LPCVOID)nFileFormat, sizeof(nFileFormat));
    errorCount += IG_TWAIN_cap_set(hTWAINCap, IG_TW_MSG_SET);
    errorCount += IG_TWAIN_cap_delete(hTWAINCap);

    return errorCount;
}       

Your choice of which file format to use for an image that is acquired and stored directly to a file is limited by two factors: (1) The file formats supported by your Scanner's Device Driver, (2) The file formats supported by TWAIN.

The following formats are supported by TWAIN for image acquisition devices: TIFF, PICT, BMP, XBM, JPEG, FPX, PNG. Therefore, if you are using the Disk File Transfer, you are restricted to using a format that is both supported by TWAIN and supported by your Data Source.

If you do not specify a filename, the path to the temporary Windows directory will be used.

Remember that not all TWAIN-supported file formats are supported by all TWAIN-compliant Data Sources. If your Data Source does not support the file format that you specify, ImageGear will return an error.

For additional information about using the Disk File Transfer syntax see the Scanning and Acquiring Pages subsection entitled "Using Disk File Transfer and IG_TWAIN_acquire()".

Controlling the Scanning Capabilities and Other Options

The function used to set scanning capabilities is IG_TWAIN_cap_set(), which was briefly described in an earlier sub-section of this scanning discussion.

You have already seen that used in prior sections to set the filename and format for an image acquired using Disk File Transfer mode. However, there are many other capabilities that can be set using that function, including bit depth and layout. There are restrictions on which capabilities can be used based on the hardware that you are using, the transfer mode setting, and the ImageGear function that you call.

TWAIN Capabilities Reference

The following sub-sections provide information about the TWAIN scanning capabilities that are most frequently used for TWAIN scanning processes:

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback