C# 和 .NET 中的金融 OCR
Curtis Chau
更新: 2026年8月2日
IronOCR 是一个 C# 软件组件,允许 .NET 程序员从图像和 PDF 文档中读取 126 种语言的文本,包括金融语言。
它是 Tesseract 的一个高级分支,专为 .NET 开发人员构建,在速度和准确性方面通常优于其他 Tesseract 引擎。
IronOcr.Languages.Financial 的内容
此软件包包含 16 种适用于 .NET 的 OCR 语言:
- Financial
下载
金融语言包 [金融]
安装
我们首先需要做的就是将我们的财务OCR 包安装到您的 .NET 项目中。
代码示例
此 C# 代码示例从图像或 PDF 文档中读取财务文本。
// Import the IronOcr namespace
using IronOcr;
// Instantiate the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR language to Financial
Ocr.Language = OcrLanguage.Financial;
// Create an OCR input object, specifying the path to the image or PDF
using (var Input = new OcrInput(@"images\Financial.png"))
{
// Perform OCR to read text from the input
var Result = Ocr.Read(Input);
// Retrieve the extracted text
var AllText = Result.Text;
}' Import the IronOcr namespace
Imports IronOcr
' Instantiate the IronTesseract OCR engine
Dim Ocr As New IronTesseract()
' Set the OCR language to Financial
Ocr.Language = OcrLanguage.Financial
' Create an OCR input object, specifying the path to the image or PDF
Using Input As New OcrInput("images\Financial.png")
' Perform OCR to read text from the input
Dim Result = Ocr.Read(Input)
' Retrieve the extracted text
Dim AllText = Result.Text
End Using' Import the IronOcr namespace
Imports IronOcr
' Instantiate the IronTesseract OCR engine
Dim Ocr As New IronTesseract()
' Set the OCR language to Financial
Ocr.Language = OcrLanguage.Financial
' Create an OCR input object, specifying the path to the image or PDF
Using Input As New OcrInput("images\Financial.png")
' Perform OCR to read text from the input
Dim Result = Ocr.Read(Input)
' Retrieve the extracted text
Dim AllText = Result.Text
End Using说明:
- 使用 IronOCR: 此命名空间包含 OCR 过程所需的所有类。
- IronTesseract 类: 这是启动 OCR 任务的主要类。
- 语言设置: 将语言设为
Financial,使 OCR 引擎能够识别财务术语。 - OcrInput 类: 它接受一个文件路径以指定要处理的图像或 PDF 文件。
- Read 方法: 在
Ocr.Read(Input)上执行,处理图像以根据所提供的输入和语言设置提取文本。 - Result.Text: 它存储从图像或 PDF 中识别的文本。
Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。