Pashto 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 Pashto. 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.Pashto
This package contains 43 OCR languages for .NET:
- Pashto
- PashtoBest
- PashtoFast
Download
Pashto Language Pack [پښتو]
Installation
The first thing we have to do is install our Pashto OCR package into your .NET project.
Install-Package IronOCR.Languages.Pashto
Code Example
This C# code example reads Pashto text from an image or PDF document.
// Import the IronOcr namespace
using IronOcr;
public class PashtoOcrExample
{
public static void Main()
{
// Create an instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the OCR language to Pashto
Ocr.Language = OcrLanguage.Pashto;
// Specify the image file containing the Pashto text
using (var Input = new OcrInput(@"images\Pashto.png"))
{
// Perform the OCR operation on the input image
var Result = Ocr.Read(Input);
// Store the extracted text from the image in a string variable
var AllText = Result.Text;
}
}
}
// Import the IronOcr namespace
using IronOcr;
public class PashtoOcrExample
{
public static void Main()
{
// Create an instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the OCR language to Pashto
Ocr.Language = OcrLanguage.Pashto;
// Specify the image file containing the Pashto text
using (var Input = new OcrInput(@"images\Pashto.png"))
{
// Perform the OCR operation on the input image
var Result = Ocr.Read(Input);
// Store the extracted text from the image in a string variable
var AllText = Result.Text;
}
}
}
' Import the IronOcr namespace
Imports IronOcr
Public Class PashtoOcrExample
Public Shared Sub Main()
' Create an instance of the IronTesseract class
Dim Ocr = New IronTesseract()
' Set the OCR language to Pashto
Ocr.Language = OcrLanguage.Pashto
' Specify the image file containing the Pashto text
Using Input = New OcrInput("images\Pashto.png")
' Perform the OCR operation on the input image
Dim Result = Ocr.Read(Input)
' Store the extracted text from the image in a string variable
Dim AllText = Result.Text
End Using
End Sub
End Class
- This code snippet demonstrates how to utilize the IronOCR library for recognizing Pashto text.
- It sets up the
IronTesseract
class, selects Pashto as the language, and processes an image file (Pashto.png
) to extract and display the text.