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



Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, September 5, 2007 1:22:52 AM(UTC)

Groups: Registered
Posts: 7

Good morning,

In my application I am using the LeadTools Twain classes in order to acquire information from papers but it doesn’t work correctly.

Please find below the description of the improper functioning and the code I have implemented.

1-     I acquire one paper and the application works correctly. I get an Image and I am able to save it on file system

2-     I acquire again the same paper but the application doesn’t work correctly. I get two copy of the same paper.

3-     I acquire the third time the same paper and I get three copy of the same paper.

It seems that the number of copy of paper I get is equals to the number of acquiring iteration that I am executing.

Here the code I implemented.

At the startup of the application I instantiate a TwainSession

TwainSession _session = new TwainSession(); 

When I acquire images from the scanner I call the method acquire(). Here follows the code of acquire() method.

_session.Startup(Controller.GetOwner(), "ITProject", "Lettura Ottica", "1.0", "Acquisizione", TwainStartupFlags.InitializeMultithreaded);


_session.SelectSource(“sorgente scanner selezionata”);

_session.AcquirePage += new EventHandler<TwainAcquirePageEventArgs>(SaveImage);


 Here follows the code of SaveImage() method.

 SaveImage(object e_, TwainAcquirePageEventArgs twainAcquireEvent_)

{_rasterCodecs.Save(image_, pathFile_, format_, bitPerPixel_);}


Could you help me to solve this problem?

Another question. Using the Twain classes, is it possible to check if the loader of scanner is empty or if it contains papers? I would avoid to acquire a blank page in case the loader doesn’t contain any paper.

Best regards 



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 : Wednesday, September 5, 2007 6:26:08 AM(UTC)


Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

To make sure that I am understanding you correctly, you are saying that when you scan the image and save it again that
the file saved on disk now contains multiple pages of the same exact image?

To look at a robust example of saving acquired pages, please check out the "C# Twain 32-bit" program and its corresponding project, CSTwainDemo.

If I did not understand your question properly, could you please tell me exactly where these duplicate images appear?
Also, could you create a small sample of the program which exhibits the problem and send it as an attachment.  Please
create a zip file of the attachment to ensure that our servers accept it.

As for your second question regarding if the loader is empty, there is a section in Raster .NET Class Library help
file which covers twain capabilities.  Specifically, you would be interested in the section on the GetCapability
method of the TwainSession object.  Here is some example code to test whether the feeder is loaded or not.

TwainCapability feederLoadedCapability = _twainSession.GetCapability(TwainCapabilityType.FeederLoaded,
bool feederLoaded = (bool)feederLoadedCapability.Value;
if (feederLoaded)
    MessageBox.Show("Please load paper.");
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-2024, Yet Another Forum.NET
This page was generated in 0.063 seconds.