PaddleOCRJson.NET 1.1.0

dotnet add package PaddleOCRJson.NET --version 1.1.0
                    
NuGet\Install-Package PaddleOCRJson.NET -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PaddleOCRJson.NET" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PaddleOCRJson.NET" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="PaddleOCRJson.NET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PaddleOCRJson.NET --version 1.1.0
                    
#r "nuget: PaddleOCRJson.NET, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PaddleOCRJson.NET@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PaddleOCRJson.NET&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=PaddleOCRJson.NET&version=1.1.0
                    
Install as a Cake Tool

PaddleOCRJson.NET

PaddleOCR-json v1.3.1 .net 的封装

Nuget方式

搜索安装: PaddleOCRJson.NET .

源码方式

克隆源码, 然后添加项目引用 PaddleOCRJson.csproj .

碎碎念

坏了!!! Nuget项目地址写错了, 还不让改.

代码没注释 真烂!

先这样吧 反正没啥很复杂的操作. 其他看看原作者的文档好啦

识别结果为json字符串, 需要用户自己解析(不想引入任何依赖).

.NET Standard version

2.0, 2.1.

依赖

使用方法

1. 设置引擎路径(远程部署忽略, 直接看2.3即可)

var enginePath = "PaddleOCR-json/PaddleOCR-json.exe";

2. 设置引擎模式和其他参数

2.1. 管道模式
var startupArgs = OcrEngineStartupArgs.WithPipeMode(enginePath);
using var engine = new OcrEngine(startupArgs);
using var cli = engine.CreateClient(); // 或者: using var cli = new OcrPipeClient(engine)
2.2. 自托管TCP模式
var startupArgs = OcrEngineStartupArgs.WithTcpMode(enginePath, IPAddress.Loopback, 0); // 设置监听地址和端口号
using var engine = new OcrEngine(startupArgs);
using var cli = engine.CreateClient(); // 或者: using var cli = new OcrTcpClient(new IPEndPoint(IPAddress.Loopback, engine.Port))
2.3. 远程TCP模式
using var cli = new OcrTcpClient(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 12345)); // IP和端口嘛
2.4. 更多参数(主要是自用, 随缘更新, 没更新的话下面的自定义参数就可以凑活凑活)
startupArgs
	.WithEnableMkldnn(true)             // 启用Mkldnn
	.WithCpuThreads(10)                 // 设置线程数
	.WithCustom("arg_int",1)            // 自定义int参数
	.WithCustom("arg_bool",true)        // 自定义bool参数
	.WithCustom("arg_str","xxxx");      // 自定义str参数

3. 执行操作

var ret = string.Empty;
ret = cli.FromImageBytes(new byte[]{...});  // byte[] 会转到 base64
ret = cli.FromBase64("...");                // base64
ret = cli.FromImageFile("test.png");        // 直接使用文件路径
ret = cli.FromClipboard();                  // 没啥好说的

4. 解析结果

4.1. 返回值参考 原作者的文档
4.2. 也可以参考 UnitTest1.cs

Q: 为什么不写解析?

A: 想要干干净净.

OcrResult.cs
using Newtonsoft.Json;

namespace PaddleOCRJson.Test
{
    public class OcrResult
    {
        public int Code { get; set; }
        public object Data { get; set; }

        [JsonIgnore] public bool Succeed => Code == 100;

        [JsonIgnore]
        public OcrData[] OcrData =>
            Succeed ? JsonConvert.DeserializeObject<OcrData[]>(Data.ToString()) : null;
    }
}
OcrData.cs
namespace PaddleOCRJson.Test
{
    public class OcrData
    {
        public int[][] Box { get; set; }
        public double Score { get; set; }
        public string Text { get; set; }
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 382 11/17/2025
1.0.0 479 10/12/2023