Urdu OCR in C# and .NET

Other versions of this document:

IronOCR is a C# software component allowing .NET coders to read text from images and PDF documents in 126 languages, including Urdu.

It is an advanced fork of Tesseract, built exclusively for .NET developers and regularly outperforms other Tesseract engines for both speed and accuracy.

Contents of IronOcr.Languages.Urdu

This package contains 37 OCR languages for .NET:

  • Urdu
  • UrduBest
  • UrduFast

Download

Urdu Language Pack [اردو]

Installation

The first thing we have to do is install our Urdu OCR package in your .NET project.

Install-Package IronOCR.Languages.Urdu

Code Example

This C# code example reads Urdu text from an image or PDF document.

// Install the IronOcr.Languages.Urdu package
using IronOcr;

var Ocr = new IronTesseract(); // Create a new OCR object
Ocr.Language = OcrLanguage.Urdu; // Set the language to Urdu

// Using a block that ensures the Input object gets disposed after use
using (var Input = new OcrInput(@"images\Urdu.png")) 
{
    var Result = Ocr.Read(Input); // Perform OCR on the input
    var AllText = Result.Text; // Extract the recognized text
    // AllText now contains the Urdu text read from the image
}
// Install the IronOcr.Languages.Urdu package
using IronOcr;

var Ocr = new IronTesseract(); // Create a new OCR object
Ocr.Language = OcrLanguage.Urdu; // Set the language to Urdu

// Using a block that ensures the Input object gets disposed after use
using (var Input = new OcrInput(@"images\Urdu.png")) 
{
    var Result = Ocr.Read(Input); // Perform OCR on the input
    var AllText = Result.Text; // Extract the recognized text
    // AllText now contains the Urdu text read from the image
}
' Install the IronOcr.Languages.Urdu package
Imports IronOcr

Private Ocr = New IronTesseract() ' Create a new OCR object
Ocr.Language = OcrLanguage.Urdu ' Set the language to Urdu

' Using a block that ensures the Input object gets disposed after use
Using Input = New OcrInput("images\Urdu.png")
	Dim Result = Ocr.Read(Input) ' Perform OCR on the input
	Dim AllText = Result.Text ' Extract the recognized text
	' AllText now contains the Urdu text read from the image
End Using
$vbLabelText   $csharpLabel