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);
_session.Shutdown();
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
--Andrea