public DialogResult Acquire(
TwainUserInterfaceFlags flags
)
Public Function Acquire( _
ByVal flags As TwainUserInterfaceFlags _
) As DialogResult
public:
DialogResult Acquire(
TwainUserInterfaceFlags flags
)
flags
Indicates whether to display the manufacturer's user interface.
One of the DialogResult values. If an error occurs, an exception is thrown.
Use the Acquire method to acquire one or more images. Use the AcquireFast or AcquireFast2 method to acquire one or more images and save them to one or more files.
The number of pages to acquire can be determined by getting the TWAIN source's capabilities. To change the number of pages to acquire, set the appropriate capability to the desired number. Acquire will get images from the selected TWAIN source and pass them into an RasterImage object to the AcquirePage event through the TwainAcquirePageEventArgs class. For each image acquired by the currently selected TWAIN source, an AcquirePage event is generated.
The Acquire method acquires pages in the following transfer modes:
To set the transfer mode, call SetCapability with the appropriate capability constant. For more information, refer to How to Acquire from the Twain Source.
using Leadtools;
using Leadtools.Twain;
TwainSession acq_session;
private void twain_AcquirePage(object sender, TwainAcquirePageEventArgs e)
{
// get acquired image here
// call StopFeeder method here if you need to stop the feeder
acq_session.StopFeeder();
}
public void AcquireExample(IntPtr parent)
{
acq_session = new TwainSession();
acq_session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None);
acq_session.SelectSource(String.Empty);
TwainProperties props = acq_session.Properties;
TwainDataTransferProperties dataProps = props.DataTransfer;
dataProps.FileName = Path.Combine(LEAD_VARS.ImagesDir, "twain.bmp");
dataProps.MemoryBufferSize = dataProps.MemoryBufferSize * 2;
props.DataTransfer = dataProps;
acq_session.Properties = props;
TwainTransferOptions opts = acq_session.TransferOptions;
acq_session.AcquirePage += new EventHandler<TwainAcquirePageEventArgs>(twain_AcquirePage);
if (acq_session.Acquire(TwainUserInterfaceFlags.Show) != DialogResult.OK)
MessageBox.Show("Error Acquiring From Source");
acq_session.Shutdown();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";
}
Imports Leadtools
Imports Leadtools.Twain
Dim acq_session As TwainSession
Private Sub twain_AcquirePage(ByVal sender As Object, ByVal e As TwainAcquirePageEventArgs)
' get acquired image here
' call StopFeeder method here if you need to stop the feeder
acq_session.StopFeeder()
End Sub
Public Sub AcquireExample(ByVal parent As IntPtr)
acq_session = New TwainSession()
acq_session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None)
acq_session.SelectSource(String.Empty)
Dim props As TwainProperties = acq_session.Properties
Dim dataProps As TwainDataTransferProperties = props.DataTransfer
dataProps.FileName = Path.Combine(LEAD_VARS.ImagesDir, "twain.bmp")
dataProps.MemoryBufferSize = dataProps.MemoryBufferSize * 2
props.DataTransfer = dataProps
acq_session.Properties = props
Dim opts As TwainTransferOptions = acq_session.TransferOptions
AddHandler acq_session.AcquirePage, AddressOf twain_AcquirePage
If acq_session.Acquire(TwainUserInterfaceFlags.Show) <> DialogResult.OK Then
MessageBox.Show("Error Acquiring From Source")
End If
acq_session.Shutdown()
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"
End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document