RasterEdge Twain SDK can be used as a standalone product or worked together with RasterEdge .NET Imaging SDK for fast Twain scanning.
- Support for batch scanning
- Detect blank pages
- Acquire images from selected TWAIN source
- Acquire images to an FTP or HTTP server
- Detect compression modes, frame sizes, resolutions and supported by a device
- Support duplex scanning for both front and back of pages
- More Twain Scanning functions
Twain Scanning
Here is a detailed VB.NET sample for acquiring images from scanners, capture cards and digital cameras with RasterEdge .NET Imaging SDK and Twain Scanner. (For C#.NET developers, please go to
Twain Scanning for C#.NET. Want to view Image and document in Winforms or Web applications, please go to
Twain Scanning in Winforms and
Web Document Image Twain Scanning.)
- Start Visual Studio .NET (2005 or later version);
- Begin a new project with programming language - VB.NET;
- Add RasterEdge.DotNetImaging.dll & RasterEdge.DotNetImaging.Twain.dll to your VB.NET applications;
- Add the appropriate Imports directive:
Imports System.IO
Imports RasterEdge.Imaging
Imports RasterEdge.Imaging.Processing
Imports RasterEdge.Imaging.Twain
Acquire Image
Users may easily acquire images from DIB or from a file with following VB.NET codes:
Public Function TwainAcquireToRasterEdgeImageImage(ByVal HANDLE As Integer) As Integer
' Acquire a single image, from the currently selected Data Source to a DIB handle
Public Function TwainAcquireToDib(ByVal HANDLE As IntPtr) As IntPtr
' Acquire a single image, from the currently selected Data Source to a file
Public Function TwainAcquireToFile(ByVal FilePath As String, ByVal HANDLE As Integer) As RasterEdgeImageStatus
Initialize the TWAIN session
Initializing the TWAIN session can be an easily task with following VB.NET codes:
Public Sub Startup(ByVal owner As IWin32Window, ByVal manufacturer As String, ByVal productFamily As String, ByVal
version As String, ByVal application As String, ByVal flags As TwainStartupFlags)
Upload Image to Sever
If you want to upload image to sever, please copy those following VB.NET codes:
Private Sub UploadImage(ByVal image As System.Drawing.Bitmap)
Dim post As RasterEdge.Twain.HttpPost = New RasterEdge.Twain.HttpPost() post.FormData.Add("image1", image,
"filename.png")
post.FormData.Add("username", user)
post.FormData.Add("password", password)
Dim ret As String = post.PostData("http://www.website.com/postImage.aspx")
End Sub
Acquire Size and Position
The following code shows how to control acquired image position and size:
Me.device.Units = UnitType.Inches
If Me.device.Units <> UnitType.Inches Then
Return
End If
Me.device.Frame = New System.Drawing.RectangleF(0, 0, 8.5, 11)
More Tutorials!
Find more user guides with RasteEdge .NET Image SDK using VB.NET sample codings!
Want to install Imaging SDK in Winforms or Web applications, please go to
Use Imaging SDK in Winforms and
Web Document Image Viewer.