Guide for VB.NET
Core Document Formats
Additional Features
Scan Multi-pages into One PDF Document

VB.NET TWAIN - How to Scan Multi-pages into a PDF

Scan Many Pages into One File in TWAIN Image Capturing Project

VB.NET
Home > .NET Imaging SDK > VB.NET > TWAIN: Scan Multi-pages into One PDF Document
To get started with DocImage SDK for .NET, you are supposed to read VB.NET Imaging: Get Started first!

In today's modern enterprises or institutions, there are often a large number of photos or documents (which are in the form of hard copy) being scanned and stored in digital format via document capturing and imaging system. And in most cases, those scanned individual image files need to be combined into one convenient multi-page document file, like PDF and TIFF. This VB.NET TWAIN pages scanning control add-on is developed to offer programmers an efficient solution to scan multiple pages into one PDF or TIFF document file.
Related .net document control helps:
powerpoint viewer asp.net mvc: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET
asp.net pdf document viewer c#: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...
asp.net view text file: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net office document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net view excel in browser: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
asp.net image viewer jquery: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
asp.net sharepoint document viewer free: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
From this VB.NET TWAIN pages scanning library SDK, you will find answers to following TWAIN capturing questions.
  • What acquisition events do I need to use in the process of VB.NET TWAIN pages scanning process?
  • What VB.NET demo code can I use to scan many pages into one PDF document file?
  • What are the system requirements of this VB.NET TWAIN pages scanning library plug-in?
TWAIN Acquisition Events
Before introducing the detailed process of scanning many pages into one PDF or TIFF file, we will guide you to look at what it takes to scan a single page. What should be mentioned here is that, the whole TWAIN image acquisition and capturing process, namely, the process of capturing a page and transferring scanned image to target application, is event driven. To put it in another way, if you want to conduct certain TWAIN image scanning function, like saving an image, you need to use corresponding event handler.
Here we list the three main TWAIN acquisition events that may need to be used in the VB.NET TWAIN pages scanning process.
  • ImageAcquired: this event will be raised when the scanner finishes capturing and scanning a page.
  • AcquireFinished: this event will be triggered when the scanner finishes scanning the last page.
  • AcquireCanceled: this event will be raised if users cancel the image acquisition process.
After this TWAIN pages scanning control captures the images to your application, your can use the PDF processing or TIFF editing APIs contained in this VB.NET TWAIN pages scanning SDK to create standard PDF or TIFF document file based on captured image source.
Note: In RasterEdge VB.NET TWAIN scanning SDK, the acquisition is controlled by one acquisition object. As one acquisition object is linked to the TWAIN device and TWAIN only allows one connection, please make sure there is only one acquisition object in the application in the process of scanning multiple pages into PDF or TIFF file.
VB.NET Sample Code
This VB.NET TWAIN pages scanning control add-on allows developers to scan multiple pages into PDF or TIFF file. And here we offer a VB.NET demo code which is mainly used to scan many pages into PDF document file via TWAIN image capturing application. By the way, if you need to scan double-sided pages into one PDF document file, maybe you need to integrate this duplex scanning function (supported by this VB.NET featured TWAIN scanning control) into your VB.NET TWAIN scanning application.
Public Class AcquisitionClass
Private _acquireCanceled As Boolean
Private myAcquisition As New Acquisition()

Public Sub ScanImages()
_acquireCanceled = False
myAcquisition.AcquireCanceled += New EventHandler(AddressOf OnAcquireCanceled)
myAcquisition.AcquireFinished += New EventHandler(AddressOf OnAcquireFinished)
myAcquisition.ImageAcquired += New EventHandler(AddressOf OnImageAcquired)
Dim activeDevice As Device = myAcquisition.ShowSelectSource()
activeDevice.Acquire()
End Sub

Private Sub OnImageAcquired(sender As Object, e As ImageAcquiredEventArgs)
If e.Image IsNot Nothing Then
Dim doc As New TIFFDocument("outputTiff.tif")
Dim page As New TIFFPage(e.Img)
doc.AddPage(page)
doc.Save("outputTiff.tif")
doc.Dispose()
End If
End Sub

Private Sub OnAcquireCanceled(sender As Object, e As EventArgs)
_acquireCanceled = True
End Sub

Private Sub OnAcquireFinished(sender As Object, e As EventArgs)
If _acquireCanceled Then
Return
End If

Dim doc As New TIFFDocument("outputTiff.tif")
Dim pageCount As Integer = doc.GetPageCount()
Dim imgSouce As New List(Of REImage)()

For i As Integer = 0 To pageCount - 1
Dim img As REImage = DirectCast(doc.GetPage(i).ToImage(), REIMage)
imgSouce.Add(img)
Next

Dim doc1 As New PDFDocument(imgSouce)
doc1.Save("outputPDF.pdf")
End Sub
End Class
System Requirements
This section mainly talks about the installation requirements of this VB.NET TWAIN pages scanning control add-on. Written in managed C# code, this VB.NET TWAIN pages scanning library add-on is compatible with most .NET developing applications, like ASP.NET web application and Windows Forms project. In order to scan many pages into PDF or TIFF file using this VB.NET TWAIN pages scanning control, please make sure that you have installed:
  • .NET Framework 2.0 or later versions
  • Microsoft Visual Studio 2005 or later versions
  • RasterEdge TWAIN image scanning dlls
  • Valid license key of VB.NET TWAIN pages scanning SDK
  • TWAIN and at least one TWAIN compatible device
If you want to know more VB.NET TWAIN scanning functions, please read this VB.NET TWAIN image scanning tutorial page.


Recommend this to Google+


RasterEdge.com is professional provider of ASP.NET MVC Document Viewer, ASP.NET PDF Viewer, MVC PDF Viewer document, content and imaging solutions, available for ASP.NET AJAX, Silverlight, Windows Forms as well as WPF. We are dedicated to provide powerful & profession imaging controls, PDF document, image to pdf files and components for capturing, viewing, processing, converting, compressing and stroing images, documents and more.

©2000-2017 Raster Edge.com