ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 scanning several pages

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Josir Posted - Sep 01 2011 : 12:17:20
Hi folks,

I am trying to scan several pages using TWAIN.

procedure TfrmMain.Scan;
begin
with ImageEnView1.IO do
begin
Params.DPIX := 300;
Params.DPIY := 300;
Params.BitsPerSample := 1;
Params.SamplesPerPixel := 1;
Params.TIFF_Compression := ioTIFF_G4FAX;
ImageEnView1.IO.OnAcquireBitmap := ImageIOAcquireBitmap;
if not BtnSave.Enabled then
begin
TWainParams.VisibleDialog:=False;
if AcquireOpen then
MostraMensagem('Scanner initialized');
end;
end;

procedure TfrmMain.ImageIOAcquireBitmap(Sender: TObject;
ABitmap: TIEBitmap; var Handled: Boolean);
var NomeArquivo:String;
begin
NomeArquivo := EditDest.Text + Filename + '_' + StrZero(Counter,4)+'.tif';
ImageIO.AttachedIEBitmap := ABitmap;
ImageIO.SaveToFileTIFF( NomeArquivo );
Log.Items.Add('Arquivo '+NomeArquivo+' importado');
Inc( Counter );
Handled := false;
end;

Everything works fine on the first scan.
When I put more papers and click scan, AcquireOpen does not start scanning.

What I am doing wrong?
8   L A T E S T    R E P L I E S    (Newest First)
Josir Posted - Sep 01 2011 : 14:39:28
I got it!!

It works when I issue:

ImageEnView1.IO.AcquireClose;
ImageEnView1.IO.TWainParams.FreeResources;

before issue AcquireOpen.

Thanks for you support.
Josir.
Josir Posted - Sep 01 2011 : 14:10:59
FORGET the last question. Is there any difference between ImageEnView.AcquireOpen and ImageEnView.IO.AcquireOpen ?

This tests are driving my nuts!!!

Josir Posted - Sep 01 2011 : 14:07:26
About AcquireClose: On my SCAN button, I always issue AcquireClose but it does not fix the problem.

About Params.AutoFeed and Params.FeederEnabled. Both are true;

About TImageEnMView: I didnīt realize how I can control the filenames using this component. Is there any example on saving several files using this component ?

Is there any difference between ImageEnView.AcquireOpen and ImageEnView.IO.AcquireOpen ?


Josir Posted - Sep 01 2011 : 13:59:20
I did another test to validate my thesis. I wrote 2 executables: program1 has just has a SCAN button with no reference to ImageEn and program2 has the scanning logic cited on the original post.

When I press the start button, program1 just calls program2.exe that makes the scan and verifies (via Timer) if the images continues to arrive. After 5 seconds without receiving images, it closes iself.

Program1.exe on the other hand verifies if program2.exe is running. When it "realizes" that program2 is not running, it enables the SCAN button again.

That means that when Program2 closes itself, it cleans some variable or structure that frees the scanner.

What I need to know is what do I have to free in order to liberate the scanner to start again.
fab Posted - Sep 01 2011 : 13:58:22
AcquireOpen needs to terminate with AcquireClose, otherwise it doesn't work well. Anyway it needs the dialog to be shown.

quote:
Is there another way to acquire several pages a second time instead of showing the scanner dialog ?



Use TImageEnMView.
Josir Posted - Sep 01 2011 : 13:35:10
Fixing the last post:

I think I didnīt explain the problem well. The first time I scan, I put 10 pages and all 10 were scanned correctly. But if I put more 10 pages and click start button again, nothing happens.

The more interesting thing is that if I close the program and start it again without touching the scan, it continues to scan correctly. It seems that there are some internal variable that locks the scanner from start again.

Is this a AcquireOpen limitation ?

Is there another way to acquire several pages a second time instead of showing the scanner dialog ?
Josir Posted - Sep 01 2011 : 13:33:08
Hi Fabrizio, thanks for your quick answer.

I think I didnīt explain the problem well. The first time I scan, I put 10 pages and all 10 were scanned correctly. But if I put more 10 pages and start my program again, nothing happens.

The more interesting thing is that if I close the program and start it again without touching the scan, it continues to scan correctly. It seems that there are some internal variable that locks the scanner from start again.

Is this a AcquireOpen limitation ?

Is there another way to acquire several pages a second time instead of showing the scanner dialog ?
fab Posted - Sep 01 2011 : 13:14:46
Hello,
you should leave the scanner dialog visible when use AcquireOpen/AcquireClose, because the event OnAcquireBitmap should be called each time the user click on "Acquire" button of that dialog (and for each page acquired).

Anyway to support multiple pages you should set also:
Params.AutoFeed := true;
Params.FeederEnabled := true;