Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, February 28, 2008 12:18:35 PM(UTC)

SergiiM  
SergiiM

Groups: Registered
Posts: 6


"I'm using Leadtools 15 with C#.net 2.0.

In my scanning application I'm using background thread to create, initialize, set some settings and call twainSesstion.AcquireFast(..) to keep GUI "alive".
So everything works fine with Xp Sp2 until Vista. So now I have quite bit a problem with my good old application.

All tests I perfom on Xerox DocuMate 510 (drivers are certified for both Xp and Vista)

1. When opens dialog for source selecting ( session.SelectSource("");)
            on Xp I have two choices:
                    -Xerox DocuMate 510
                    -Wia-Xerox DocuMate 510
            on Vista only one (actually if session initialized not on background thread I have two):
                     -Wia-Xerox DocuMate 510
2. When call  session.AcquireFast("test.tif",
TwainFastUserInterfaceFlags.Show, TwainTransferMode.Buffer, Leadtools.RasterImageFormat.CcittGroup4, 1, false, 0, true);
          on Xp "Scan using .. DocuMate 510.." is shown
          on Vista : TwainException: DS or DSM reported error....  is thrown.

Can you help me to clearify this????

Here is sample code:
    public partial class Form1 : Form    {

        private TwainSession session;
        private BackgroundWorker worker = new BackgroundWorker();

       public Form1()        {
            Unlock();   RasterCodecs.Startup();

            InitializeComponent();
            worker.DoWork += worker_DoWork;
       }

        private void worker_DoWork(object sender, DoWorkEventArgs e)        {
            CreateSession();
            try            {
                session.AcquireFast("test.tif", TwainFastUserInterfaceFlags.Show, TwainTransferMode.Buffer, Leadtools.RasterImageFormat.CcittGroup4, 1, false, 0, true);
            }
            catch (Exception ex)            {
                MessageBox.Show(ex.ToString());
            }
            CloseSession();
        }

        private void CreateSession()        {
            session = new TwainSession();
            session.EnableAcquireMultiPageEvent = true;
            session.AcquireMultiPage += session_AcquireMultiPage;
            session.Startup(new Form(), "", "", "", "", TwainStartupFlags.None);
            session.SelectSource("");
        }

        private void CloseSession()        {  
            session.AcquireMultiPage -=  session_AcquireMultiPage;
            session.Shutdown(); 
        }


        private void session_AcquireMultiPage(object sender, TwainAcquireMultiPageEventArgs e)        {
            if (InvokeRequired)
                BeginInvoke(new Action<TwainAcquireMultiPageEventArgs>(multiPage), new object[] { e });
            else
                multiPage(e);
        }

        private void multiPage(TwainAcquireMultiPageEventArgs e)        {
            label1.Text = string.Format("{0}::{1}::{2}", e.FileName, e.PageNumber, e.FinishScan);
        }

        private void button1_Click(object sender, EventArgs e)        {
            worker.RunWorkerAsync();
        }
    }
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, February 29, 2008 10:16:10 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


Even though you said the driver is certified for Vista, it still seems more like a driver issue.  This is my guess since the driver is only giving you the WIA in vista but gives both in XP.

What is the file version of Leadtools.dll that you're using?

Does the WIA driver work with fast twain on XP?

Can you use regular twain (Acquire vs. AcquireFast) with the WIA on Vista?

Try using a tool from Twain.org called Twacker.  To download Twacker, you can get it from http://www.twain.org/downloads.shtm .  It is at the bottom of the page.  In general, if a scanner works with Twacker, it should work with LEADTOOLS.  If the scanner has the same problem in Twacker, then the problem lies in the Twain driver and you should contact the manufacturer.
 
#3 Posted : Friday, February 29, 2008 10:52:26 AM(UTC)

SergiiM  
SergiiM

Groups: Registered
Posts: 6


I'm using Leadtools.dll runtime version v2.0.50727.

Let's be clear: driver does give me both sources on Vista but  only if  TwainSession initialization is on the main thread. And it gives me one (WIA only) if TwainSession is initialized on background thread.

WIA driver does not work properly with fast twain on XP that's why I never rely on it.

I can use regular twain with WIA on vista with TwainUserInterfaceFlags.None, but it crashes with TwainUserInterfaceFalgs.Show.

I tested regular twain and fast twain on hp 750 scanner and it did the same: everything works fine in the MAIN thread but crashes on BACKGROUND.

I will test my scanner by tracker today later and will post results.

Thank you for reply.

 
#4 Posted : Friday, February 29, 2008 11:19:18 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


By file version of Leadtools.dll I meant the Right click-> properties -> version tab.  It would be sometihng like 15.x.x.x.

Unfortunately this is looking more and more like a driver issue.  Unfortunately I don't think you'll be able to reproduce the threading problem with Twacker.  The fact that it works properly when using TwainuserInterfaceFlags.None but not with TwainuserInterfaceFlags.Show is also evidence of this because the dialogs are created and populated entirely by the TWAIN/WIA driver, LEADTOOLS is only calling the Twain API to show the interface and basically handing complete control over to the driver until it communicates back with either an error or events.
 
#5 Posted : Friday, February 29, 2008 11:28:36 AM(UTC)

SergiiM  
SergiiM

Groups: Registered
Posts: 6


File version 15.0.0.11

Ok than I guess problems with driver or with Vista system (couse I get the same error with different scanners).

I'm already working on workaround in my application...

And it would be realy nice if somebody can find driver or scanner wich can work in described scenario.

Anyway thanks.
 
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.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.333 seconds.