←Select platform

AcquireFast Method

Summary

(Document/Medical only) Acquires one or more images from a TWAIN source and stores the images in the specified file(s).

Syntax

C#
VB
C++
Public Sub AcquireFast( _ 
   ByVal baseFileName As String, _ 
   ByVal flags As Leadtools.Twain.TwainFastUserInterfaceFlags, _ 
   ByVal transferMode As Leadtools.Twain.TwainTransferMode, _ 
   ByVal format As Leadtools.RasterImageFormat, _ 
   ByVal bitsPerPixel As Integer, _ 
   ByVal multiPage As Boolean, _ 
   ByVal bufferSize As Integer, _ 
   ByVal usePreferredBufferSize As Boolean _ 
) 

Parameters

baseFileName
The base name of the image file(s) to which to save the acquired data.

flags
Flag that indicates whether to display the manufacturer's user interface.

transferMode
The transfer mode used to acquire

format
The image format used to acquire

bitsPerPixel
represents the BitsPerPixel used to acquire

multiPage
true for multi-page acquire, false for single page.

bufferSize
Specifies the buffer size (in bytes) used to acquire images.

usePreferredBufferSize
Specifies whether to use the preferred buffer size specified by the TWAIN driver. true to use the preferred buffer size, false to use the user-defined buffer size (*

bufferSize
Specifies the buffer size (in bytes) used to acquire images.

Remarks

Use the Acquire method to acquire one or more images. Use the AcquireFast method to acquire one or more images and save them to one or more files. Based on the scanner type, this method will determine the best/fastest scanning method to use. This scanning method will be used when actually scanning the images. Before calling this method: You can call the FindFastConfiguration method to determine the best scan configuration. Note:If you do not call the FindFastConfiguration method before calling the AcquireFast method, then the AcquireFast method will determine the best scanning method. If the file format set in the

format*
The image format used to acquire The base name of the image file(s) to which to save the acquired data. If the file format specified in the
format*
The image format used to acquire The base name of the image file(s) to which to save the acquired data. To use the AcquireMultiPage event, you should set the EnableAcquireMultiPageEvent property value to true before calling the AcquireFast method. The AcquireMultiPage event will be fired twice for each scanned page. The event is fired the first time when the TWAIN source begins scanning the page. The event is fired the second time when the TWAIN source has finished scanning the page. For more information, refer to How to Acquire from the Twain Source. For more information, refer to Fast TWAIN (Scan Configurations).

Example

C#
VB
Imports Leadtools 
Imports Leadtools.Twain 
 
Public Sub twain_AcquireMulti(ByVal sender As Object, ByVal e As TwainAcquireMultiPageEventArgs) 
   Dim msg As String 
   If e.FinishScan Then 
      msg = String.Format("The page # {0} is scanned and saved to file name {1}", e.PageNumber, e.FileName) 
      MessageBox.Show(msg) 
   End If 
 
   e.Cancel = False 
End Sub 
 
 
Public Sub AcquireFastExample(ByVal parent As IntPtr) 
   Dim session As TwainSession = New TwainSession() 
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None) 
 
   session.EnableAcquireMultiPageEvent = True 
   AddHandler session.AcquireMultiPage, AddressOf twain_AcquireMulti 
 
   session.AcquireFast(Path.Combine(LEAD_VARS.ImagesDir, "test.tif"), TwainFastUserInterfaceFlags.Show, TwainTransferMode.Buffer, RasterImageFormat.Tif, 1, True, 0, True) 
   session.Shutdown() 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 
using Leadtools; 
using Leadtools.Twain; 
 
public void twain_AcquireMulti(object sender, TwainAcquireMultiPageEventArgs e) 
{ 
   string msg; 
   if (e.FinishScan) 
   { 
      msg = String.Format("The page # {0} is scanned and saved to file name {1}", e.PageNumber, e.FileName); 
      MessageBox.Show(msg); 
   } 
 
   e.Cancel = false; 
} 
 
public void AcquireFastExample(IntPtr parent) 
{ 
   TwainSession session = new TwainSession(); 
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None); 
 
   session.EnableAcquireMultiPageEvent = true; 
   session.AcquireMultiPage += new  EventHandler<TwainAcquireMultiPageEventArgs>(twain_AcquireMulti); 
 
   session.AcquireFast(Path.Combine(LEAD_VARS.ImagesDir, "Out_test.tif"), 
                       TwainFastUserInterfaceFlags.Show, 
                       TwainTransferMode.Buffer, 
                       RasterImageFormat.Tif, 1, true, 0, true); 
   session.Shutdown(); 
} 
 
static class LEAD_VARS 
{ 
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; 
} 

Requirements

Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.Twain Assembly
Click or drag to resize