Divehi OCR in C# and .NET
Curtis Chau
Updated: 2026年6月29日
IronOCR 是一个 C# 软件组件,允许 .NET 程序员从图像和 PDF 文档中读取 126 种语言(包括迪维希语)的文本。
它是 Tesseract 的一个高级分支,专为 .NET 开发人员构建,在速度和准确性方面通常优于其他 Tesseract 引擎。
IronOcr.Languages.Divehi 的内容
此软件包包含 43 种适用于 .NET 的 OCR 语言:
迪维希 迪维希Best 迪维希Fast
下载
迪维希语包[ދވހ]
下载为Zip 文件
- 使用NuGet安装
安装
我们需要做的第一件事是将Divehi OCR 包安装到您的 .NET 项目中。
代码示例
此 C# 代码示例从图像或 PDF 文档中读取迪维希语文本。
// Import the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Create an instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR language to Divehi
Ocr.Language = OcrLanguage.Divehi;
// Load the image or PDF document into the OCR processor
using (var Input = new OcrInput(@"images\Divehi.png"))
{
// Perform OCR on the input document
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Output the extracted text to the console
Console.WriteLine(AllText);
}
}
}' Import the IronOcr namespace
Imports IronOcr
Module Program
Sub Main()
' Create an instance of the IronTesseract OCR engine
Dim Ocr As New IronTesseract()
' Set the OCR language to Divehi
Ocr.Language = OcrLanguage.Divehi
' Load the image or PDF document into the OCR processor
Using Input As New OcrInput("images\Divehi.png")
' Perform OCR on the input document
Dim Result = Ocr.Read(Input)
' Extract all recognized text
Dim AllText = Result.Text
' Output the extracted text to the console
Console.WriteLine(AllText)
End Using
End Sub
End Module解释
- 导入 IronOCR:该示例首先导入必要的 IronOCR 命名空间。
- 创建OCR引擎:创建OCR引擎实例
IronTesseract。 -指定语言:OCR 处理的语言设置为迪维希语,确保针对该语言进行准确识别。 - 加载输入:通过
OcrInput打开图像或PDF文档,准备进行文本提取。 - 执行OCR:
Read方法处理输入并提取文本。 - 文本提取:识别的文本存储在
AllText中并打印到控制台。
这段代码展示了一种简单而强大的方法,利用 IronOCR 从数字文档中读取迪维希文字。

技术作家
Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。
...
阅读更多