LEADTOOLS Support
Imaging
Imaging SDK Questions
Problem Settings ImageHalftones Capability
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, July 5, 2007 11:25:12 PM(UTC)
Groups: Registered
Posts: 13
Hi,
I am working with LeadTools 15.0 version with Fujitsu 4120C2 scanner.
I get StackOverflowException when I try to set the ImageHalftones capabity of the scanner.
Sample Code:
private void SetHalfToneCapability()
{
try
{
string HalfTone= (string)Convert.ToString(_cmbHalftone.SelectedItem);
SetCapability(TwainCapabilityType.ImageHalftones, TwainItemType.Str32, HalfTone);
}
catch (Exception ex)
{
string errorMsg = string.Format("Set TwainCapabilityType.ImageHalftones returns {0}", ex.Message);
}
}
private void SetCapability(TwainCapabilityType capType, TwainItemType itemType, object data)
{
TwainCapability twnCap = new TwainCapability();
try
{
twnCap.Information.Type = capType;
twnCap.Information.ContainerType = TwainContainerType.OneValue;
twnCap.OneValueCapability.ItemType = itemType;
twnCap.OneValueCapability.Value = data;
_twainSession.SetCapability(twnCap, TwainSetCapabilityMode.Set);
}
catch (TwainException _twnEx)
{
MessageBox.Show(_twnEx.Message);
}
}
I dont get any error while setting other capabilities such as ImagePixelType,ImageBrightness,ImageSupportedSizes etc. I only get the error when i try to set the ImageHalftone capability. Is it my code problem or is it with this particular capability. While browsing through the forums i found a similar type of issue with Halftones but the LEadttols version they were using was 14.0
Please help me out in solving this issue.
Regards
Sridhar
#2
Posted
:
Sunday, July 8, 2007 10:19:15 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
To narrow down the problem possibilities, I need you to test the same capability (ICAP_HALFTONES) by using the standard Twain test utility from the Twain Working Group. This program is called Twacker and you can get it from here:
http://www.twain.org/devfiles/twack.zipJust try to get and set the same capability using the same twain driver (Fujitsu 4120C2 scanner) that you use using the Twacker application and let me know how it goes.
If you face any problem in using Twacker please let me know.
Regards,
Maen Badwan
LEADTOOLS Technical Support
#3
Posted
:
Thursday, July 19, 2007 11:49:45 PM(UTC)
Groups: Registered
Posts: 13
Hi
I have tested the Scanner (Fujitsu 4120C2 scanner) with the Twacker but there was no issue.
Anyway Can you please clarify me how & when to set ImageHalfTones in my application.
In the LeadTools 15.0 version SDK, there is an example (TwainDemo) where it displays the supported ImageHalfTones but does not set them. Can you please clarify why is ImageHalfTones capbility has been left out without setting when you are trying to set all the other Capabilites. In the same LeadTools Example when i try to set the HalfTones Capability i get the same error as i get in my application.
Please suggest me the how should i go about setting this capability.
Thank You
Sridhar
#4
Posted
:
Monday, July 23, 2007 1:27:57 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
I checked the same issue on my side (using your code) and didn't notice the problem.
I am attaching the project that I used to check this issue.
Can you please recheck the same issue on your side using the attached project and let me know how it goes?
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#5
Posted
:
Tuesday, July 31, 2007 12:46:01 AM(UTC)
Groups: Registered
Posts: 13
Hi,
I used the Project sent by you and tested it on the Scanner i.e., Fujitsu 4120C2 Scanner, but I got the same error which I have metioned earlier and for your reference please find attached screen shots that occur when I try to set the ImageHalfTones Capability. I am using LeadTools 15.0 version.
Screen Shot 1 occurs when i hit the Set ICAP_HALFTONES capbility button
Screen Shot 2 occurs when i close the window after getting the Error as shown in Screen Shot 1
Please help me in solving out this issue.
Regards
Sridhar
#6
Posted
:
Thursday, August 2, 2007 9:39:47 AM(UTC)
Groups: Registered, Tech Support
Posts: 207
Was thanked: 3 time(s) in 3 post(s)
The error you're getting is an Access Violation. There appears to be a flaw in this demo. I have re-wrote it to only try and set the ICAP_HALFTONES capability. It checks to see if the source is the sample source that ships with the Twain Tool Kit (found at
www.twain.org) or the Fujitsu Scanner. With this demo I was able to set the ICAP_HALFTONES capability with the sample source shipped with Twain Tool Kit, but not the Fujitsu driver. The error I received was that the Twain driver was in an Invalid State. This seems to be a bogus error.
The scanner I am testing with is the Fujitsu fi-5120C. Most scanner manufacturers use the same Twain Driver for muliple scanners in the same family. Most likely we are using the same Twain Driver.
You can enable logging by the driver through a setting in the registry. Do this on your machine by setting the Level key to 4. I have attached a screen shot of where this key is in the registry. Once set to 4. Use Twacker to try and set the capabilty. Once you have set the capability, close Twacker. Next browse to your \Windows\twain_32\Fjscan32 directory and send me the file Fjtw32.log.
I am curious to see what value the Fujitsu Twain driver is getting on your machine.
On my machine Twacker fails and value is some weird symbol. Using LEADTOOLS the value is correct yet the Fujitsu driver fails with TWCC_BADVALUE. I have emailed Fujitsu regarding this and hope to receive some feedback to them as to why their Twain Driver 1) will not work with Twacker and 2) why it does not accept our valid value.
Once I hear back from them I will post again. Until then there is no workaround to this as the application created by the creators of the Twain Specification (www.twain.org) does not work with this driver.
![](file:///C:/DOCUME%7E1/TRAVIS%7E1.LEA/LOCALS%7E1/Temp/moz-screenshot.jpg)
Travis Montgomery
Senior Sales Engineer
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
LEADTOOLS Support
Imaging
Imaging SDK Questions
Problem Settings ImageHalftones Capability
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.