Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1413
  • Last Modified:

scanning / twain

Hello experts,

For this project I'm working on, I'll have to be able to 'handle' scanned documents, from various types of scanners.

there are some choice's to make:
- have Delphi accept scanned formats from various scanners.
- have a converter to convert multiple formats to one format Delphi uses.

I'm still disigning this part of the system, but also doing some research in advance. I did search on the net for avaiblable Delphi components and the TWAIN initiative and will continue doing this.

My question: Could somebody advise me in this scenario? Did people make applications that support a variety of scanners? Are there known problems?

If more people have 'answers', I can do something with points.

I was also thinking about 'Imaging', can I use this as by COM / OLE within my form? Should I automate this program, or get Delphi components?

Next to this I also want a thumbnail like view in Delphi... ...and by the by, I need to be able to handle:
1 scan; 1 page.
1 scan; multiple pages.
'1 scan'; multiple scans, multiple pages.


  • 5
  • 3
  • 2
  • +1
1 Solution
The neat thing about TWAIN is, is that it does all the handling for you. What you need to do is connect to it. The component that I've used in the past (and I'm not saying that it's the best but it diod exactly what I needed) was SkyLine's ImageLib

The Neil

you can have a look at

(or all the other Twain components on Torry)

Try taking a look at

It claims to do TWAIN support.

To expand on what I said earlier, TWAIN is just a standard way for scanners to connect. All the manufacturer has to do is make sure that his scanner complies with the standards set and then ANYTHING can connect to it. You don't have to worry about the specifics of the hardware as the interface supplied by the manufacturer deals with all that for you. Therefore your application just has to use TWAIN and it can connect to any scanner that is TWAIN compliant.

As for scanning multiple pages, multiple scans etc. then it all depends what the manufacturer builds into his interface.

The ImageLib components come with a dialog that allows you to change the current scanner if more than one is installed and I'm fairly certain that this is actually a standard TWAIN feature rather than something specific to just ImageLib, so that poses no problems.

Hope this makes things a little clearer

The Neil
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

florisbAuthor Commented:
thanks Neil en ZifNab, I'm checking the webpages and downloading demo's.

Do you also perhaps have experience making Delphi applications that Use scanned images? Common errors and stuff?
And storing scans in databases?



I did develop a couple of TWAIN applications a few years ago and can't remember having any headaches. Once you've scanned your image in it's simple an image and you can treat it like any other - put it into a database, save it, jump up and down on it, whatever.

The components that I used were pretty good when it came to errors and problems and as I recall I just got a flag back indicating if the scanner was available, if the scan was cencelled etc. There wasn't any nasty errors or exceptions flying about and it was painless to code.

One thing that I did notice/find useful was some code to crop the image once it's scanned in. This isn't really a TWAIN problem and your drivers might even do the job for you.

Hope this helps

The Neil

Pasted from the paqs:


I am using the eztw32.dll. It is very easy to use.
You just need this DLL in the directory of your
application. I downloaded this DLL some time ago from
the official TWAIN site, but I cannot find
it any longer there. Using Altavista I found another
 He provides also a Delphi interface. But you may also
  use mine:

function TWAIN_IsAvailable: integer; stdcall;
  external 'Eztw32.dll' index 26;

function TWAIN_SelectImageSource(Handle: hWnd): integer; stdcall;
  external 'Eztw32.dll' index 38;

function TWAIN_AcquireNative(Handle: hWnd;
  wPixTypes: integer): integer; stdcall;
  external 'Eztw32.dll' index 2;

function TWAIN_WriteNativeToFilename(Handle: THandle;
  FileName: pChar): integer; stdcall;
  external 'Eztw32.dll' index 49;

To scan an image and save it to a BMP file:

  Handle := TWAIN_AcquireNative(0, 0);
  if Handle > 0 then
    Result := TWAIN_WriteNativeToFileName(Handle, pChar(FileName)) = 0;

Its really simple and unlike other interfaces AcquireNative only returns when the document is scanned.

just some more meat for the soup ;-)
florisbAuthor Commented:
Thanks Inthe, just downloaded, trying now.

I'll leave this message open for the weekend...

After that the points, perhaps with a trick to divide them...


florisbAuthor Commented:
Research area's defined:
·      Image formats.
·      Scanners.
·      Twain drivers.
·      Images edit & display controls.
·      OCR.

How about that? Just collected 1001 internet links and demo's. Now for real.


florisbAuthor Commented:
Hi inthe,

I'm going to try your lib. One more question: is that library a good one to use for a 'professional application'?

For the edit controls I'l try the one Neil adviced (ImageLib).

hi floris,
thats a bit of an odd question, as code for a free program would be identical to code for a expensive proffesional application wouldnt it ?

for an answer, well im sure it'll be just fine ;-)

florisbAuthor Commented:
Hi inthe,

Tried eztw32.dll yesterday, workerd perfect. With my odd question, I was aksing something like: how much functionality does that lib offer? Okee, I know now.

By the by, you know the standard Windows imaging (it's from Microsoft, Wang and Eastman Software; see also, it has controls (activex / ocx) you can import in Delphi, and is TWAIN compatible, see it's help after importing in Delphi. It works, but a bit buggy with the 1.1 version (3 years old)... ...hope I'll upgrade today.

Decided to give you the points Inthe. Neil, you should get something like 30% of the points; maybe more, it's just that I really used InThe's comment for a demo... ...your imgaLib link will probably be usefull later. I heard people on E.E. compaining about people not giving points, so I decided I will not wait with that too long.


ZifNab... ...thanks too for commenting! It's in my document.


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now