Tattakashi123 / t

Automatically exported from code.google.com/p/twaindotnet
0 stars 0 forks source link

Cannot Set ICAP_PIXELTYPE For Some Scanner Models #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
TestApp of TwainDotNet cannot scan with some scanner models. (eg Avision 
AV220C2)

TwainProNet tries to set capability ICAP_PIXELTYPE with an Int16 value. 
But most scanners I have tested expects this capability value to be an 
UInt16 value only.

While setting any capability, TwainDotNet first gets the current value of 
the capability from the scanner software:
-----
public static int SetBasicCapability(Capabilities capability, int 
rawValue, TwainType twainType,
Identity applicationId, Identity sourceId)
        {
            var c = new Capability(capability, twainType, applicationId, 
sourceId);
            var capResult = c.GetBasicValue();
-----
All scanner models returns the current value of the ICAP_PIXELTYPE 
capability as an UInt16 (see the screenshot). But TwainDotNet tries to set 
this value with an Int16 value, which causes BadValue exception to be 
thrown for some scanner models. 

I modified TwainDotNet and set the ICAP_PIXELTYPE capability with an 
UInt16 value. After that, TwainDotNet worked with no problems with all the 
scanner models I have tested with.

This same problem is also mentioned here:

http://stackoverflow.com/questions/2050452/why-is-setting-pixeltype-not-
working-when-negotiating-twain-session

Original issue reported on code.google.com by xsnapson...@gmail.com on 11 Feb 2010 at 9:53

Attachments:

GoogleCodeExporter commented 8 years ago
I found that ICAP_PIXELTYPE must have a UInt16 value on Canon Windows 7 
drivers.  Vista 
/XP did not have throw an error.  Changed NegotiateColour in DataSource to set 
the 
capability this way:

Capability.SetBasicCapability(Capabilities.IPixelType, 
(UInt16)GetPixelType(scanSettings), TwainType.UInt16, _applicationId, SourceId);

Thanks for the info.

Original comment by david.h...@medianotion.com on 21 Feb 2010 at 4:47

GoogleCodeExporter commented 8 years ago

Original comment by luke.qui...@gmail.com on 21 Feb 2010 at 11:04