IRONSOFTWAREHOME
读取照片
using IronOcr;
using IronSoftware.Drawing;
using System;

// Instantiate OCR engine
var ocr = new IronTesseract();

using var inputPhoto = new OcrInput();
inputPhoto.LoadImageFrame("ocr.tiff", 0);

// Read photo
OcrPhotoResult result = ocr.ReadPhoto(inputPhoto);

// Index number refer to region order in the page
int number = result.TextRegions[0].PageNumber;

// Extract the text in the first region
string textinregion = result.TextRegions[0].TextInRegion;

//Extract the co-ordinates of the first text region
Rectangle region = result.TextRegions[0].Region;

var output = $"Text in First Region: {textinregion}\n"
             + $"Text Region:\n"
             + $"Starting X: {region.X}\n"
             + $"Starting Y: {region.Y}\n"
             + $"Region Width: {region.Width}\n"
             + $"Region Height: {region.Height}\n"
             + $"Result Confidence: {result.Confidence}\n\n"
             + $"Full Scnned Photo Text: {result.Text}";

Console.WriteLine(output);
Imports IronOcr
Imports IronSoftware.Drawing
Imports System

' Instantiate OCR engine
Dim ocr As New IronTesseract()

Using inputPhoto As New OcrInput()
    inputPhoto.LoadImageFrame("ocr.tiff", 0)

    ' Read photo
    Dim result As OcrPhotoResult = ocr.ReadPhoto(inputPhoto)

    ' Index number refer to region order in the page
    Dim number As Integer = result.TextRegions(0).PageNumber

    ' Extract the text in the first region
    Dim textinregion As String = result.TextRegions(0).TextInRegion

    'Extract the co-ordinates of the first text region
    Dim region As Rectangle = result.TextRegions(0).Region

    Dim output As String = $"Text in First Region: {textinregion}" & vbCrLf &
                           $"Text Region:" & vbCrLf &
                           $"Starting X: {region.X}" & vbCrLf &
                           $"Starting Y: {region.Y}" & vbCrLf &
                           $"Region Width: {region.Width}" & vbCrLf &
                           $"Region Height: {region.Height}" & vbCrLf &
                           $"Result Confidence: {result.Confidence}" & vbCrLf & vbCrLf &
                           $"Full Scnned Photo Text: {result.Text}"

    Console.WriteLine(output)
End Using
NuGet Download
PM > Install-Package IronOcr
读取照片

读取照片

在 GitHub 上查看

准备开始了吗?

Nuget Downloads 6,279,416版本:2026.10刚刚发布

Key in blue circle

立即获取免费的 30 天试用版密钥。

Your trial license will be sent to your email address

无任何限制。100% 解锁。无需信用卡。

bullet_checked无需信用卡或创建账户无任何限制。100% 解锁。无需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronOCR
预约您的免费现场演示
Booking Badge

深受全球数百万工程师信赖

Iron Software 的客户徽标
获取您的无义务咨询
您的资料将始终保密。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
深受全球数百万工程师信赖
立即获取您的免费30 天试用密钥。
无需信用卡或创建账户
C# 用于 PDF 的 NuGet 库
通过 NuGet 安装

版本: 2026.10

PM > Install-Package IronOcr
nuget.org/packages/IronOcr/
  1. 在解决方案资源管理器中,右键点击引用,管理 NuGet 包
  2. 选择浏览并搜索"IronOCR"
  3. 选择包并安装
C# PDF DLL
下载 DLL

版本: 2026.10

或在这里下载Windows安装程序。

  1. 下载并解压IronOCR到你的解决方案目录中的~/Libs位置
  2. 在Visual Studio解决方案资源管理器中,右键点击引用。选择浏览,“IronOCR.dll”

许可证售价$999起