Polish OCR in C# and .NET
Curtis Chau
Updated: 2026年4月23日
本文档的其他版本:
IronOCR 是一个 C# 软件组件,它允许 .NET 开发人员从图像和 PDF 文档中读取 126 种语言(包括波兰语)的文本。 它是 Tesseract 的一个高级分支,专为 .NET 开发人员构建,在速度和准确性方面通常优于其他 Tesseract 引擎。
IronOcr.Languages.Polish 的内容
此软件包包含 43 种适用于 .NET 的 OCR 语言:
- 波兰语
- 波兰语Best
- 波兰语Fast
下载
波兰语语言包:
安装
首先要做的是将波兰语OCR 包安装到您的 .NET 项目中。
要使用 NuGet 包管理器进行安装,请执行以下命令:
代码示例
此 C# 代码示例演示了如何使用 IronOCR 从图像或 PDF 文档中读取波兰语文本。
// Install the IronOcr.Languages.Polish package via NuGet before using this code.
using IronOcr;
public class PolishOcrExample
{
public void ReadPolishTextFromImage()
{
// Initialize the IronTesseract object
var Ocr = new IronTesseract();
// Set the language to Polish
Ocr.Language = OcrLanguage.Polish;
// Provide the path to the image or PDF file containing Polish text
using (var Input = new OcrInput(@"images\Polish.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Display or process the recognized text
Console.WriteLine(AllText);
}
}
}' Install the IronOcr.Languages.Polish package via NuGet before using this code.
Imports IronOcr
Public Class PolishOcrExample
Public Sub ReadPolishTextFromImage()
' Initialize the IronTesseract object
Dim Ocr = New IronTesseract()
' Set the language to Polish
Ocr.Language = OcrLanguage.Polish
' Provide the path to the image or PDF file containing Polish text
Using Input = New OcrInput("images\Polish.png")
' Perform OCR on the input image
Dim Result = Ocr.Read(Input)
' Extract all recognized text
Dim AllText = Result.Text
' Display or process the recognized text
Console.WriteLine(AllText)
End Using
End Sub
End Class' Install the IronOcr.Languages.Polish package via NuGet before using this code.
Imports IronOcr
Public Class PolishOcrExample
Public Sub ReadPolishTextFromImage()
' Initialize the IronTesseract object
Dim Ocr = New IronTesseract()
' Set the language to Polish
Ocr.Language = OcrLanguage.Polish
' Provide the path to the image or PDF file containing Polish text
Using Input = New OcrInput("images\Polish.png")
' Perform OCR on the input image
Dim Result = Ocr.Read(Input)
' Extract all recognized text
Dim AllText = Result.Text
' Display or process the recognized text
Console.WriteLine(AllText)
End Using
End Sub
End Class该脚本初始化 OCR 引擎,指定语言(波兰语),并处理位于"images\Polish.png"的图像以提取和显示文本。 请确保文件路径正确,并在运行代码之前安装 OCR 软件包。
Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。