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

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

Contents of IronOcr.Languages.Danish

This package contains 61 OCR languages for .NET:

  • Danish
  • DanishBest
  • DanishFast
  • DanishFraktur

Download

Danish Language Pack [dansk]

Installation

The first step is to install the Danish OCR package into your .NET project.

Install-Package IronOCR.Languages.Danish

Code Example

This C# code example reads Danish text from an image or PDF document using IronOCR.

// Import the IronOcr namespace to access OCR functionalities
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize the IronTesseract object, which will handle OCR operations
        var Ocr = new IronTesseract();

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

        // Using a 'using' statement to ensure the OcrInput object is disposed of correctly
        using (var Input = new OcrInput(@"images\Danish.png"))
        {
            // Perform OCR on the input image and store the result
            var Result = Ocr.Read(Input);

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

            // Output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace to access OCR functionalities
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize the IronTesseract object, which will handle OCR operations
        var Ocr = new IronTesseract();

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

        // Using a 'using' statement to ensure the OcrInput object is disposed of correctly
        using (var Input = new OcrInput(@"images\Danish.png"))
        {
            // Perform OCR on the input image and store the result
            var Result = Ocr.Read(Input);

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

            // Output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace to access OCR functionalities
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Initialize the IronTesseract object, which will handle OCR operations
		Dim Ocr = New IronTesseract()

		' Set the language for OCR to Danish
		Ocr.Language = OcrLanguage.Danish

		' Using a 'using' statement to ensure the OcrInput object is disposed of correctly
		Using Input = New OcrInput("images\Danish.png")
			' Perform OCR on the input image and store the result
			Dim Result = Ocr.Read(Input)

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

			' Output the extracted text to the console
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

This example demonstrates setting up IronOCR to read Danish text from an image file. The IronTesseract object is configured to use the Danish language, and an image is loaded with OcrInput. Ocr.Read performs the OCR, and the recognized text is extracted and printed.