How to Scan Multiple Pages into 1 document using LeadTools v 13 and VB6?

Scanning/Capture

How to Scan Multiple Pages into 1 document using LeadTools v 13 and VB6?


selen@ctcsurge.com 01-26-2010, 11:37
Yes, VB6! Currently, we're capturing images using the TwainAcquire method, but as soon as page 1 is scanned, this method returns and the 1 page is captured, and the scanner software does not offer the usual option of scanning another page.

What properties do we need to set , and events do we need to catch, to scan multiple pages into 1?
Are there code examples?

Thank you.

Re: How to Scan Multiple Pages into 1 document using LeadTools v 13 and VB6?


Walter 01-26-2010, 17:18
Hello,

Are you using the ActiveX or COM interface for communicating with the scanner?

If you're using the ActiveX interface, are you setting the TwainMaxPages property (L_CAP_XFERCOUNT capability)? If so, what value are you setting?

The TwainPage event should be fired once per page that is scanned. If the MaxPages/TransferCount is set to -1 (default value), it should scan all pages in the feeder. If it is set to 1 or more, then one event per page should be fired.

When the TwainPage event is generated, the bitmap the control has must be saved to memory or file so that the next TwainPage event can be handled. One method of handling this is to use a separate invisible control specifically for scanning. When the bitmap is provided from the scanner, use the InsertBitmapListItem on the primary visible control on the form with the invisible control's bitmap property, to append the page into the control.

For more information about scanning with TWAIN, I recommend checking out the help file topic "Loading an Image from a TWAIN Device" or "How to Acquire from the TWAIN Source"

There are code examples in the installed v13 help files. If you search for "Twain" or "TWainAcquire" you should be able to find examples illustrating acquiring with TWAIN.
Walter
Technical Support
LEADTOOLS
support@leadtools.com

Re: How to Scan Multiple Pages into 1 document using LeadTools v 13 and VB6?


selen@ctcsurge.com 01-27-2010, 13:05
Thank you.
I'm using ActiveX.

Once I have the BitmapList, do I need to do anything special to save all the images to a single file?

Re: How to Scan Multiple Pages into 1 document using LeadTools v 13 and VB6?


Walter 01-27-2010, 19:37
To save the images to file, you can use the Main Control's Save method. The method will only save the current bitmap, so you will need to cycle through each page. You can do this by modifying the BitmapListIndex property.

If you save to a multipage format like TIF, use the iModify parameter to indicate whether you want to append or insert the images to the file. You can also indicate to overwrite the file, which you may want to do with the first page if the file already exists.
Walter
Technical Support
LEADTOOLS
support@leadtools.com

Re: How to Scan Multiple Pages into 1 document using LeadTools v 13 and VB6?


selen@ctcsurge.com 01-28-2010, 16:32
Thank you! This was a big help.

Re: How to Scan Multiple Pages into 1 document using LeadTools v 13 and VB6?


selen@ctcsurge.com 01-29-2010, 11:23
After saving the multiple pages to a single file like this:
For intI = 1 To LEAD2.BitmapListCount
LEAD2.BitmapListIndex = intI - 1
LEAD2.save "IMAGE.TIF",3,32,128,SAVE_APPEND
Next intI

When I open the TIF file with Windows Picture and Fax Viewer, it's blank, but LEAD and some other apps like MsPaint are able to display it. Any ideas why that would be?

Re: How to Scan Multiple Pages into 1 document using LeadTools v 13 and VB6?


Walter 01-29-2010, 11:44
The TIFF file format supports different compressions internally, but not all viewers support all of these different compressions.

For supporting the widest range of viewers, I would suggest using LZW compression. So try using the following:

LEAD2.save "IMAGE.TIF", FILE_TIFLZW, 32, 128, SAVE_APPEND


Windows Picture and Fax Viewer supports LZW, so you should be able to see the new files with this format.
Walter
Technical Support
LEADTOOLS
support@leadtools.com

Re: How to Scan Multiple Pages into 1 document using LeadTools v 13 and VB6?


selen@ctcsurge.com 01-29-2010, 14:53
That created a much smaller file (almost 1/10, which obviously is a really good thing) but Windows Picture and Fax Viewer still displays blank.
Are there any file properties, etc. that I could check or send you? Or maybe the file itself?

Re: How to Scan Multiple Pages into 1 document using LeadTools v 13 and VB6?


Walter 02-01-2010, 15:00
Hello,

I'm attaching a sample TifLZW file that I'm able to open up in Windows Picture and Fax Viewer. I would suggest testing with our main Imaging demo to make sure the file format indicates that it's using TIFF /w LZW compression. As far as I know, this format should work within this application.

If you're not able to reproduce this, please send me a small sample application that reproduces this issue so I can test this further here.

NOTE: If you are attaching a project or file to the forums...
1.) Zip the file(s) up.
2.) Make sure it is less than 5 MB. If it is larger, please send an email to support@leadtools.com and we'll send you FTP instructions.
3.) Remove ANY AND ALL unlock codes and LEADTOOLS DLLs.
4.) Do not click the preview button, the attachment will not show up when you post it.

If you do not wish to post your file(s) on the forum since they are publically viewable, please send an email to support@leadtools.com and make sure that you include a link to this forum post.
Walter
Technical Support
LEADTOOLS
support@leadtools.com

Re: How to Scan Multiple Pages into 1 document using LeadTools v 13 and VB6?


selen@ctcsurge.com 02-17-2010, 10:36
I used Twain Raster Imageing Active Twain demo to capture the attached file from an HP scanner with TIF 32-bit file type and LZW RGB subfile type, and Paint opens the file, but not Pic. and Fax Viewer.

Re: How to Scan Multiple Pages into 1 document using LeadTools v 13 and VB6?


Walter 02-17-2010, 16:28
Hello,

We've received your email in ticket number 2010021710000641. I will reply regarding this issue via email.
Walter
Technical Support
LEADTOOLS
support@leadtools.com
Copyright LEAD Technologies, Inc. 2013

Powered by Community Server, by Telligent Systems