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:
c# asp.net dicom document viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
asp.net pdf editor using c#: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net webforms pdf editor using c#: ASP.NET WebForms PDF Editor: create, view, edit, annotate, redact PDF file in ASP.NET WebForms application
c# asp.net pdf document viewer: ASP.NET PDF Document Viewer in C#: view, annotate, redact Adobe PDF files online in ASP.NET
asp.net edit pdf page using c#: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
c# asp.net powerpoint document viewer: ASP.NET PowerPoint Document Viewer Control: view pptx files online in C# using ASP.NET
c# asp.net document redaction: Redact document ASP.NET: add, delete, apply redaction on PDF files in web browser using C#.net

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.