附加 OCR 语言包

Curtis Chau
Curtis Chau
Updated: 2026年4月22日

IronOCR 支持 125 种国际语言,但 IronOCR 默认只安装了英语。

可以通过 NuGet 或 DLL 文件轻松地将其他语言包添加到您的 C#、VB 或ASP.NET项目中,下载这些 DLL 文件并将其添加为项目引用。

代码示例

国际语言示例

PM > Install-Package IronOcr.Languages.ChineseSimplified

using IronOcr;

var ocr = new IronTesseract();
// Set the OCR to use Chinese Simplified
ocr.Language = OcrLanguage.ChineseSimplified;

using (var input = new OcrInput())
{
    // Add an image to be processed
    input.AddImage("img/chinese.gif");

    // Optional: Enhance the input by deskewing or denoising the image
    // input.Deskew();
    // input.DeNoise();

    // Process the image and retrieve the result
    var result = ocr.Read(input);

    // Store the recognized text in a string
    string testResult = result.Text;

    // Save the recognized text to a file since the console might not display Unicode characters properly
    result.SaveAsTextFile("chinese.txt");
}

竖式书写语言示例

专为竖写语言设计的词典。 使用韩语和日语 OCR 语言的"垂直"变体。

using IronOcr;

var ocr = new IronTesseract();
// Set the OCR to use Japanese Vertical language
ocr.Language = OcrLanguage.JapaneseVertical;

using (var input = new OcrInput(@"images\image.png"))
{
    // Process the image and get the OCR result
    var result = ocr.Read(input);
    // Output the recognized text to the console
    Console.WriteLine(result.Text);
}

自定义语言示例

适用于您下载或自行训练的任何 Tesseract .traineddata 语言文件。

using IronOcr;

var ocr = new IronTesseract();

// Use a custom Tesseract language file
ocr.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata");

using (var input = new OcrInput(@"images\image.png"))
{
    // Process the image and get the OCR result
    var result = ocr.Read(input);
    // Output the recognized text to the console
    Console.WriteLine(result.Text);
}

多语言示例

同时学习多种语言。

PM > Install-Package IronOcr.Languages.Arabic

using IronOcr;

var ocr = new IronTesseract();

// Set the primary language to English
ocr.Language = OcrLanguage.English;
// Add Arabic as a secondary language
ocr.AddSecondaryLanguage(OcrLanguage.Arabic);
// Add any number of languages

using (var input = new OcrInput(@"images\multi-lang.pdf"))
{
    // Process the PDF and get the OCR result
    var result = ocr.Read(input);
    // Output the recognized text to the console
    Console.WriteLine(result.Text);
}

更快的语言示例

专为快速使用而设计的词典。 使用任何 OcrLanguage 的"快速"版本。

using IronOcr;

var ocr = new IronTesseract();
// Set the OCR to use the fast variant of English
ocr.Language = OcrLanguage.EnglishFast;

using (var input = new OcrInput(@"images\image.png"))
{
    // Process the image and get the OCR result
    var result = ocr.Read(input);
    // Output the recognized text to the console
    Console.WriteLine(result.Text);
}

更高精度的详细语言示例

词典经过优化,准确性更高,但检索速度较慢。 使用任何 OcrLanguage 的"最佳"版本。

PM > Install-Package IronOcr.Languages.French

using IronOcr;

var ocr = new IronTesseract();
// Set the OCR to use the best variant of French
ocr.Language = OcrLanguage.FrenchBest;

using (var input = new OcrInput(@"images\image.png"))
{
    // Process the image and get the OCR result
    var result = ocr.Read(input);
    // Output the recognized text to the console
    Console.WriteLine(result.Text);
}

如何安装 OCR 语言包

其他 OCR 语言包可供下载,详情请见下方。 任何一个

  • 安装 NuGet 包。 在NuGet中搜索IronOCR语言。
  • 或下载"ocrdata"文件并将其添加到您的.NET项目中的任何文件夹。设置CopyToOutputDirectory = CopyIfNewer

下载 OCR 语言包

帮助

如果您要阅读的语言不在上面的列表中,请 联系我们。

如有需要,我们还提供其他多种语言版本。

优先考虑 IronOCR 许可证持有者的生产资源,因此请考虑 为 IronOCR 申请许可证,以访问您所需的语言包。

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

阅读更多

准备开始了吗?

Nuget Downloads 6,357,159版本:2026.11刚刚发布