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

C#: Basic OCR SDK Concept

Introduce C# Developers Three Basic Concepts of RasterEdge OCR SDK for .NET

To help C# developers have better understanding of of our XImage.OCR for .NET, we provide more details for basic OCR SDK concepts on this page. In all, three C# OCR classes will be talked, including OCRHandle, OCRRecSetting, and OCRPage. For each class, we explain all designed public methods and properties.

Related .net document control helps:
asp.net sharepoint document viewer free: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net edit pdf image control: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net edit pdf page: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
asp.net excel view: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
asp.net display tiff images: ASP.NET Tiff Viewer: view, annotate multipage Tiff images in ASP.NET MVC, WebForms using C# Control
asp.net annotate pdf control: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
mvc pdf editor: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC

C# OCRHandle Class

This C# class is the utility class.

Public Methods

Import(override +5)

Create an OCRDocument/OCRPage instance in C# programming by inputting image.


Reset recognizing setting and output setting to default values.


Change the path of those training resource files. The resource path should be the path of folder that include those trained data files (with file extension ".traineddata"). Default: all trained data files should be put in a folder called "Source", and this "Source" folder MUST BE put in the same dictionary as the assemblies.

Translate(override +3)

Recognize all characters in images, and save the results into PDF/SVG/TXT file/stream.

Public Property


Set/get the settings applying in C# OCR recognition process.

C# OCRRecSetting Class

C# users can set OCR recognition setting of OCR entities in any level, namely OCRHandler, OCRDocument, OCRPage and OCRZone. The setting in the lower level entity overrides that in the higher one. Below is a table to describe all the methods in OCRRecSetting class.

Public Methods


Specify if this setting is valid or not. Default is false for all OCR entities except for OCRHandler.


Specify the languages used in C# OCR recognition.


The value could be Default/Fast/Accurate.

Fast: spend the least time to scan source image.

Accurate: get the most accurate OCR result.

Default: balance between time consuming and accuracy.


These properties would define a set of valid characters. The result characters MUST BE in this set.



If a character is not a valid character, it would be replaced by this DefaultUnkownChar.

C# OCRPage Class

OCRPage may contain a collection of OCRZone, which will not recognize unless the property RecognizeZoneOnly is true. C# developers can get an instance by invoking OCRHanle.Import or OCRDocument.GetPage.

Public Methods


Create a zone in the page.


Get C# OCR recognition result of the zone by its index.


Recognize the page. Return 0 if recognition is success.

SaveTo(override +2)

Convert recognized results to PDF/SVG/TXT format and save into a file/stream. You MUST invoke Recognize before calling this method.

Public Properties


Set/get settings in page recognition process.

If this setting is disabled (property Enabled is false), it would use the settings defined in OCRHanle.setting during page recognition process.


Set/get the settings of the output (Not Implemented Yet).


Page width.


Page height.


If this property is true, only the zones in the page will be recognized during page recognizing process. Otherwise, the whole page will be processed.


Return the zones in the page.

OCRZone will use OCRPage.RecSetting in C# OCR recognition process if RecSetting.Enabled of themselves is false.