Is it possible to scan document directly via code using leadtools SDK?

402 views Asked by At

Is it possible to scan document directly via code using leadtools SDK? I couldn't find any example code in leadtools site

In sample code, we can scan but via interface such as interface to select scanner and then have to press scan button. Can we achieve this directly via code without any interface?

1

There are 1 answers

0
LEADTOOLS Support On

If you're using a Twain-compatible scanner, you can use this code to acquire an image without displaying the scanner's dialog:

TwainSession session = new TwainSession();
session.Startup(this.Handle, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None);
// To display the scanner's dialog, use TwainUserInterfaceFlags.Show instead of None in the next line
RasterImage img = session.AcquireToImage(TwainUserInterfaceFlags.None);
// save the acquired image here or use it here ...
session.Shutdown();

If you want to control the scanning properties before acquiring the image, you can use the TwainSession.SetCapability() method before calling AcquireToImage(). There's a code sample here.

If this doesn't meet your requirements, please provide more details here or send them to our support email address.