Setting Twain features fails
Setting Twain features fails
I'm using the newest toolkit (just downloaded Sept 30) and I have code that checks, after opening the source, TwainIsAutomaticDiscardBlankPageAvailable and, if True, sets it to False. I then recheck the value and see that it is still True. I checked the Twain log file and see that there's a return of TWCC_BADVALUE. I've also tried Deskew and a few others (the scanner settings screen for the scanner fi-5120c shows all of these) and see the same results.
Is there some additional call that I should be making?
Thanks,
George
Is there some additional call that I should be making?
Thanks,
George
Re: Setting Twain features fails
Hi George,
I think you are making confusion between TwainIsAutomaticDiscardBlankPagesAvailable() & TwainIsAutomaticDiscardBlankPagesEnabled()
TwainIsAutomaticDiscardBlankPagesAvailable():
TwainIsAutomaticDiscardBlankPagesEnabled():
Loïc
I think you are making confusion between TwainIsAutomaticDiscardBlankPagesAvailable() & TwainIsAutomaticDiscardBlankPagesEnabled()
TwainIsAutomaticDiscardBlankPagesAvailable():
Asks to the opened source if she can support the Automatic discard blank images capability
TwainIsAutomaticDiscardBlankPagesEnabled():
Kind regards,Asks to the opened source if the Automatic discard blank images capability is enabled or not.
Loïc
Re: Setting Twain features fails
Sorry, I wasn't specific enough... I am using the IsAvailable item to see if the Twain source says it support the feature. I then use IsEnabled to see if it is on or not (True or False), then I try to change the state using the Set for the feature and recheck the IsEnabled value and that is when I see that it is not set.
Thanks!
Thanks!
Re: Setting Twain features fails
OK.
So what is the return value of:
TwainIsAutomaticDiscardBlankPagesAvailable()
TwainIsAutomaticDiscardBlankPagesEnabled()
TwainSetAutomaticDiscardBlankPages()
Kind regards,
Loïc
So what is the return value of:
TwainIsAutomaticDiscardBlankPagesAvailable()
TwainIsAutomaticDiscardBlankPagesEnabled()
TwainSetAutomaticDiscardBlankPages()
Kind regards,
Loïc
Re: Setting Twain features fails
When I check TwainIsAutomaticDiscardBlankPagesAvailable() I get True, when I check TwainIsAutomaticDiscardBlankPagesEnabled() I get True and if I call TwainSetAutomaticDiscardBlankPages(False) I get the BADVALUE return. I've noticed that the return for TwainIsAutomaticDiscardBlankPagesEnabled() doesn't seem to correlate with the on-screen setting the scanner settings screen for the source. Should it?
Thanks
Thanks
Re: Setting Twain features fails
Hi,
We fixed a bug with this feature.
Please, download the latest edition and tell us if the problem persists.
Kind regards,
Loïc
We fixed a bug with this feature.
Please, download the latest edition and tell us if the problem persists.
Kind regards,
Loïc
Re: Setting Twain features fails
Thanks! Will let you know if the problem is still there with the new version.
Re: Setting Twain features fails
I'm still seeing inconsistent results... if I use the code
what I see at the first call to TwainIsAutomaticDiscardBlankPagesEnabled is True (even though the source settings screen shows the option as off). After the TwainSetAutomaticDiscardBlankPages(False)
call the second check still shows True but the scan process acts if it is off (blank pages are kept). If I change to TwainSetAutomaticDiscardBlankPages(True) then the interface still shows off but the program responds as if it is Off (blank pages are dropped).
The log file shows SUCCESS codes all around now.
Thanks!
Code: Select all
oGdPictureImaging.TwainLogStart("C:\working\testset.log")
If oGdPictureImaging.TwainIsAutomaticDiscardBlankPagesAvailable Then
LogFile("BPD is currently " + oGdPictureImaging.TwainIsAutomaticDiscardBlankPagesEnabled.ToString)
oGdPictureImaging.TwainSetAutomaticDiscardBlankPages(False)
LogFile("BPD is now set to " + oGdPictureImaging.TwainIsAutomaticDiscardBlankPagesEnabled.ToString)
End If
oGdPictureImaging.TwainLogStop()
call the second check still shows True but the scan process acts if it is off (blank pages are kept). If I change to TwainSetAutomaticDiscardBlankPages(True) then the interface still shows off but the program responds as if it is Off (blank pages are dropped).
The log file shows SUCCESS codes all around now.
Thanks!
Re: Setting Twain features fails
Hi,
I checked our source code and we are meeting the TWAIN specifications regarding ICAP_AUTODISCARDBLANKPAGES capability.
Therefore, I suspect your scanner to deal with this capability by another way...
To investigate, give us the returned value of this call:
And this one:
Kind regards,
Loïc
I checked our source code and we are meeting the TWAIN specifications regarding ICAP_AUTODISCARDBLANKPAGES capability.
Therefore, I suspect your scanner to deal with this capability by another way...
To investigate, give us the returned value of this call:
Code: Select all
Dim CapVal As Double = 0
oGdPictureImaging.TwainGetCapCurrentNumeric(TwainCapabilities.ICAP_AUTODISCARDBLANKPAGES, CapVal)
MsgBox(CapVal)
Code: Select all
For i As Integer = 1 To oGdPictureImaging.TwainGetAvailableCapValuesCount(TwainCapabilities.ICAP_AUTODISCARDBLANKPAGES)
MsgBox(oGdPictureImaging.TwainGetAvailableCapValueNoNumeric(TwainCapabilities.ICAP_AUTODISCARDBLANKPAGES, i))
Next
Kind regards,
Loïc
Re: Setting Twain features fails
The values are:
Value for TwainCapabilities.ICAP_AUTODISCARDBLANKPAGES 4294967294 at 10/5/2009 1:02:57 PM
entry 1 has a value of 4294967294 at 10/5/2009 1:02:57 PM
entry 2 has a value of 4294967295 at 10/5/2009 1:02:57 PM
Value for TwainCapabilities.ICAP_AUTODISCARDBLANKPAGES 4294967294 at 10/5/2009 1:02:57 PM
entry 1 has a value of 4294967294 at 10/5/2009 1:02:57 PM
entry 2 has a value of 4294967295 at 10/5/2009 1:02:57 PM
Re: Setting Twain features fails
OK I understood.
Please use these function for your scanner. Let me know if it is working.
Kind regards,
Loïc
Please use these function for your scanner. Let me know if it is working.
Code: Select all
Public Function TwainSetAutomaticDiscardBlankPages(ByVal AutoDiscard As Boolean) As Boolean
Return oGdPictureImaging.TwainSetCapCurrentNumeric(TwainCapabilities.ICAP_AUTODISCARDBLANKPAGES, oGdPictureImaging.TwainGetCapItemType(TwainCapabilities.ICAP_AUTODISCARDBLANKPAGES), CInt(IIf(AutoDiscard, 4294967295 , 4294967294)))
End Function
Public Function TwainIsAutomaticDiscardBlankPagesEnabled() As Boolean
Dim bEnabled As Boolean = False
Dim nDiscardBlankPage As Double
If oGdPictureImaging.TwainGetCapCurrentNumeric(TwainCapabilities.ICAP_AUTODISCARDBLANKPAGES, nDiscardBlankPage) Then bEnabled = (nDiscardBlankPage = 4294967295)
Return bEnabled
End Function
Loïc
Re: Setting Twain features fails
I tried the code that you sent but when I make a call to the TwainSetAutomaticDiscardBlankPages function it crashes the program in such a way that I have to reboot to be able to use the Twain source again. I'm going to have to drop research of this for a bit while I work on another project but will return to it shortly.
Thanks.
Thanks.
Re: Setting Twain features fails
I'm having this same problem with one of my scanners. My original code (C#):
Worked fine in the Fujitsu fi-4340C but it didn't in a Fujitsu fi-6130. It doesn't throw any errors, just doesn't work.
So, using the code from the previous posts, I built this new one, based also on the twain specs:
This new code also works with the Fujitsu fi-4340C but it doesn't with the Fujitsu fi-6130.
When using the values 4294967295 and 4294967294 (values returned by TwainGetAvailableCapValuesCount(TwainCapabilities.ICAP_AUTODISCARDBLANKPAGES)) for both scanners, it throws the exception: {"Arithmetic operation resulted in an overflow."}.
Any ideias how to solve this? When using the driver's UI, the option is available and works fine.
Twain specs used:
Code: Select all
if(oGdPictureImaging.TwainIsAutomaticDiscardBlankPagesAvailable())
{
if(!oGdPictureImaging.TwainSetAutomaticDiscardBlankPages(_bAutomaticDiscardBlankPages))
{ new ScanningException(Constants.ErrorCode.Twain_ErrorEnablingAutomaticDiscardBlankPages); }
}
So, using the code from the previous posts, I built this new one, based also on the twain specs:
Code: Select all
if(oGdPictureImaging.TwainIsAutomaticDiscardBlankPagesAvailable())
{
double selectValue = _bAutomaticDiscardBlankPages ? (double) -1 : (double) -2;
if(!oGdPictureImaging.TwainSetCapCurrentNumeric(TwainCapabilities.ICAP_AUTODISCARDBLANKPAGES, Controler.Imaging.TwainGetCapItemType(TwainCapabilities.ICAP_AUTODISCARDBLANKPAGES), selectValue))
{ new ScanningException(Constants.ErrorCode.Twain_ErrorEnablingAutomaticDiscardBlankPages); }
}
When using the values 4294967295 and 4294967294 (values returned by TwainGetAvailableCapValuesCount(TwainCapabilities.ICAP_AUTODISCARDBLANKPAGES)) for both scanners, it throws the exception: {"Arithmetic operation resulted in an overflow."}.
Any ideias how to solve this? When using the driver's UI, the option is available and works fine.
Twain specs used:
ICAP_AUTODISCARDBLANKPAGES
Constant Numeric ID
------------- -----------
TWBP_DISABLE -2
TWBP_AUTO -1
Re: Setting Twain features fails
Hello,
We've have been able to reproduce and fix the problem. The next 9.2.1 release will include the fix.
With best regards,
Loïc
We've have been able to reproduce and fix the problem. The next 9.2.1 release will include the fix.
With best regards,
Loïc
Who is online
Users browsing this forum: No registered users and 1 guest