Leadtools TWAIN (Leadtools.Twain assembly)

AcquireToImage Method

Show in webframe
Example 





Indicates whether to display the manufacturer's user interface.
Acquires one image from a TWAIN source.
Syntax
public RasterImage AcquireToImage( 
   TwainUserInterfaceFlags flags
)
'Declaration
 
Public Function AcquireToImage( _
   ByVal flags As TwainUserInterfaceFlags _
) As RasterImage
'Usage
 
Dim instance As TwainSession
Dim flags As TwainUserInterfaceFlags
Dim value As RasterImage
 
value = instance.AcquireToImage(flags)

            

            
public:
RasterImage^ AcquireToImage( 
   TwainUserInterfaceFlags flags
) 

Parameters

flags
Indicates whether to display the manufacturer's user interface.

Return Value

One of the DialogResult values. If an error occurs, an exception is thrown.
Remarks
Use the Acquire method to acquire one or more images. Use the AcquireFast method to acquire one or more images and save them to one or more files.
The number of pages to acquire can be determined by getting the TWAIN source's capabilities. To change the number of pages to acquire, set the appropriate capability to the desired number.
This method will get images from the selected TWAIN source and pass them into an RasterImage object to the AcquirePage event through the TwainAcquirePageEventArgs class.
For each image acquired by the currently selected TWAIN source, an AcquirePage event is generated.
The Acquire method acquires pages in the following transfer modes: To set the transfer mode, call SetCapability with the appropriate capability constant.
For more information, refer to How to Acquire from the Twain Source.
Example
Copy Code  
Imports Leadtools
Imports Leadtools.Twain

Public Sub AcquireToImageExample(ByVal parent As IWin32Window)
   Dim session As TwainSession = New TwainSession()
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None)

   Dim twCap As TwainCapability = New TwainCapability()

   twCap.Information.Type = TwainCapabilityType.ImageTransferMechanism
   twCap.Information.ContainerType = TwainContainerType.OneValue
   twCap.OneValueCapability.ItemType = TwainItemType.Uint16
   twCap.OneValueCapability.Value = TwainCapabilityValue.TransferMechanismNative

   session.SetCapability(twCap, TwainSetCapabilityMode.Set)
   Dim img As RasterImage = session.AcquireToImage(TwainUserInterfaceFlags.Show)

   '
   ' save the acquired image here...
   '

   session.Shutdown()
End Sub
using Leadtools;
using Leadtools.Twain;

public void AcquireToImageExample(IWin32Window parent)
{
   TwainSession session = new TwainSession();
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None);

   TwainCapability twCap = new TwainCapability();

   twCap.Information.Type = TwainCapabilityType.ImageTransferMechanism;
   twCap.Information.ContainerType = TwainContainerType.OneValue;
   twCap.OneValueCapability.ItemType = TwainItemType.Uint16;
   twCap.OneValueCapability.Value = TwainCapabilityValue.TransferMechanismNative;

   session.SetCapability(twCap, TwainSetCapabilityMode.Set);
   RasterImage img = session.AcquireToImage(TwainUserInterfaceFlags.Show);

   //
   // save the acquired image here...
   //


   session.Shutdown();
}
Requirements

Target Platforms

See Also

Reference

TwainSession Class
TwainSession Members
Startup Method
Shutdown Method
Acquire Method
SelectSource Method
SelectedSourceName Method

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.