-details |
Top Previous Next |
-details filename
The -details option writes information on all the installed TWAIN devices to the file specified by filename. The full path name can be specified as the file name.
The -details option should be used only for getting information on the devices, and not to acquire images. DTWAIN_TwainSave will return immediately after writing the details to the file filename and not attempt to acquire images.
Example: DTWAIN_TwainSave("-details scanner_details.txt");
The example above writes detailed information about the installed TWAIN devices to "scanner_details.txt". As with any parameters that may contain spaces, the filename must be enclosed in double quotes if the file name contains spaces.
The information written to the file consists of:
The format of the data is as follows:
Device_Count:<integer> Device_Name:<string> Device_Chosen:<string> Device_NumColors:<integer> Device_Color_Info:<integer>;<integer>,<integer>,... Device_Failure:<string> Device_Resolution_Type:<string>,<string>,<numeric_value>,... Device_Brightness_Type:<string>,<numeric_value>,... Device_Contrast_Type:<string>,<numeric_value>,... Device_Paper_Sizes:<string>,... Device_Feeder:<integer> Device_Feeder_Sensitive:<integer> Device_Imprinter:<integer> Device_Duplex:<integer> Device_UI_Controllable:<integer> Device_Job_Control:<integer>
As a quick example, if there are two TWAIN devices installed, the following will be found in the details file. Device_Count:2
If the product name of the device is "xyz scanner", the following will be found in the details file: Device_Name:xyz scanner
Since the format of the output generated is well-defined, the detail log can also provide programmers with a file that they can parse for certain values, and allow their programs to use the information. For example, a program can be written to execute DTWAIN_TwainSave to generate the detail log, and from the log, determine what devices are functional, and also the various color and bits-per-pixel combinations that are valid for a particular device. Then DTWAIN_TwainSave can be executed again with the color/bits-per-pixel information gathered from the detail log to ensure that images will be scanned with valid color and bits-per-pixel information.
For example, the detail log can be used to discover the valid color and bits-per-pixel information for each installed device. If the -color and/or the -bpp options are used when running DTWAIN_TwainSave, they must be valid values. The detail log will indicate the valid color and bits-per-pixel values.
Here is the information for each of the items above:
Range and Discrete Types
For some of the details listed, a Range or Discrete set of values will be displayed. A Range is denoted by three values -- a minimum value, maximum value, and step value. For example:
The above means that the brightness values have a minimum of 10, a maximum of 1000, and that the other values are in increments of 5, starting from the minimum value. So the brightness values are 10, 15, 20, 25, 30, 35, 40, 45, etc.. up to 1000.
Ranges are basically a compact way to represent a lot of equally spaced values.
The Discrete set of values lists all of the different values possible. For example:
The above means that the contrast has 3 settings, namely 0, 50, and 100. Resolution Values
The Device_Resolution_Values contains two strings before the listing of the numerical resolution values. The first string is either Discrete or Range, as defined above. The second string denotes the unit of measure that the numerical values will be based on. So for example, the following denotes a device that has resolution values of 100, 200, 300 DPI, and 100, 200, 300 dots per centimeter:
Device_Resolution_Type:Discrete,Inch,100,200,300 Device_Resolution_Type:Discrete,CM,100,200,300
Note that each device listed may have one or more Device_Resolution_Type's listed, since a single device may have multiple units of measure supported.
The following unit abbreviations are used:
A sample detail log for three devices named "Device1", "Device2", and "Device3" would look similar to the following:
Device_Count:3 Device_Name:CanoScan LiDE 500F Device_Name:TWAIN_32 Sample Source Device_Name:Joe's Great Scanner
Device_OK:CanoScan LiDE 500F Device_NumColors:3 Device_Color_Info:0;1 Device_Color_Info:1;8 Device_Color_Info:2;24 Device_Resolution_Type:Range,Inch,25,9600,1 Device_Resolution_Type:Range,CM,9.843,3780,0.3937 Device_Resolution_Type:Range,Pica,1,1,1 Device_Brightness_Type:Range,-1000,1000,7.874 Device_Gamma_Type:Discrete,2.26 Device_Contrast_Type:Range,-1000,1000,7.874 Device_Paper_Sizes:none,A4,B5,letter,A5,B6,executive,statement,businesscard Device_Feeder:1 Device_Feeder_Sensitive:1 Device_Imprinter:0 Device_Duplex:0 Device_UI_Controllable:1 Device_Job_Control:0
Device_OK:TWAIN_32 Sample Source Device_NumColors:1 Device_Color_Info:2;8,24 Device_Resolution_Type:Discrete,Inch,100 Device_Resolution_Type:Discrete,CM,100 Device_Resolution_Type:Discrete,Pica,100 Device_Brightness_Type:Range,-1000,1000,1000 Device_Gamma_Type:Unsupported Device_Contrast_Type:Range,-1000,1000,1000 Device_Paper_Sizes:letter Device_Feeder:1 Device_Feeder_Sensitive:1 Device_Imprinter:1 Device_Duplex:0 Device_UI_Controllable:1 Device_Job_Control:1
Device_Failure:Joe's Great Scanner Here is a breakdown of one of the scanners found, the "CanoScan LiDE 500F".
First, we know it was found, since it appears as one of the Device_Name types. We also know that it was opened successfully, since there is this: Device_OK:CanoScan LiDE 500F
After the Device_OK line is the following color information: Device_NumColors:3 Device_Color_Info:0;1 Device_Color_Info:1;8 Device_Color_Info:2;24
The "CanoScan LiDE 500F" can acquire using three different -color settings, therefore there are three Device_Color_Info entries. The first Device_Color_Info setting describes the color and bits-per-pixel valid for color 0. For color 0, the valid bits-per-pixel used is 1. Similarly, the second Device_Color_Info describes the valid bits-per-pixel values for color 1, and the third Device_Color_Info describes the valid bits-per-pixel for color 2. The color value can be used in the DTWAIN_TwainSave command-line option -color, and the bits-per-pixel can be used in the -bpp option.
For example, the following DTWAIN_TwainSave command is valid for the CanoScan LiDE 500F scanner: DTWAIN_Twainsave("-f test.bmp -color 1 -bpp 8");
The next entries describe the various resolution values. Device_Resolution_Type:Range,Inch,25,9600,1 Device_Resolution_Type:Range,CM,9.843,3780,0.3937 Device_Resolution_Type:Range,Pica,1,1,1
The "CanoScan LiDE 500F" can acquire resolutions using three different units of measure, namely Inch, CM (meaning centimeter), and Pica. Therefore there are three separate Device_Resolution_Type entries. The first Device_Resolution_Type has the Range type, denoting that the resolution values listed on that line describes a range of values.
Device_Resolution_Type:Range,Inch,25,9600,1
The values listed are 25, 9600, and 1. Since a Range type describes a minimum, maximum, and step values, the 96 denotes the minimum value of the range, the 9600 is the maximum value of the range, and the 1 denotes the step value. Therefore the valid resolution settings, given that the units are in inches are 25, 26, 27, 28, 29, ... up to 9600.
Device_Resolution_Type:Range,CM,9.843,3780,0.3937
This line states that for units of centimeters, the valid resolution values are defined by the range starting from 9.843 up to 3780, with a step value of 0.3937.
Device_Resolution_Type:Range,Pica,1,1,1
This line states that for units of pica, the valid resolution values are defined by the range starting from 1 up to 1 with a step value of 1. This is basically stating that there is only a single value that can be set if the units are in pica's, namely 1.
The next line in the listing denotes the supported brightness values:
Device_Brightness_Type:Range,-1000,1000,7.874
Note that the brightness values are stored in a Range. The minimum value in the range is -1000, the maximum value is 1000, and the step value used in the range is 7.874. This means that the following are valid brightness values: -1000, -992.126, -984.252, ... up to 1000 (the step value of 7.874 is added to each value).
The next line in the listing denotes the gamma values supported by the "CanoScan LiDE 500F":
Device_Gamma_Type:Discrete,2.26
Note that the type of values are Discrete, meaning that the values listed are the only values available. The only value listed is 2.26. This means that the gamma value is set for 2.26 and cannot be changed.
The next line in the listing denotes the available contrast values:
Device_Contrast_Type:Range,-1000,1000,7.874
Note that this is similar to the brightness values.
The next line denotes the paper sizes that are supported:
Device_Paper_Sizes:none,A4,B5,letter,A5,B6,executive,statement,businesscard
All of the supported paper sizes follow the Device_Paper_Sizes: text, and are comma separated. Therefore the CanoScan LiDE 500F supports "none", "A4", "B5", "letter", etc. sizes. Note that these sizes can be used in the -P option.
The final set of lines denote whether various aspects of the scanner are supported or unsupported:
Device_Feeder:1 Device_Feeder_Sensitive:1 Device_Imprinter:0 Device_Duplex:0 Device_UI_Controllable:1 Device_Job_Control:0
According to the lines above, the "CanoScan LiDE 500F" supports a document feeder, the feeder can detect if paper is inserted, there is no imprinter support, no duplex support, the user interface when acquiring images can be turned off by DTWAIN_TwainSave's -noui command, and there is no job control support. Note that 1 in the listing above means "is supported", and 0 means "unsupported". There is another listing in the details log for a device called the "Twain_32 Sample Source". Let's just go over some of the differences between what is listed for this device and what we saw previously with the CanoScan LiDE 500F scanner.
The Twain_32 Sample Source has only one color setting: Device_NumColors:1 Device_Color_Info:2;8,24
It only supports a color value of 2, but the bits-per-pixel can be either 8 or 24.
Note that the resolution values are represented as Discrete values:
Device_Resolution_Type:Discrete,Inch,100
This means that if the units are in inches, only one value can be used, and that is 100.
Also note that there is no gamma settings available for the "Twain_32 Sample Source":
Device_Gamma_Type:Unsupported There is also a third device that was found called "Joe's Great Scanner". Unfortunately, it either doesn't work, wasn't installed properly, or some other malfunction, since the following shows up:
Device_Failure:Joe's Great Scanner
This denotes that the scanner failed and cannot be used to acquire images. If this error occurs, it is for the reasons stated previously, namely the device wasn't installed properly, the software was installed but there is a malfunction in the device (maybe a cable is loose or not connected, or maybe the device is broken or missing), or some other software/hardware issue that DTWAIN_TwainSave cannot solve. |