Questions to TwainEnableDuplex

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Questions to TwainEnableDuplex

Post by dixus » Tue Mar 23, 2010 7:23 pm

Hi,

i was wondering.... TwainEnableDuplex() stopped working in my test project. (it was returning true but the scanner didnt run in duplex mode) I moved the position of the command after some others like TwainSetIndicators, TwainsetAutoClose, TwianSetResolution and so on and it was working again.

So the first question ... what can be the reason for this?

second question: I use exactely the same code in another project. Here the method returns false:

GdLib.TwainGetLastResultCode() TWRC_FAILURE
GdLib.TwainGetLastConditionCode() TWCC_BADCAP

Any ideas?

Regards
dix

User avatar
Loïc
Site Admin
Posts: 5699
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Questions to TwainEnableDuplex

Post by Loïc » Tue Mar 23, 2010 7:30 pm

Hi Dix,

Maybe the scan was not in state 4 ?

If you want more investigation from use, please write us a code snippet to reproduce the behavior.

With best regards,

Loïc

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: Questions to TwainEnableDuplex

Post by dixus » Wed Mar 24, 2010 9:41 am

TwainGetState() returns TWAIN_SOURCE_OPEN


my twain init looks like this:

Code: Select all


            if (!OpenTwainDevice(Config.DeviceName))
                return false;

            if (GdLib.TwainIsAutoFeedAvailable())
                GdLib.TwainSetAutoFeed(true);

            if (GdLib.TwainIsAutoScanAvailable())
                GdLib.TwainSetAutoScan(true);

            GdLib.TwainSetAutomaticBorderDetection(true);
            GdLib.TwainSetAutomaticDiscardBlankPages(true);
            GdLib.TwainSetAutoSize(true);
            GdLib.TwainSetAutoBrightness(true);
            GdLib.TwainSetAutomaticRotation(true);
            GdLib.TwainSetAutomaticDeskew(true);
            GdLib.TwainSelectFeeder(true);
            GdLib.TwainSetHideUI(Config.HideTwainGui);

            if (Config.HideTwainGui) // true in this example
            {
                    GdLib.TwainSetBitDepthReduction(TwainBitDepthReduction.TWBR_DIFFUSION);
                    //less than 300 will not detect barcodes
                    GdLib.TwainSetResolution((int)Config.Resolution);
                    GdLib.TwainSetPixelType((TwainPixelType)Config.ImageType);
                    GdLib.TwainSetModalUI(false);
                    bool bSetBits;
                    switch (Config.ImageType)
                    {
                        case ScanImageType.TEXT:
                            bSetBits = GdLib.TwainSetBitDepth(1);
                            break;
                        case ScanImageType.GRAY:
                            bSetBits=GdLib.TwainSetBitDepth(8);
                            break;
                        default:
                            bSetBits=GdLib.TwainSetBitDepth(24);
                            break;
                    }
                    if (!bSetBits)
                        System.Diagnostics.Trace.WriteLine("Failed to set bitdepth!");
            }
           
            GdLib.TwainSetIndicators(Config.ShowIndicators);
            GdLib.TwainSetAutoSourceClose(false);

            if (!GdLib.TwainEnableDuplex(Config.EnableDuplex))
                [b]System.Diagnostics.Trace.WriteLine("Setting Duplex Property failed! ");[/b]
intresting is that the code works in a test project and in my app it doesnt.
Also (GdLib.TwainIsAutoScanAvailable()) returns true in my test project and false in my app.




greets
dix

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: Questions to TwainEnableDuplex

Post by dixus » Wed Mar 24, 2010 9:49 am

damn it. i got the reason. the working project uses not use the WIA driver. The other project uses for some reason that driver.

This is caused by GdLib.TwainGetSourceCount(IntPtr.Zero)

Its the same code. One project returns 2 sources, one 3. One the same machine?

How can that be? Its only returning the WIA drivers on my application...

regards

User avatar
Loïc
Site Admin
Posts: 5699
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Questions to TwainEnableDuplex

Post by Loïc » Wed Mar 24, 2010 6:37 pm

Hi,
How can that be? Its only returning the WIA drivers on my application...

I suppose that your TWAIN driver is not correctly installed.

With best regards,

Loïc

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: Questions to TwainEnableDuplex

Post by dixus » Wed Mar 24, 2010 7:32 pm

it is. i have 2 testproject that use the same DLL that returns the TwainCount.

One App says 2 devices found. The other says 3 devices found.

Probably its one specific setting. I couldnt figure out which one.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests