C#: Online Guide
How To: Twain SDK
Install, Deploy and Distribute
  |  
Home ›› XImage.Twain ›› C# Twain: Install, Deploy and Distribution

C# TWAIN - Install, Deploy and Distribute XImage.Twain Control


Online C# Guide for XImage.Twain Installation, Deployment and Distribution




There are three parts on this page, including system requirements for using XImage.Twain SDK, C#.NET TWAIN Scanning Basic Classes and how to install XImage.Twain into visual studio C# .NET Applications. tesseract ocr pdf to text c#, vb.net pdf print library, itextsharp insert image into pdf vb.net, c# convert pdf to tiff ghostscript, pdf viewer winforms c#, c# datamatrix reader.


Note: Since our .NET Twain Add-on is a dll that is built on official Twain driver, C#.NET programmers should install the official TWAINDSM.dll (provided in our dlls collection) manually before using RasterEdge.Imaging.Twain. Simply put TWAINDSM.DLL in x86 folder under the Windows System directory (normally C:\Windows\System32). On a 64bit system, please make sure TWAINDSM.DLL in x64 folder ends up in the WOW64 System directory (normally C:\Windows\SysWOW64). how to convert excel file to pdf in vb.net, c# create pdf from image, c# print to pdf, c# add png to pdf, vb.net convert pdf to word, c# ocr pdf to text, c# remove images from pdf.


Related .net document control helps:
c# asp.net mvc document viewer: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
asp.net sharepoint document viewer open source: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net document viewer open source: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
c# asp.net pdf editor: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net annotate pdf using c#: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net mvc pdf editor using c#: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
c# asp.net excel viewer: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.




System Requirements



Windows XP SP3 or later


Microsoft .NET Framework 2.0 or later




C#.NET TWAIN Scanning Basic Classes



To help you have a better and quicker grasp of our .NET TWAIN Scanning Add-on, we here expressly illustrate its two basic classes, which can be used in C#.NET program. asp.net add text to pdf field, c# mvc website pdf file in stored in byte array display in browser, asp.net preview pdf, best pdf viewer control for asp.net, asp.net open excel file, show image in gridview asp.net c#, asp.net pdf editor.


C# TWAIN Class: Acquisition


Acquisition object is the primary class in RETwain. C#.NET programmers can drop this .NET component onto a Form after adding it to VS Toolbox, or instantiate it directly. This is the only class you need to add standard image acquisition capabilities to C#.NET TWAIN image scanning application. For greater control over TWAIN image acquisition process, this class contains a collection of Device objects that control numerous properties used for image acquisition.


C# TWAIN Class: TWAINDevice


TWAINDevice object provides full access to a TWAIN compatible source on the system. C#.NET users can use it to open a connection to a TWAIN device, get and set properties, and then acquire one or more images. However, this class represents a system device resource and users cannot create an instance of it. Instead, in C#.NET TWAIN scanning application, users can obtain an instance to a Device object by calling GetAvailbleDevices, or from the Devices collection in the Acquisition object.




Install XImage.Twain in C# Project



Add necessary references to your C#.NET project. Right-click the project and select "Add Reference..." to locate and add the following DLLs as project references;


  RasterEdge.XImage.BarcodeScanner.dll


  RasterEdge.Imaging.Basic.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.XDoc.PDF.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.Imaging.WinformsControl.Twain.dll


Use corresponding namespaces;


  RasterEdge.Imaging.Basic.Core;


  RasterEdge.Imaging.WinformsControl.Twain;


  RasterEdge.XImage.BarcodeScanner;


  RasterEdge.XImage.Raster;


Add the following C# demo code to your project (set twain device ability).




public void QueryDeviceCapabilities(Device device)
{
   // Open a connection to the device.
   device.Open();
   device.TransferMode = TwainTransferMode.TWSX_NATIVE;

   // See if the device supports file transfer.
   TwainTransferMode[] methods =
   device.GetSupportedTransferModes();
   foreach (TwainTransferMode method in methods)
   {
      if (method == TwainTransferMode.TWSX_FILE2)
         {
            // Use TWSX_FILE2 when possible.
            device.TwainTransferMode = method;
            break;
         }

            if (method == TwainTransferMethod.TWSX_FILE)
            device.TransferMethod = method;
   }

   // If it's not supported tell stop.
   if (device.TransferMode == TwainTransferMode.TWSX_NATIVE)
   {
      // Close the connection.
      device.Close();
      Console.WriteLine("File Transfer not supported");
      return;
   }

   // Find out which file types the device can save to.
   TwainImageFormat[] formats = device.GetSupportedImageFormats();
   // We want to save the image as a TIFF.
   foreach (TwainImageFormat format in formats)
   {
      if (format == TwainImageFormat.Tiff)
         {
            // TIFF is supported, so set the FileFormat.
            device.FileFormat = format;
            // Now lets try to use Group4 or Group3 compression.
            // We could use GetSupportedCompressionModes, but we
            // will simply try setting the Compression property instead.
            device.Compression = TwainCompressionMode.Group4;
            if (device.Compression != TwainCompressionMode.Group4)
            device.Compression = TwainCompressionMode.Group3;
            break;
         }
   }

   // Start the acquire process, using the device's interface.
   device.Acquire();

   // don't forget to close the connection after done
}