Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone know of a good / free Twain / VB interface?? 2

Status
Not open for further replies.

KaiA

Programmer
May 14, 2002
5
GB
Hi Folks,
I am working on a VB (well actually its VBA) application and I am hoping to integrate a button to scan a document and save it when clicked. Theres nothing really special here, the scanner is an Epson Perfection 640U and I am using a TWAIN driver. The images will always be stored in the same location but with an sequential file number.
ON the web so far I can find many off the shelf tools to buy but I am hoping to find some free/sharewhare.
Obviously VB6/OLE/Image Doc can store an image but I cant seem to get it to do anything like activate the scanner or save the doc. I don't think the standard OLE for Imaging has this functionality. Am I wrong??
Thanks
Kai
 
If I'm not mistaken, the Kodak Image Scan control should already be available to you in VB6. Select the "Project" menu, then "Components". You should see it listed ( along with the Kodak image edit control, the admin control, and the thumbnail control ). Add it to you project. You can set the properties to display to the screen, display and save to a file, and others. This looks like it will do what you want.

HTH

Robert
 
Thanks Vampire, I'll give it a try
 
Vampire....
That worked a treat. Only thing, do you (or anyone else) by any chance know how to handle multiple pages?? I am hoping to set it where you maybe put in the first page, it scans it, then you put in the second etc then when you are done you click 'save' or something similar and it saves them all as 1 file.
I see that the ImgScan object has pagecount and page properties, but as I don't have the help file I am strugging. Any help would be greatly received.
Thanks
Kai
 
Hmm. The help is built into windows, so if you highlight the control and hit F1 you should get it.

If not, here is the help for the page count and multipage properties.

PageCount
Returns or sets the number of pages per image file.

Applies To

Image Scan control

Syntax

object.PageCount[=pagenumber]

Data Type

Long

Remarks

This property is generally used with scanners that have an automatic document feeder (ADF), and you are scanning multiple documents to a template.
Set this property to the page count of fixed length files. You must also specify the path to the template (for example c:\scan\images\img, where the Template name is img) using the Image property.
If PageCount is set to zero, pages are scanned into one or more files, as determined by the setting of the MultiPage property.

If the MultiPage property is set to False, then PageCount images are scanned, one image per file.



MultiPage Property
Returns or sets whether one or more image pages will be scanned to an image file.

Applies To

Image Scan control

Syntax

object.MultiPage[= {True|False}]

Data Type

Boolean

Setting Description
True Scans multiple image pages to an image file.
False (default)Scans a single image page to an image file.

Remarks

This property is generally used with scanners that have an automatic document feeder (ADF), and you are scanning multiple documents to a template.
Use this property when appending or inserting pages into a document.

HTH,

Robert
 
Once again Vampire, many thanks. This sounds like it should help me out, I will give it a try. Incidentally, regards the help file, this is a bit of a mystery. I used the Kodak ImgScan control which seemed to already exist in my edition of VB. When I use f1 for help (with the control selected) I get a message saying that c:\winnit\help\omgocxd.hlp file is not found. It also draws a blank when I do a manual search on my hard drive.
When I look on the web I find that the file comes with the windows / Kodak imaging software, which I don't have. Am I mistaken??
Thanks,
Kai
 
I don't have that file on my machine either, and yet the help for the control works fine. Unless there is a typo in the file name you wrote. Other than that, I don't have an answer for you. You might try looking on the web for that file in particular and see if you can download it from somewhere.

Robert
 
Thanks Robert.
There was no typo, as I pasted the message from the error box. I did try to get the file from the web but am struggling, but as your help has got me through the problem I think I will leave it for now.
Thanks once again, much appreciated.
Kai
 
What do you do on windows XP?
imgscan.ocx and the rest of the Kodak stuf is from earlier versions of windows
 
Beats me. My answer to this post was before I found out that the Kodak OCX's were part of windows, and not a part of VB. I would say that you would either have to purchase the imaging software from Kodak/Wang, or find some other third party source for the control.

Robert
 
much thanks Robert.It readlly helps as i have the same question as KaiA ,and yet i'm a new user of scanner, i have two more questions,Would you please give me some advise?
1. what's a "template"? and how to use it to scan multiple images automatically with an ADF ,how to create one ?
2. imgscan also has a property "Page",any use?

I encoutered these problems when tried to programe to scann multiple pages into individule image files with an ADF,much thans , waiting for your replay
 
Not ever having used an image template this is only a guess, but from what the help files say, you can specify a certain path in the Image property setting of the image control, such as "c:\scan\images\img". The template ‘img’ will generate files named img00001.xxx, img00002.xxx, and so on, for each page scanned ( depends on the PageCount setting on how many pages will be scanned to the template out of the document feeder on the scanner ).

As for the Page property, the help says:

"Returns the page number of an image file where an action was performed, or sets the page number of an image file where an action is to be performed."

Hope this helps,

Robert
 
thank Robert,now I know how to scan multiple page with an ADF.i set "multipage=false" and "pagecount=n" ,it works.
files generated like follows:
scan0001.tif,scan0002.tif......

but it seems that the template doesn't work,as the help files says ,if i set the "image" property to "abc*",the files should be named abc0001.xxx,abc0002.xxx,but i found the file names is scan0001.xxx,scan0002.xxx.Also, i have not found out how to keep these files in jpg format.
files are always keeped in "tif" format whatever i set "fileType" property.

i found a copy of help file on web.you may download it
if needed,i would like to send u a copy.
 
KaiA, any chance you could copy and paste the code you are using to scan? I am trying to scan from Access but i dont have a clue how to do it, if i could get an example of how you are doing it i know i could modify it to do what i need done. If you dont mind i would appreciate it, you could post it. Thanks again.
 
^ Im still stuck, does anyone have examples of code that will scan with kodak imaging?
 
Here's a little bit of code that I used, there are a lot of pre settings that you can set before you scan though,(set up page size, etc.)

With ImgScan1
.Image = Filename
.FileType = TIFF
.ScanTo = DisplayAndFile
.ShowSetupBeforeScan = False
.MultiPage = True
.PageOption = PromptToCreateNewFile
.OpenScanner
End With
Error = ImgScan1.StartScan

As for Window XP versions, I had to by Imaging professional so I can use the advance functions on a computer I deployed the package to.
Rob
 
AlexZYY,

I think that you need to have a full path in the image property, before the template will work correctly.

Also, I don't think you want to have the * at the end of the image path. That might be what's causing your problem.

Robert
 
Robert,
that "*" doesn't cause any problem, i set the property before openscanner method ,and it works!
but i still don't know why .I found a lot of methods without any specification in the help file,such as SetExternalImageName ,is that help an old version?

my work almost done , as a result ,i think we'll lost a lost of advanced feature to work with these ocx's. Does anyone know how to set resolution ?
moreover ,when multiscaning (into individual image files),how to know the current image file name?(abc00001.bmp....)
 
Hi All,
I am working on a VB application and I have to integrate
a button to scan a document
and save it when clicked. as KaiA needs and i am new to Visual basic.
can I get sampel Code for it. it would be really helpful to me
It is urgent too.
Hope to hear form you soon
Thanks in Advance

Thanks
Pankaj
 
OferGal1,

Search this site for an answer to your question...
[tt]

this link did not seem to be working. It was provided by CajunCenturion in thread222-368607 that has a date of Sep 26, 2002
[/tt]

AlexZYY,

At the time these controls were first created (and to this day) there is a royalty to use the jpeg compression. The standard and professional controls will allow you to use jpeg compression but you cannot save the file with a jpeg/jpg extension and the file has a standard tiff header (if I remember correctly). The work-around at the time was to rename the file, but you cannot have multi page jpegs.

How to set resolution. With scanning you set the resolution through the TWAIN interface of the software for you scanner (setup). With the Image Edit Control you can use the ImageResolutionX/Y properties.

If you use the Image Admin control it will return unique file name for you.

Pankaj72,

Please Start your own thread as there are so many question in this that may have not been fully answered.

Good Luck All
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top