Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
Handling Template Files
Template files are used to store capability information for a specific TWAIN source. That way, the next time that TWAIN source is used, the corresponding template file can provide information on the capabilities used previously.
LEADTOOLS provides the following functions for working with template files:
LTwain::TemplateDlg displays the scanning dialog provided by the manufacturer of the TWAIN source without actually acquiring the images. Instead it gets the values of all supported capabilities, which will be saved to the specified template file.
LTwain::OpenTemplateFile opens a template file for either reading or writing. When a template file is open for reading, the user can get capability information stored within the file. When a template file is opened for writing, capability information can be saved to that file.
LTwain::AddCapabilityToFile adds a certain capability to the file when the file is opened with write access.
LTwain::GetNumOfCapsInFile gets the number of capabilities stored in a template file.
LTwain::GetCapabilityFromFile gets the capability information by passing its index to the function.
LTwain::CloseTemplateFile closes the file and saves its contents if the file was opened with write access.
When a user acquires one or more images using the LTwain::Acquire function, the capability settings used for the TWAIN source can be saved in a template file. The next time the user wishes to use that TWAIN source he or she can open the template file saved previously, for read access, using LTwain::OpenTemplateFile. The LTwain::GetNumOfCapsInFile function will provide the number of capabilities stored in the template file. This information allows the user to loop through the stored capabilities using the LTwain::GetCapabilityFromFile function. As each capability is obtained, the user can set the capabilities for the TWAIN source using the LTwain::SetCapability function.