Accusoft.TwainPro9.Net
Quick Start - Acquire a TWAIN Image

Your application needs only two support features for TWAIN compliance:

The two standard methods supplied within the TwainDevice class are SelectSource and StartSession.

SelectSource displays the TWAIN Data Source Manager's User Interface with the default Data Source highlighted. Select the Data Source you want to use, then click the OK or Cancel buttons.

The StartSession method displays the current or default Data Source User Interface for image acquisition. Any capabilities that you want to change will have to be changed through the Data Source User Interface. 

C# Example
Copy Code
// This code demonstrates how to select the Data Source UI and then acquire an image from the Data Source
private void cmdScan_Click(object sender, EventArgs e)
{
 twainDevice.SelectSource();
 twainDevice.StartSession();
}
 
// After the image is acquired you can place it into the windows clipboard then into other applications
// or controls.
public void twainDevice_Scanned(object sender, Accusoft.TwainProSdk.ScannedEventArgs e)
{
 try
 {
  e.ScannedImage.CutToClipboard();
 }
 catch (Accusoft.TwainProSdk.TwainProException ex)
 {
  ErrorLabel.Text = ex.Message;
 }
}

 

See Also

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback