Twain Scanning in VB.NET

Comprehensive VB.NET Codes for Twain Scanning within .NET Imaging SDK

RasterEdge Twain SDK can be used as a standalone product or worked together with RasterEdge .NET Imaging SDK for fast Twain scanning.
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.)
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.