Click or drag to resize

TwainController Class

The TwainController class allows for lower level access to Twain, providing greater control over the acquisition and access to custom device properties.
Inheritance Hierarchy
SystemObject
  Atalasoft.TwainTwainController

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 TwainController : IDisposable

The TwainController type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleTwainController(IWin32Window)
Creates a new instance of TwainController specifying the parent window.
Public methodCode exampleTwainController(IWin32Window, TwainIdentity)
Creates a new instance of TwainController specifying the parent window and application identity information.
Top
Properties
  NameDescription
Public propertyApplicationIdentity
Gets or sets the application identity sent to Twain for the session.
Public propertyBadImageInfoDetected
Gets a value indicating whether the driver returned an invalid TW_IMAGEINFO structure.
Public propertyCurrentDevice
Gets or sets the device to work with.
Public propertyLastAcquireConditionCode
Gets the last condition code returned from TWAIN for an acquire.
Public propertyState
Gets the current Twain state.
Public propertySystemHasTwain
Gets a value indicating whether the twain_32.dll has been found on the system.
Top
Methods
  NameDescription
Public methodCloseSource
Use this method to close the connection to the device.
Public methodCode exampleCloseSourceManager
Use to close the source manager and release Twain.
Public methodCreateTwainMemory
Returns a new TwainMemory class for the specified pointer.
Public methodDispose
Closes any TWAIN connections and releases resources back to the system.
Protected methodDispose(Boolean)
Closes any TWAIN connections and releases resources back to the system.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allow the TwainController to chance to clean up any resources before being collected by the garbage collector.
(Overrides ObjectFinalize.)
Public methodFreeTwainMemory
Release memory allocated for TWAIN.
Public methodCode exampleGetCapabilityArray
Retrieves an array of values to the specified capability.
Public methodGetCapabilityTwainType
Returns the TWAIN type for the specified capability.
Public methodGetCapabilityType
Use this method to determine the .NET Type DotTwain expects for a specific capability.
Public methodCode exampleGetCapabilityValue(DeviceCapability, Boolean)
Reads a Boolean capability value.
Public methodCode exampleGetCapabilityValue(DeviceCapability, RectangleF)
Reads a RectangleF capability value.
Public methodCode exampleGetCapabilityValue(DeviceCapability, Int32)
Reads an Int32 capability value.
Public methodCode exampleGetCapabilityValue(DeviceCapability, Single)
Reads a Single capability value.
Public methodCode exampleGetCapabilityValue(DeviceCapability, String)
Reads a String capability value.
Public methodGetConditionCode
Returns the condition code from the source manager.
Public methodGetConditionCode(TwainIdentity)
Returns the condition code from the source device.
Public methodGetDefaultDevice
Returns the identity of the default system device.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetPendingTransferCount
Use this method to get the number of pages waiting to be acquired, reset the pending count or to end the current page.
Public methodCode exampleGetTwainDevices
Returns an array of TwainIdentity classes; one for each Twain compatible device found on the system.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInitiateDataTransfer
Use this method to have DotTwain handle the data acquisition details.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodOpenSource
Opens a connection to the CurrentDevice.
Public methodOpenSource(TwainIdentity)
Opens a connection to the device passed in.
Public methodCode exampleOpenSourceManager
Opens a connection to the TWAIN Source Manager.
Public methodProcessEvent
This method will process the Message object retrieved from PreFilterMessage to determine if the message should be handled by the device or passed along the message loop.
Public methodReadTwainContainerData(TwainContainer, TwainMemory)
Returns the value of a memory pointer retrieved from a device.
Public methodReadTwainContainerData(TwainContainer, IntPtr)
Returns the value of a memory pointer retrieved from a device.
Public methodRegisterTwainCallback

Sets up a callback for TWAIN device messages instead of using the traditional message loop. This should only be called when using the TwainController directly; the Device object automatically handles the callback.

The callback feature is only supported when using the TWAIN 2.0 Data Source Manager

Public methodResetAllCapabilities

Call this method to reset all capabilities supported by the device.

Public methodResetCapability
Resets a single capability to its startup value.
Public methodSendCommand(TwainTriplet, TwainIdentity, ITwainDataStructure)
Send a command to the TWAIN API
Public methodSendCommand(Int32, Int32, Int32, TwainIdentity, ITwainDataStructure)
Sends a command triplet that may not be contained in the TwainTriplet enumeration.
Public methodSetCapabilityArray
Sets an array of values for a specific capability to the device.
Public methodSetCapabilityValue(DeviceCapability, Boolean)
Sets a capability to a Boolean value.
Public methodSetCapabilityValue(DeviceCapability, RectangleF)
Set a capability to a RectangleF value.
Public methodSetCapabilityValue(DeviceCapability, Int32)
Sets a capability to an Int32 value.
Public methodSetCapabilityValue(DeviceCapability, Single)
Sets a capability to a Single value.
Public methodSetCapabilityValue(DeviceCapability, String)
Sets a capability to a String value.
Public methodSetExtendedImageInfoOptions
Sets the extended image information id values that will be retrieved when acquiring data.
Public methodSetThreadUIControl
Sets the parent control used to invoke events from the TwainController. This method is automatically called by the Device object when acquiring images.
Public methodCode exampleShowSelectSource
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
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 exampleBeforeTwainDataTransfer
This event will fire before the data is transferred from the device, allow the transfer to be canceled.
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
This event is raised during a memory transfer to allow developers to handle processing the data instead of DotTwain.
Public eventMemoryFileTransfer
This event is raised during a memory file transfer before each image is scanned. Use this event to indicate the file format for the image and provide a Stream to store the image into.
Public eventCode exampleTwainDataTransfer
This event fires after the data has been transferred but before it has been processed by DotTwain.
Public eventTwainException
Raised when there is an exception in the TwainController. If this event is not handled, the exception will be thrown instead.
Top
See Also