Home › Forums › TWAIN Classic › Duplex scanning both side
- This topic has 22 replies, 6 voices, and was last updated 11 years, 9 months ago by Isuru.
- AuthorPosts
How do you scan both sides by a duplex scanner.
By default it scans one side and moves to next page for the same side…
Any Idea…………….i guess there is some capability called duplex which you have to set to TRUE – check with cap_supportedcaps
yeah, what he said. and then –
@twainspec – pg541 wrote:
Duplex Control
If an Application finds that CAP_DUPLEX exists and it indicates that duplex scanning is
supported, then the Application should negotiate CAP_DUPLEXENABLED. If
CAP_DUPLEXENABLED is set to FALSE, then DAT_FILESYSTEM capable Sources should not
report any TWFY_CAMERABOTTOM devices in the root directory. If the Source is set to a
TWFY_CAMERABOTTOM device at the time that CAP_DUPLEXENABLED is set to FALSE,
then it should automatically change itself to the corresponding TWFY_CAMERATOP device.then read pgs 375 & 376 and then search the spec for ‘duplex’.
If you have more questions, just ask.
public TwCapability( TwCap cap, short sval )
{
Cap = (short) cap;
ConType = (short) TwOn.One;
hContainer = Twain.GlobalAlloc( 0x42, 6 );
IntPtr pv = Twain.GlobalLock( hContainer );
Marshal.WriteInt16( pv, 0, (short) TwType.Int16 );
Marshal.WriteInt32( pv, 2, (int) sval );
Twain.GlobalUnlock( Handle);
}cap = new TwCapability(TwCap.CAP_DUPLEXENABLED, 1); //TwCap.CAP_DUPLEXENABLED=0x1013
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, cap);
it says rc = Success,
Then,
cap = new TwCapability( TwCap.CAP_DUPLEX, 4114 ); //TwCap.CAP_DUPLEX=0x1012
rc = DScap( appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Get, cap );
Also says SuccessBut it Scans only one side.
Scanner’s OEM interface and TWACKER 32 sample app works fine.
Just couldn’t get C# tests working..
have you checked after setting CAP_DUPLEXENABLED if it was really set correctly? I’m not very good in reading code, but I can’t find where you set the value of your cap-structure for CAP_DUPLEXENABLED to TRUE.
why are you checking CAP_DUPLEX after setting CAP_DUPLEXENABLED?as far as I understand gabe’s post, you have to check CAP_DUPLEX first in order to find out if duplex scanning is supported and then you can set CAP_DUPLEXENABLED to True
seems to me that sending 2 Setting them both and getting rc=success for both should be almost as good as checking afterward.
The driver should have send a checkstatus or failure if it didn’t like the set. But it never hurts to recheck that the Set operation was successfully by followin git up with a Get to make sure.the first thing that catches my eye is the twCapability class definition.
I don’t think this definition will work for come of the caps
hContainer = Twain.GlobalAlloc( 0x42, 6 );
the second parameter, the 6, isn’t always going to be 6. I don’t think 6 is correct here. Seems that for a bool inside a oneVal this should be 4 (but some mornings I can’t count to 6 without taking off my socks so double check before you take my word for it). I don’t think this is why your deplex code doesn’t return 2 images, just that in other cases your 6 won’t be big enough – frame and string values won’t fix.
But then why aren’t you getting more images back..?
What is the name of the device you’re using?.
Guys.
Thanks much for your replies. I figured it out. I had two functions which one for settings and other for acquire. Twain treats each openDS as new session and hey probably forgets what was the settings on previous openDS… kind of thing.. whatever!, when I did the settings in the same function leading to acquire.. WHOA! mm thats first time I could my app scanned to both side.. and two images!!
I have got something like that:
eTwRC rc;
IntPtr hbitmap;
rc = DSixfer(m_appID, m_srcDS, eTwDG.Image, eTwDAT.ImageNativeXfer, eTwMSG.Get, ref hbitmap);
cGdiPlus.ConvertDibToBmp(ref bmp, ref hbitmap);Can someone tell me how I can get the second image when I scan in DUPLEX mode?
same way you get the second image if you’re not in duplex mode
It’s working. Thanks a lot 🙂
It’s working with Fujitsu fi-5120C, but not with Canon DR-2050C. Somebody knows why?
maybe, but only if you say ‘how’ it isn’t working…
are you getting an rc==failure or is it throwing an exception or doe sit report success but do nothing… does the canon support the triplet you attempting?if I were to guess, I would say it doesn’t work with the Canon because the Canon’s twain drivers don’t support what you’re attempting, but say how it isn’t working and we’ll go from there.
.
First:
rc = DSixfer(m_appID, m_srcDS, eTwDG.Image, eTwDAT.ImageNativeXfer, eTwMSG.Get, ref hbitmap);rc == eTwRC.XferDone
Second:
rc = DSixfer(m_appID, m_srcDS, eTwDG.Image, eTwDAT.ImageNativeXfer, eTwMSG.Get, ref hbitmap2);rc == eTwRC.Failure
Twirl: TWAIN Source Probe
Canon DR-2050C TWAIN
CAP_DUPLEX
GET: uint16 ONEVALUE = TWDX_1PASSDUPLEX
CURRENT: uint16 ONEVALUE = TWDX_1PASSDUPLEX
DEFAULT: uint16 ONEVALUE = TWDX_1PASSDUPLEXtriplet?? What does it means in this case?
OK, now I know what is triplet in this case. Yes, Canon supports this triplet.ok, rc==failure. what condition code do you get right after the rc==failure?
.
if(rc != eTwRC.XferDone)
{
rc = DSpxfer(m_appID, m_srcDS, eTwDG.Control, eTwDAT.PendingXfers, eTwMSG.Reset, pxfr);
return;
}
rc = DSpxfer(m_appID, m_srcDS, eTwDG.Control, eTwDAT.PendingXfers, eTwMSG.EndXfer, pxfr);
{
rc = DSpxfer(m_appID, m_srcDS, eTwDG.Control, eTwDAT.PendingXfers, eTwMSG.Reset, pxfr);
return;
}- AuthorPosts