OCR: How to C#
Using OCR SDK for C#.NET
Sample C#.NET Codes
Quick to Start
Home ›› XImage.OCR ›› C# OCR: Quick to Start

C#: Quick to Start with Tiff Image Text Extraction

Help C# User Have Quick Evaluation of .NET OCR SDK, Providing Simple Sample Code to Extract Text from a Tiff File

On this tutorial, we provide free Visual C# programming code for testing the functionality of text extraction from raster image Tiff. You may directly copy demo code below to your C#.NET project to have a quick evaluation of our XImage.OCR for .NET. At the very beginning, you may install .NET OCR SDK DLLs into your Visual Studio C# project as references. Please note that, for Tiff image text extraction, RasterEdge.Imaging.TIFF.dll should also be added as project reference.

Related .net document control helps:
asp.net pdf viewer: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
asp.net edit pdf text: ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET
asp.net iis document viewer: C# HTML5 Viewer: Deployment on IIS
asp.net sharepoint document viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net dnn document viewer: DNN Document Viewer Control: view, annotate, redact, convert documents in dotnetnuke ASP.NET
asp.net webforms document viewer: ASP.NET WebForms application document viewer control: view, annotate, redact, convert files online in ASP.NET
asp.net text document viewer: C# HTML5 Viewer: Load, View, Convert, Annotate and Edit OpenOffice, CSV and Text file

C# Sample Code to Extract Text from Tiff Image File

By using well developed .NET APIs, C# programmers are able to extract and recognize Tiff image file characters. Both single page Tiff image and multi-page Tiff image are supported by our OCR Toolkit for C#.NET. And the following free code example is available for these two forms. As you see, you can choose to load a certain page of Tiff image file and get its text. After recognition, OCR result can be saved and output as text, PDF and SVG files.

Add References












Using Namespaces

  using RasterEdge.XDoc.TIFF;

  using RasterEdge.XImage.OCR;

Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:


       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.


       If using x86, the platform target should be x86.

// Set the training data path. Please put eng.traineddata (for English) under the path specified.

// Set supported language. You can also set this attribute in OCRPage or OCRZone.

// Load Tiff image file.
TIFFDocument doc = new TIFFDocument(@"c:\sample.tif");

// Load the first page to recongnize.
TIFFPage page = (TIFFPage)doc.GetPage(0);

// Rasterize the page with a resolution multipi.
Bitmap bmp =  page.GetBitmap(1.5f);

// Import the page to recoginze.
OCRPage oPage = OCRHandler.Import(bmp);

// Save OCR result as a supportive documet format (Txt, PDF and SVG).

// Or you can output the text directly.

More C# Demos for Using OCR Software

If you need to use OCR technology to recognize and extract text content from other supportive image and document formats, please directly refer to More C# Demos for Image File Text Extraction.