Click or drag to resize

Acquisition Class

This is the main class for image acquisitions. Use this class by itself for standard acquires, or use it to get a Device object for more control over the acquire operation. For low level access to Twain, use the TwainController object.
Inheritance Hierarchy

Namespace:  Atalasoft.Twain
Assembly:  Atalasoft.DotTwain (in Atalasoft.DotTwain.dll) Version: 11.0.0.0.0.297 (.NET 4.5.2, x86)
Syntax
public class Acquisition : Component

The Acquisition type exposes the following members.

Constructors
  NameDescription
Public methodAcquisition
Creates a new instance of Acquisition.
Public methodAcquisition(IWin32Window)
Creates an instance of Acquisition specifying the parent window.
Top
Properties
  NameDescription
Public propertyApplicationIdentity
Gets the TwainIdentity object containing application information that is sent to Twain.
Protected propertyCanRaiseEvents
Gets a value indicating whether the component can raise an event.
(Inherited from Component.)
Public propertyContainer
Gets the IContainer that contains the Component.
(Inherited from Component.)
Protected propertyDesignMode
Gets a value that indicates whether the Component is currently in design mode.
(Inherited from Component.)
Public propertyDevices

Gets a collection of installed Device for this system.

Protected propertyEvents
Gets the list of event handlers that are attached to this Component.
(Inherited from Component.)
Public propertyIsDisposed
Gets a value indicating whether this class has been disposed.
Public propertyParent
Gets or sets the parent window for the acquisition.
Public propertySite
Gets or sets the ISite of the Component.
(Inherited from Component.)
Public propertySystemHasTwain
Gets a value indicating if the system has twain_32.dll installed.
Top
Methods
  NameDescription
Public methodCode exampleAcquire
Acquires an image from the system default device.
Public methodCode exampleAcquireModal Obsolete.
Acquires a single image synchronously instead of using the ImageAcquired event.
Public methodCreateDeviceSession

Returns a new Device class that uses its own TwainController instead of the controller used by the Acquisition object for a single session scan. This may be required for some remote systems such as Citrix.

Public methodCreateObjRef
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject.)
Public methodDispose
Releases all resources used by the Component.
(Inherited from Component.)
Protected methodDispose(Boolean)
Closes any TWAIN connections and releases resources back to the system.
(Overrides ComponentDispose(Boolean).)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Calls Dispose().
(Overrides ComponentFinalize.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLifetimeService
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Protected methodGetService
Returns an object that represents a service provided by the Component or by its Container.
(Inherited from Component.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInitializeLifetimeService
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodMemberwiseClone(Boolean)
Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject.)
Public methodCode exampleShowSelectSource
Displays the "Select Source" dialog, allowing end users to select the device they want to use.
Public methodToString
Returns a String containing the name of the Component, if any. This method should not be overridden.
(Inherited from Component.)
Top
Events
  NameDescription
Public eventCode exampleAcquireCanceled
This event will fire if the user has canceled the acquisition.
Public eventCode exampleAcquireFinished
This event will fire when all of the images have been acquired. This is useful when a document feeder is used.
Public eventCode exampleAsynchronousException
This event is raised when an exception is thrown during an asynchronous acquisition.
Public eventCode exampleBeforeTwainDataTransfer
This event will fire before the data is transferred from the device, allow the transfer to be canceled.
Public eventCode exampleDeviceEvent
This event will fire when the device sends one of the DeviceEventFlags.
Public eventDisposed
Occurs when the component is disposed by a call to the Dispose method.
(Inherited from Component.)
Public eventCode exampleFileTransfer
This event will fire just before acquiring an image directly to file. You must fill in the FileName property of the FileTransferEventArgs object.
Public eventCode exampleImageAcquired
This event will fire for each image acquired.
Public eventMemoryDataTransfer
Raised during a memory transfer to allow custom handling of the image data.
Public eventMemoryFileTransfer
Raised during a file transfer to allow custom handling of the image data.
Public eventCode exampleTwainDataTransfer
This event fires after the data has been transferred but before it has been processed by DotTwain.
Top
Remarks

Acquisition is also a component which can be added to the Visual Studio .NET toolbox. This enables properties and events to be established at design time.

Examples
Acquire an image (C#)
// Create an instance of Acquisition and set the ImageAcquired event.
Acquisition acquisition = new Acquisition(this);
acquisition.ImageAcquired += new ImageAcquiredEventHandler(OnImageAcquired);

private void AcquireImage()
{
    // Acquire an image.
    acquisition.Acquire();
}

private void OnImageAcquired(object sender, AcquireEventArgs e)
{
    // Make sure the acquire was successful.
    // If so, load it into a PictureBox.
    if (e.Image != null)
        this.picture1.Image = e.Image;
}
Acquire an image (Visual Basic)
' Create an instance of Acquisition and set the ImageAcquired event.
Dim acquisition As Acquisition =  New Acquisition(Me) 
acquisition.ImageAcquired += New ImageAcquiredEventHandler(OnImageAcquired)

Private  Sub AcquireImage()
    ' Acquire an image.
    acquisition.Acquire()
End Sub

Private  Sub OnImageAcquired(ByVal sender As Object, ByVal e As AcquireEventArgs)
    ' Make sure the acquire was successful.
    ' If so, load it into a PictureBox.
    If Not e.Image Is Nothing Then
        Me.picture1.Image = e.Image
    End If
End Sub
See Also