C# 和 .NET 中的金融 OCR

This article was translated from English: Does it need improvement?
Translated
View the article in English

还有126种语言

IronOCR 是一个 C# 软件组件,允许 .NET 程序员从图像和 PDF 文档中读取 126 种语言的文本,包括金融语言。

它是 Tesseract 的一个高级分支,专为 .NET 开发人员构建,在速度和准确性方面通常优于其他 Tesseract 引擎。

IronOcr.Languages.Financial 的内容

此软件包包含 16 种适用于 .NET 的 OCR 语言:

  • 金融的

下载

金融语言包 [金融]

安装

我们首先需要做的就是将我们的财务OCR 包安装到您的 .NET 项目中。

Install-Package IronOCR.Languages.Financial

代码示例

此 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
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
Private 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 Input = 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
$vbLabelText   $csharpLabel
  • PdfWriter:此对象负责写入PDF文件。它作用于文件路径,并写入有效PDF文档所需的结构。

-使用 IronOcr:此命名空间包含 OCR 过程所需的所有类。

  • IronTesseract 类:这是实现 OCR 任务的主要类。 -语言设置:将语言设置为Financial可使 OCR 引擎识别金融术语。
  • OcrInput 类:它接受一个文件路径,该路径指定要处理的图像或 PDF 文件。 -读取方法:Ocr.Read(Input)上执行,它处理图像以根据提供的输入和语言设置检索文本。
  • Result.Text:它存储从图像或 PDF 中识别出的文本。