TWainParams object contains a lot of properties and methods to control TWain scanners without use the default dialog.

Namespace: HiComponents.IEvolution
Assembly: IEvolution2 (in IEvolution2.dll) Version: 10.1.0.0

Syntax

         
 C#  Visual Basic  Visual C++ 
public class TWainParams
Public Class TWainParams
public ref class TWainParams

Members

            
 All Members  Fields   Properties   Methods  
 Public

 Protected
 Instance

 Static 
 Declared

 Inherited
 XNA Framework Only 

 .NET Compact Framework Only 

 MemberDescription
AcceptedImages

Set this capability to the number of images you are willing to transfer per session.

-2 = default scanner value

-1 = multiple images

>1 = one o more images

AcquireFrameBottom

The bottom of the rectangle to acquire in inches.

To use this property set UseAcquireFrameValues to true.

AcquireFrameLeft

The left of the rectangle to acquire in inches.

To use this property set UseAcquireFrameValues to true.

AcquireFrameRight

The right of the rectangle to acquire in inches.

To use this property set UseAcquireFrameValues to true.

AcquireFrameTop

The top of the rectangle to acquire in inches.

To use this property set UseAcquireFrameValues to true.

ActiveSource
ActiveSource is an index of SourceName[] list, and defines currently selected scanner (source). The default is 0 (fist scanner). This is an alternative method to select scanner without call SelectTWainSource method.
ApplicationManufacturer
Specifies the application information comunicated to the Twain scanner interface.
ApplicationProductFamily
Specifies the application information comunicated to the Twain scanner interface.
ApplicationProductName
Specifies the application information comunicated to the Twain scanner interface.
ApplicationVersionInfo
Specifies the application information comunicated to the Twain scanner interface.
AutoBorderDetection
If the scanner supports this property, it enables auto border detection.
AutoBright
If the scanner supports this property, it enables auto bright.
AutoDeskew
If the scanner supports this property, it enables auto deskew.
AutoDiscardBlankPages

Use this capability to have the scanner discard blank images.

Applications never see these images during the scanning session.

Allowed values:

-2 : Indicates that all images will be delivered to the application, none of them will be discarded.

-1 : Scanner source will decide if an image is blank or not and discard as appropriate.

>=0 : Scanner will use it as the byte size cutoff point to identify which images are to be discarded.

If the size of the image is less than or equal to this value, then it will be discarded.

If the size of the image is greater than this value, then it will be kept so that it can be transferred to the Application.

AutoFeed
If AutoFeed is true, the scanner will automatically feed the next page from the document feeder.
AutoRotate
If the scanner supports this property, it enables auto rotate.
AutoScan

Enables/Disables auto scan.

This capability is intended to boost the performance of a Source.

The fundamental assumption behind AutoScan is that the device is able to capture the number of images indicated by the value of AcceptedImages without waiting for the Application to request the image transfers.

BitDepth
Specifies the bit depth (bits per channel) of the image to scan.
Brightness

Brightness value. Allowed range is -1000 to +1000.

Allowed values can be assigned to Contrast.CurrentValue property.

To see which values your scanner supports look at Brightness[] array, or Brightness.RangeMin, Brightness.RangeMax and Brightness.RangeStep.

You can also limit scanner user interface allowed values removing some Brightness[] items or changing Brightness.RangeMin, Brightness.RangeMax and Brightness.RangeStep.

BufferedTransfer
Set this property to False if you have problems to acquire image.
CompatibilityMode

CompatibilityMode disable capability set and read (some scanner may crash when you set/get capabilities).

Set this property to true only if you have problems with a specific scanner.

Contrast

Contrast value. Allowed range is -1000 to +1000.

Allowed values can be assigned to Contrast.CurrentValue property.

To see which values your scanner supports look at Contrast[] array, or Contrast.RangeMin, Contrast.RangeMax and Contrast.RangeStep.

You can also limit scanner user interface allowed values removing some Contrast[] items or changing Contrast.RangeMin, Contrast.RangeMax and Contrast.RangeStep.

CopyParametersFromScanner()()()()

Fills TWainParams property with scanner parameters.

Use this method to update parameters with scanner values.

CopyParametersToScanner()()()()

CopyParametersToScanner() method probes if current parameters are valid.

For example, if application assignes a combination of PixelType and YResolution unsupported by scanner, the method restores the PixelType and YResolution value to one supported by scanner.

CopyTo(TWainParams)
Copies all parameters to destination.
DeviceOnline

If True, the physical hardware (e.g., scanner, digital camera, image database, etc.) that represents the image source is attached, powered on, and communicating.

Warning!! Several (almost all) devices still return "true" when they are off or disconnected.

DuplexEnabled

If true, the scanner scans both sides of a paper; otherwise (default), the scanner will scan only one side of the image.

Use this proprety only within multipage component to enable/disable duplex mode.

DuplexSupported

If true, the scanner scans both sides of a paper; otherwise (default), the scanner will scan only one side of the image.

Use this proprety only within multipage component to enable/disable duplex mode.

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
FeederEnabled
Enables feed loader when present. Use this proprety only within multipage component to disable feed loader.
FeederLoaded
Reflect whether there are documents loaded in the Source’s feeder.
FileTransfer

If FileTransferis true, uses a file transfer to get images from the scanner (regardness of BufferedTransfer setting). There are three ways to get an image from scanner:

1 - native transfer ( set FileTransfer=False and BufferedTransfer=False )

2 - buffered transfer ( set FileTransfer=False and BufferedTransfer=True )

3 - file transfer ( set FileTransfer=True )

FileTransfer is slow but more compatible.

Finalize()()()()
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
FreeResources()()()()

IEvolution keeps the scanner driver open to improve performance.

Call FreeResources to close and free the scanner driver after a call to Acquire method: this degrade performance but can improve stability.

Applications should not call FreeResources because it is executed when the application exits.

Gamma
It is the gamma value of your scanner.
GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetSystemDefaultSource()()()()
GetSystemDefaultSource returns system default TWain source.
GetType()()()()
Gets the Type of the current instance.
(Inherited from Object.)
LogFile
Sets TWain log file name.
MemberwiseClone()()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
Orientation
Orientation defines the orientation of the output image. Not all scanner supports this capability.
PaperDetectable
If true, the scanner is able to detect paper.
PhysicalHeight
The maximum physical height (Y-axis) the scanner can acquire (measured in inches).
PhysicalWidth
The maximum physical width (X-axis) the scanner can acquire (measured in inches).
PixelType
The type of pixel data that a scanner is capable of acquiring.

Default allowed values are:

TW_BlackWhite : Black/white (1 bit)

TW_GrayScale : Gray scale (8 bit)

TW_RGB : full RGB (24 bit)

TW_Palette : palette (unsupported)

TW_CMY : CMY (unsupported)

TW_CMYK : CMYK (unsupported)

TW_YUV : YUV (unsupported)

TW_YUVK : YUVK (unsupported)

TW_CIEXYZ : CIEXYZ (unsupported)

Above values can be assigned to PixelType.CurrentValue property. To see which values your scanner supports look at PixelType.Items[] array.

You can also limit scanner user interface allowed values removing some PixelTtype[] items.

Rotation
Specifies how much the Source can/should rotate the scanned image data prior to transfer. Allowed values are in the range: -360..+360 degrees.
SelectSourceByName(String)
Select source by name.
SetToDefaultValues()()()()
Restores default parameters
ShowProgressIndicators

If true (default), the scanner will display a progress indicator during acquisition and transfer, regardless of whether the scanner user interface is active.

You can use OnProgress event to display your custom progress indicator.

ShowSettingsOnly

If ShowSettingsOnly is True the scanner driver will show settings dialog, without acquire the image.

You could use IETWainParams.SourceSettingsSave and IETWainParams.SourceSettingsLoad to handle scanner settings.

Sources
The list of TWain sources (scanners).
SourceSettingsLoad(Stream)

Loads source settings from file (previously saved using SourceSettingsSave).

Source settings are filled when IETWainParams.ShowSettingsOnly is true and you call IEImage.AcquireFromTWain().

SourceSettingsLoad(String)

Loads source settings from file (previously saved using SourceSettingsSave).

Source settings are filled when IETWainParams.ShowSettingsOnly is true and you call IEImage.AcquireFromTWain().

SourceSettingsSave(Stream)

Saves source settings to stream (you can re-load them using SourceSettingsLoad).

Source settings are filled when IETWainParams.ShowSettingsOnly is true and you call IEImage.AcquireFromTWain().

SourceSettingsSave(String)

Saves source settings to file (you can re-load them using SourceSettingsLoad).

Source settings are filled when IETWainParams.ShowSettingsOnly is true and you call IEImage.AcquireFromTWain().

StandardSize

For devices that support fixed frame sizes. Defined sizes match typical page sizes.

This specifies the size(s) the Source can/should use to acquire image data.

Threshold
Specifies the dividing line between black and white. Allowed values: 0..255
ToString()()()()
Returns a string that represents the current object.
(Inherited from Object.)
TW_2A0
A2A0
TW_4A0
4A0
TW_A0
A0
TW_A1
A1
TW_A10
A10
TW_A2
A2
TW_A3
A3
TW_A4
A4 letter
TW_A4LETTER
A4 letter
TW_A5
A5
TW_A6
A6
TW_A7
A7
TW_A8
A8
TW_A9
A9
TW_B3
B3
TW_B4
B4
TW_B5LETTER
B5 letter
TW_B6
B6
TW_BlackWhite
Black/white
TW_BUSINESSCARD
Business Card
TW_C0
C0
TW_C1
C1
TW_C10
C10
TW_C2
C2
TW_C3
C3
TW_C4
C4
TW_C5
C5
TW_C6
C6
TW_C7
C7
TW_C8
C8
TW_C9
C9
TW_CIEXYZ
CIEXYZ
TW_CMY
CMY
TW_CMYK
CMYK
TW_GrayScale
Gray Scale
TW_ISOB0
ISO B0
TW_ISOB1
ISO B1
TW_ISOB10
ISO B10
TW_ISOB2
ISO B2
TW_ISOB3
ISO B3
TW_ISOB4
ISO B4
TW_ISOB5
ISO B5
TW_ISOB6
ISO B6
TW_ISOB7
ISO B7
TW_ISOB8
ISO B8
TW_ISOB9
ISO B9
TW_JISB0
JIS B0
TW_JISB1
JIS B1
TW_JISB10
JIS B10
TW_JISB2
JIS B2
TW_JISB3
JIS B3
TW_JISB4
JIS B4
TW_JISB5
JIS B5
TW_JISB6
JIS B6
TW_JISB7
JIS B7
TW_JISB8
JIS B8
TW_JISB9
JIS B9
TW_NONE
None
TW_NoRotation
No Rotation
TW_Palette
Palette
TW_RGB
RGB (24bit)
TW_Rotate180
Rotate 180 degrees
TW_Rotate270
Rotate 270 degrees
TW_Rotate90
Rotate 90 degrees
TW_USEXECUTIVE
US Executive
TW_USLEDGER
US Ledger
TW_USLEGAL
US legal
TW_USLETTER
US letter
TW_USSTATEMENT
US Statement
TW_YUV
YUV
TW_YUVK
YUVK
UseAcquireFrameValues

If True, enables the properties AcquireFrameLeft, AcquireFrameRight, AcquireFrameTop and AcquireFrameBottom.

When True some scanners doesn’t allow user to change the acquisition frame.

Default is False.

UseMemoryHandle

If true uses memory handle (default) instead of memory pointer to transfer images.

Some scanners requires this property to be "false".

UseScannerDialog
If True (default) enables scanner user interface when Acquire method is called.
UseUndefinedImageSize
Enables support for undefined image size scanner. Default is false.
XResolution

XResolution is the DPI (Dot per Inch) in the X-axis.

Allowed values can be assigned to XResolution.CurrentValue property.

To see which values your scanner supports look at XResolution[] array, or XResolution.RangeMin, XResolution.RangeMax and XResolution.RangeStep.

You can also limit scanner user interface allowed values removing some XResolution[] items or changing XResolution.RangeMin, XResolution.RangeMax and XResolution.RangeStep.

XScaling

X-axis scaling value. A value of 1.0 is equivalent to 100% scaling.

Allowed values can be assigned to XScaling.CurrentValue property.

To see which values your scanner supports look at XScaling[] array, or XScaling.RangeMin, XScaling.RangeMax and XScaling.RangeStep.

You can also limit scanner user interface allowed values removing some XScaling[] items or changing XScaling.RangeMin, XScaling.RangeMax and XScaling.RangeStep.

YResolution
YScaling

Y-axis scaling value. A value of 1.0 is equivalent to 100% scaling.

Allowed values can be assigned to YScaling.CurrentValue property.

To see which values your scanner supports look at YScaling[] array, or YScaling.RangeMin, YScaling.RangeMax and YScaling.RangeStep.

You can also limit scanner user interface allowed values removing some YScaling[] items or changing YScaling.RangeMin, YScaling.RangeMax and YScaling.RangeStep.

Inheritance Hierarchy

System..::..Object
  HiComponents.IEvolution..::..TWainParams

See Also