Guide for C#
Core Document Formats
Additional Features

C# Imaging - Form Processing & Recognition in C#

Visual C# Codes for Form Identification & Processing with .NET Imaging SDK

Visual C#
Home > .NET Imaging SDK > C# > Form Processing
If this is your first time to use our DocImageSDK, we strongly suggest you reading How to Start first!

RasterEdge .NET Imaging SDK is a mature image processing toolkit with multiple image & document manipulation DLL libraries, including this form processing plug-in component. This component enables .NET developers to build powerful application for template / form processing, such as form scanning & recognition, form image cleanup, form alignment, OCR, OMR, and many other features. We provide fully-functional evaluation package, please download now to enjoy the wonderful form processing features!
  • Scanning forms on the image or document for recognition in C# project
  • Provide advanced features to clean up and enhance forms quality with C# codes
  • Identify and align forms using Visual C# programming language
  • Drop out and extract zones for later data processing
  • Compiling C# to detect OCR, ICR and OMR in C#
  • Easy to decode / read various linear and 2D barcodes like Code 39, QR Code, etc
  • Using C# demo codes to save form recognition results
  • Offer sample application with C# source code for more form recognition and processing functions
This page is a simple guide demonstrating how to identify and process forms in a C# imaging project. The following sections will be mentioned in the later demonstration:
  • How to build a C# form processing application
  • How to load a form in C# project
  • How to identify and align form using C#
  • More Visual C# tutorials and sample codes for image and doc editing
Besides this form processing feature, you can also opt for other RasterEdge add-on SDK to add more flexible functions. For example, we also provide this .NET Barcode Generator and Barcode Reader control libraries so you can write or scan barcodes in your forms. You can also take a look at this C#.NET image SDK programming for image manipulation such as jpeg / gif / png / tiff image generation, editing, annotating, converting, saving and printing in your forms.
Build a C# Application for Form Processing and Recognition
This page tells users how to detect / recognize, process and save form with RasterEdge .NET Imaging SDK and Template Processing Plug-In in Visual C# project. (For VB.NET developers, please go to Form Processing for VB.NET. If you are building applications for .NET WinForms or ASP.NET Web project, please go to Template Recognition in WinForms and Web Document Form Processing & Recognition.)
  1. Run Microsoft Visual Studio (2005 to 2012 versions supported);
  2. Create a project with programming language - Visual C#;
  3. Activate license for .NET Imaging SDK and copy created "RasterEdgeLicense.txt" to the new project folder, together with .NET Imaging SDK DLL(s);
  4. Add RasterEdge DocImageSDK core dlls & RasterEdge.Imaging.Form.dll to your Visual C# applications;
  5. Call RasterEdge .NET Image SDK Namespace with the samples demonstrated below:
using System.IO;
using System.Drawing.Printing;
using RasterEdge.Imaging;
using RasterEdge.Imaging.Processing;
using RasterEdge.Imaging.Form.Processing;
using RasterEdge.Imaging.Form.Recognition;
Load Form in C#.NET Codes
The following C# sample code shows how to load a form to your Visual C# project for form processing & identification. Please copy to your program for evaluation. You can make necessary change to the settings like text field name, form page, and so on, to get a form which meets your requirements better.
FormProcessingEngine processingEngine = new FormProcessingEngine();
processingEngine.Pages.Clear();

FormPage formPage = new FormPage(2, 100, 100);
TextFormField textField = new TextFormField();
textField.Name ="Business Name";
textField.Bounds = new LogicalRectangle(196,327, 1402, 40, LogicalUnit.Pixel);
formPage.Add(textField);
textField = new TextFormField();
textField.Name = "Address";
textField.Bounds = new LogicalRectangle(196, 496, 892, 35,LogicalUnit.Pixel);
formPage.Add(textField);
processingEngine.Pages.Add(formPage);

private void ProcessForm(RasterImage image,List<PageAlignment> alignment)
{
processingEngine.OcrEngine= formsOCREngine;
string resultsMessage = String.Empty;
try
{
processingEngine.Process(image, alignment);
foreach(FormPage formPage in processingEngine.Pages)
{
foreach(FormField field in formPage)
{
if (field != null)
{
resultsMessage = String.Format("{0}{1} = {2}{3}",
resultsMessage,
field.Name,
(field.Result as TextFormFieldResult).Text,
Environment.NewLine);
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
if (String.IsNullOrEmpty(resultsMessage))
MessageBox.Show("No fields were processed", "FieldProcessing Results");
else
MessageBox.Show(resultsMessage, "Field ProcessingResults");
}
Identify and Align Form in C#.NET
The Visual C# code below demonstrates how to identify and align form or template in a C# application. Copy and paste the C# codings to your program to easily recognize incoming scanned forms from your form library, and align it for later processing. When this is done, users can feel free to conduct further form processing actions such as form registration, form drop out, form field / zone extraction, as well as OCR / OMR / ICR processing.
RasterEdgeImage sourceImage = new RasterEdgeImage(@"C:\temp\sourceImage.tif");
RasterEdgeImage targetImage = new RasterEdgeImage(@"C:\temp\targetImage.tif");
PageFingerprintGenerator generator = new PageFingerprintGenerator();
PageFingerprint sourceFingerprint = generator.GenerateFingerprint(sourceImage);
PageFingerprint targetFingerprint = generator.GenerateFingerprint(targetImage);
DocumentAligner aligner = new DocumentAligner();
AlignmentResult result = aligner.Align(sourceFingerprint, targetFingerprint);
AlignmentRejector rejector = new AlignmentRejector();
rejector.TestAlignmentResult(result);
More Tutorials!
Find more user guides with RasteEdge .NET Image SDK using Visual C# sample codings!


Recommend this to Google+