C#: Online Guide
How To: Twain SDK
Console Based Scanning
Console Based Scanning
  |  
Home ›› XImage.Twain ›› C# Twain: Console Based Scanning

C# TWAIN - Scan Multi-pages into One PDF Document


Easy to Scan Multiple Pages into One PDF/TIFF in C# with .NET TWAIN Toolkit




C# TWAIN: Scan Multi-pages into One PDF/TIFF Overview



It is common to scan multiple pages into a single PDF or TIFF file through C#.NET programming in document imaging world. Using our .NET Imaging SDK and its TWAIN Scanning Add-on, it is so easy to scan many pages into one PDF or TIFF document file in C#.NET application. RETwain, along with REImage can easily be used to accomplish this task. convert pdf page to image c#, convert word document to pdf using itextsharp c#, pdf viewer winforms c#, tesseract ocr pdf to text c#, c# add text to existing pdf file, how to search text in pdf using c#. The two most popular multipage image formats are TIFF and PDF, and this C# guide page will concentrate on PDF. Since in RasterEdge Imaging, the TIFFDocument and PDFDocument have common prototype, BaseDocument Class, so the procedure for TIFF is very similar.


Related .net document control helps:
asp.net dicom document viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
asp.net sharepoint document viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net document viewer c#: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
asp.net pdf document viewer: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...
asp.net word viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net pdf editor: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net image viewer: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery


If you want to use our C#.NET TWAIN SDK to scan and save multiple pages into one PDF or TIFF document through TWAIN acquisition, you need to do three things for preparation. First of all, install .NET Framework 2.0 or later versions on your computer. get pdf page count c#, pdf to text conversion c#, how to rotate pdf in c#, c# pdf to tiff itextsharp, vb.net pdf editor, merge pdf files in asp net c#, c# pdf add background. Then, make Visual Studio 2005 or later versions available. At last, install TWAIN and provide at least one TWAIN compatible device.


On this page, you will find C#.NET document imaging DLLs used for scanning multiple pages into one PDF/TIFF document, key events for this TWAIN scanning, and C#.NET demo code to accomplish this task. asp.net pdf writer, pdf viewer for asp.net web application, asp.net display image from memorystream, mvc display pdf in browser, asp net replace text from pdf javascript, asp.net preview pdf, c# asp.net open word document.




DLLs for C# Console Based TWAIN Scanning



Basically, there are three DLLs, namely RasterEdge.Imaging.Basic.dll, RasterEdge.Imaging.Basic.Codec.dll and RasterEdge.Imaging.TWAIN.dll, should be integrated into your Visual C#.NET Console application to perform advanced TWAIN image scanning in Console application.




C# Sample Code for Console Based TWAIN Scanning



Please use the following C# sample code to have a quick test for Console based TWAIN image scanning. Actually, scanning from the Console is done similarly to scanning in a .NET WinForms application.




public class AcquisitionClass
   {
      static void Main(string[] args)
      {
         Acquisition acquisition = new Acquisition();
         AddEvents(acquisition);
         count = 0;
         List<string> names = acquisition.GetAvailbleDevicesName();
         string deviceName = names[0];
         TWAINDevice device = acquisition.GetDevice(deviceName);
         Console.Out.WriteLine("---Beginning Scan---");
         device.Open();

         // scan all availble pages
         device.ScanSetting.ShouldTransferAllPages = true;
         device.Acquire();
         Console.Out.WriteLine("---Ending Scan---\n Press Enter To Quit");
         Console.In.Peek();
      }

      private static void AddEvents(Acquisition acquisition)
         {
            acquisition.ImageAcquired += new ImageAcquiredEventHandler(acquisition_ImageAcquired);
            acquisition.AcquireCompleted += new AcquireCompletedEventHandler(acquisition_AcquireCompleted);
            acquisition.AcquireCanceled += new AcquireCanceledEventHandler(acquisition_AcquireCanceled);
         }

      static void acquisition_AcquireCanceled(object sender, EventArgs args)
         {
            Console.Out.WriteLine("Acqusition Canceled");
         }

      static void acquisition_AcquireCompleted(object sender, AcquireCompletedEventArgs args)
         {
            Console.Out.WriteLine("Acquisition Finished");
         }

      static int count;

      static void acquisition_ImageAcquired(object sender, ImageAcquiredEventArgs args)
         {
            string filename = "out" + count++ + ".tif";

            // save scanned images as PNG
            args.OutputImage.Save(ImageType.PNG, @"c:\"+count+".png");
            Console.Out.WriteLine("Frame " + count + " Acquired. Saved At: " + filename);
         }
   }



In addition to C# guide for Console based TWAIN scanning, RasterEdge also illustrates how to scan many pages into a PDF or TIFF file in C#.NET.