Spanish 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 Spanish.

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.Spanish

This package contains several OCR language options for .NET:

  • Spanish
  • SpanishBest
  • SpanishFast
  • SpanishOld
  • SpanishOldBest
  • SpanishOldFast

Download

Spanish Language Pack [español]

Installation

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

Install-Package IronOCR.Languages.Spanish

Code Example

This C# code example reads Spanish text from an Image or PDF document.

// Import the IronOcr namespace
using IronOcr;

// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();

// Set the OCR language to Spanish
Ocr.Language = OcrLanguage.Spanish;

// Use a using block to manage the OcrInput resource
using (var Input = new OcrInput(@"images\Spanish.png"))
{
    // Perform OCR on the input image
    var Result = Ocr.Read(Input);

    // Extract all text from the OCR result
    var AllText = Result.Text;

    // The 'AllText' variable now contains the Spanish text
}
// Import the IronOcr namespace
using IronOcr;

// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();

// Set the OCR language to Spanish
Ocr.Language = OcrLanguage.Spanish;

// Use a using block to manage the OcrInput resource
using (var Input = new OcrInput(@"images\Spanish.png"))
{
    // Perform OCR on the input image
    var Result = Ocr.Read(Input);

    // Extract all text from the OCR result
    var AllText = Result.Text;

    // The 'AllText' variable now contains the Spanish text
}
' Import the IronOcr namespace
Imports IronOcr

' Create a new instance of the IronTesseract class
Private Ocr = New IronTesseract()

' Set the OCR language to Spanish
Ocr.Language = OcrLanguage.Spanish

' Use a using block to manage the OcrInput resource
Using Input = New OcrInput("images\Spanish.png")
	' Perform OCR on the input image
	Dim Result = Ocr.Read(Input)

	' Extract all text from the OCR result
	Dim AllText = Result.Text

	' The 'AllText' variable now contains the Spanish text
End Using
$vbLabelText   $csharpLabel

The above code demonstrates how to utilize the IronOCR library to read and extract Spanish text from an image file named Spanish.png. Make sure to include the necessary namespaces and handle the resources appropriately within using blocks where necessary.