This project has moved. For the latest updates, please go here.

How can I set TWDX_1PASSDUPLEX on duplex scanner?

Aug 22, 2014 at 1:31 PM
Helllo everyone,

I have this code to set duplex capability in a scanner.
var _duplexCapValue = (ushort)this._twain32.GetCap(TwCap.Duplex);

                    if (_duplexCapValue > 0)
                    {
                        // 0 - TWDX_NONE
                        // 1 - TWDX_1PASSDUPLEX
                        // 2 - TWDX_2PASSDUPLEX
                        
                        if ((this._twain32.IsCapSupported(TwCap.XferCount) & TwQC.Set) != null)
                        {
                            // Configura o valor de XferCount para -1
                            this._twain32.SetCap(TwCap.XferCount, -1);
                            this._twain32.SetCap(TwCap.DuplexEnabled, true);
                        }
                    }
My scanner can make both 1 pass and 2 passes. Seems that the default behavior is to make 2 passes always. How can I force it to use just one pass?
Coordinator
Aug 22, 2014 at 1:45 PM
Hello, erickalves05!
/* CAP_DUPLEXENABLED
*  The user can set the duplex option to be TRUE or FALSE.
*  If TRUE, the scanner scans both sides of a
*  paper; otherwise, the scanner will scan only one side of the image.
*/

// the scanner scans both sides of a paper
this._twain32.SetCap(TwCap.DuplexEnabled, true);

// the scanner will scan only one side of the image
this._twain32.SetCap(TwCap.DuplexEnabled, false);
See TWAIN 2.3 Specification and Saraff.Twain.NET documentation
Aug 22, 2014 at 1:59 PM
Hi, Saraff.

You're fast in your responses, thank you.

I can enable/disable the duplex capability. I'm using the example provided by you in another thread. The thing is my scanner is doing "3 passes" to adjust the page orientation.

For example:
It scan the front of the page. Then it scan the back of the page. That's ok.
Then it pulls the page one more time to make the front of the page face down.

If I use Windows to make the scan it only passes 2 times. How can I achieve this behaviour, if possible, with Saraff.Twain?
Coordinator
Aug 22, 2014 at 3:03 PM
Hello, erickalves05!
This behavior possible do with Saraff.Twain.NET because Saraff.Twain.NET provides full functionality for working with the capabilities. Nevertheless, the question of what features should be used, you must specify at twain.org.
Marked as answer by SARAFF on 8/27/2014 at 11:21 AM