Class that represent twain device.
Inheritance Hierarchy
TwainScanningDataSource
Namespace: TwainScanning
Assembly: TwainScanning (in TwainScanning.dll) Version: 1.4.3.0 (1.4.3.0)
Syntax
The DataSource type exposes the following members.
Methods
| Name | Description | |
|---|---|---|
| Acquire(Boolean, Boolean, DataSourceErrorInfo, NullableTwSX, Int32) |
Acquires images. Most simple way to scan. Preferred way for scanning in the console applications.
Function will not return until scanning is finished.
| |
| Acquire(IImageCollector, Boolean, Boolean, NullableTwSX, NullableInt32) |
Allows to acquire images from the scanner synchronously. This function will not return until scanning is finished.
| |
| AcquireAsync(IImageCollector, Boolean, Boolean, NullableTwSX, NullableInt32) |
Allows to acquire images from the scanner asynchronously. This function will return immediately.
| |
| AcquireAsync(ImageCollectorOnFinishedDelegate, Boolean, Boolean, NullableTwSX, NullableInt32) |
Allows to acquire images from the scanner asynchronously.
| |
| CallCustomTripletT | ||
| CancelCurrentScanning |
Cancels the current scanning.
Note: Scanning is aborted, which means that images which the device already scanned but did not transfer yet
are discarded. Use StopFeeder when those images have to be kept.
| |
| Dispose |
Closes source and performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
| |
| Equals | (Inherited from Object.) | |
| Finalize | (Overrides ObjectFinalize.) | |
| GetHashCode | (Inherited from Object.) | |
| GetType | (Inherited from Object.) | |
| SetupFileTransferParams(TwFF, IEnumerableString, Boolean) | ||
| SetupFileTransferParams(TwFF, String, Boolean) | ||
| StopFeeder |
Requests the device to stop feeding new sheets, while all images which were already scanned are still
delivered. This is the graceful way to end continuous scanning - unlike CancelCurrentScanning,
which aborts the acquisition and discards everything the device did not transfer yet.
Sheets which the feeder already picked up are scanned and transferred to the end, including both sides when
duplex is enabled, and scanning finishes on its own once the device reports no more pending transfers -
OnBatchFinished and OnScanningFinished are raised as after a complete batch.
Can be called from any thread, including from within OnSingleImageAcquired. The request is not
executed immediately - the library sends DG_CONTROL / DAT_PENDINGXFERS / MSG_STOPFEEDER to the device as
soon as the transfer in progress ends, because that is the TWAIN state in which data sources accept it.
Do NOT combine with CancelCurrentScanning or with
CancelScanning, they would discard the pending images.
Not every device supports this operation. Use SupportsStopFeeder to check in advance and
StopFeederAccepted to see whether the device actually accepted the request.
| |
| ToString | (Inherited from Object.) |
Fields
| Name | Description | |
|---|---|---|
| ClearPage |
Stop scanning all pages from feeder.
Alias for [!:Settings.Feeder.ClearPage].
| |
| ColorMode |
Represent color mode.
Alias for [!:Settings.ImageType.PixelType].
| |
| PageSize |
Represent available PageSize.
Alias for [!:Settings.Page.Sizes].
| |
| PixelDepth |
Represent pixel depth for current value.
Alias for [!:Settings.ImageType.BitDepth].
| |
| Resolution |
Represent supported resolutions.
Alias for [!:Settings.Resolution.X] and [!:Settings.Resolution.Y].
| |
| Settings |
Data source settings. Abstraction around capabilities of the device represented by the DataSource.
| |
| TransferMechanism |
Represent supported transfer mechanism.
Alias for [!:Settings.Transfer.Mechanism].
| |
| UseDuplex |
If duplex is enable.
Alias for [!:Settings.Duplex.Enabled].
| |
| UseFeeder |
Represent if feeder is enable.
Alias for [!:Settings.Feeder.Enabled].
|
Properties
| Name | Description | |
|---|---|---|
| HasFeeder |
Is feeder supported on Twain Device.
| |
| Identity |
Get identity of current scanner.
| |
| Layout |
Property layout.
| |
| StopFeederAccepted |
Result of the last StopFeeder request sent to the device. null when no request was sent to the device during the current scanning (either it was not requested,
or the scanning ended before the library could send it), true when the device accepted it and
false when the device rejected it, which means the device does not support stopping the feeder this way.
| |
| SupportsStopFeeder |
Indicates whether the device is expected to support StopFeeder.
The check is done without touching the device state: it reports whether the data source has a feeder and
whether it implements TWAIN 1.9 or newer, which is the version that introduced MSG_STOPFEEDER. Data sources
are allowed to reject the operation even so, therefore treat this as an advance check only - the definitive
answer for a device is StopFeederAccepted after scanning.
Note: Read it before scanning is started, it reads a capability from the data source.
|
Events
| Name | Description | |
|---|---|---|
| AcquiringEvent |
Representing image acquiring events.
| |
| ExtendedImageInformation | ||
| OnBatchFinished |
Occurs when batch scanning is finish.
Raised after the last image of the batch was delivered, before the data source is disabled and before
OnScanningFinished.
| |
| OnDeviceEvents | ||
| OnErrorEvent |
Represents errors which occur in Twain device.
| |
| OnMemoryTransferProgressUpdate | ||
| OnScanningFinished |
Occurs when scanning is finish.
Last event of a scanning, raised after the data source was disabled. Reading
StopFeederAccepted here is still valid.
| |
| OnSingleImageAcquired |
Provides data for the Device.ImageAcquired event.
Raised once per acquired image, on the thread which drives the TWAIN message loop, and it is raised
synchronously - scanning of the next image continues only after the handler returns, so keep the handler
short and hand the work over to another thread when it takes longer.
Order of the operations for every image: the image is added to the collector, this event is raised,
the library ends the transfer (MSG_ENDXFER) and asks the device how many transfers are still pending.
The device is therefore still in the transfer state while the handler runs, which is why requests which
have to reach the device in a different state - like StopFeeder - are only registered here
and sent by the library at the right moment.
Order of the events for the whole scanning:
AcquiringEvent and OnSingleImageAcquired per image,
then OnBatchFinished when there are no more pending transfers,
and finally OnScanningFinished after the data source is disabled.
|
See Also
Reference
SystemIDisposable