RailReader.Core 0.16.0

dotnet add package RailReader.Core --version 0.16.0
                    
NuGet\Install-Package RailReader.Core -Version 0.16.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="RailReader.Core" Version="0.16.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RailReader.Core" Version="0.16.0" />
                    
Directory.Packages.props
<PackageReference Include="RailReader.Core" />
                    
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 RailReader.Core --version 0.16.0
                    
#r "nuget: RailReader.Core, 0.16.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 RailReader.Core@0.16.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=RailReader.Core&version=0.16.0
                    
Install as a Cake Addin
#tool nuget:?package=RailReader.Core&version=0.16.0
                    
Install as a Cake Tool

RailReaderCore

Portable libraries powering RailReader2 and intended for reuse by future companion apps (web, mobile). Distributed as a set of NuGet packages.

Packages

Project Purpose External deps
RailReader.Core Portable abstractions, models, controllers, rail-navigation, line detection, search, annotations, reading-order resolvers none (system only)
RailReader.Core.Pdfium Desktop PDFium implementations of the Core interfaces + filesystem-backed AppConfig / AnnotationService / ConsoleLogger / LayoutModelLocator PDFium native libraries
RailReader.Core.Analysis ONNX-backed ILayoutAnalyzer implementations (PP-DocLayoutV3, PP-DocLayout-S, Docling Heron) Microsoft.ML.OnnxRuntime
RailReader.Core.Vlm.OpenAI IVlmService for OpenAI-compatible chat-completions endpoints (OpenAI, Ollama, vLLM, LightOnOCR, …) OpenAI
RailReader.Renderer.Skia SkiaSharp rasterisation + IPdfServiceFactory that desktop consumers wire into Core SkiaSharp, PDFtoImage

Reference graph

RailReader.Core              ← no native deps, no IO
  ├─ Core.Pdfium             → Core
  ├─ Core.Analysis           → Core
  ├─ Core.Vlm.OpenAI         → Core
  └─ Renderer.Skia           → Core + Core.Pdfium

A future Lite (web/WASM) app would consume RailReader.Core only and substitute its own IPdfService / IPdfTextService / ILayoutAnalyzer / IVlmService implementations (e.g. PDF.js, ORT-Web, browser fetch).

Model-agnostic layout pipeline

Core defines two seams that let any layout-detection model drive RailReader:

  • ILayoutAnalyzer — wraps a specific ONNX model and declares its class table + input size + whether it provides reading order via LayoutModelCapabilities. Each detection is stamped with a portable BlockRole; Core never branches on the model-specific class id.
  • IReadingOrderResolver — assigns 0..N-1 reading order to detected blocks. Three built-ins ship:
    • ModelOrderResolver (trusts the analyzer's order hints — default pick for models with ProvidesReadingOrder=true)
    • XYCutPlusPlusResolver (column-aware recursive XY-cut, default for non-ordering models — handles two/three-column papers and full-width spanners correctly)
    • TopDownReadingOrderResolver (Y-then-X baseline, retained as a debug fallback)

Core.Analysis ships three analyzers today:

Analyzer Model Input Reading order Notes
LayoutAnalyzer PP-DocLayoutV3 (RT-DETR) 800×800 letterbox model-provided 25 classes; the existing default for the desktop app (~50 MB)
PPDocLayoutSLayoutAnalyzer PP-DocLayout-S (PicoDet/GFL) 1920 longest-edge raster → 480×480 internal XYCut++ 23 classes; lightweight (~4.7 MB) — intended detector for future web (WASM/ORT-Web) and mobile builds
HeronLayoutAnalyzer Docling Heron (RT-DETRv2) 640×640 resize XYCut++ 17 classes; broader category space (code, forms, key-value regions) (~164 MB)

Additional analyzers slot in as further Core.Analysis types or as separate sibling packages — the existing three are the template.

Build & test

dotnet build RailReaderCore.slnx -c Release
dotnet test tests/RailReader.Core.Tests -c Release

Always use -c Release — debug builds are significantly slower on the inference paths.

Models

Core.Analysis consumers need at least one ONNX layout-detection model on disk:

./scripts/download-model.sh           # default — PP-DocLayoutV3 (~50 MB, Apache-2.0)
./scripts/download-model.sh pps       # PP-DocLayout-S (~4.7 MB, Apache-2.0; lightweight)
./scripts/download-model.sh heron     # Docling Heron (~164 MB, Apache-2.0)
./scripts/download-model.sh all       # all three

PP-DocLayout-S is sourced from stefanj0/PP-DocLayout-S-ONNX — a paddle2onnx export of the upstream PaddlePaddle/PP-DocLayout-S checkpoint (no official ONNX exists upstream). Override the source by setting PP_S_ONNX_URL before running the script.

Files land in ./models/. The model search order on disk is defined by Core.Pdfium's LayoutModelLocator (it walks several well-known locations relative to AppContext.BaseDirectory and AppConfig.ConfigDir).

License

MIT — see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on RailReader.Core:

Package Downloads
RailReader.Renderer.Skia

SkiaSharp rasterisation and IPdfServiceFactory implementation for desktop PDF rendering via PDFium.

RailReader.Core.Pdfium

Desktop PDFium implementations of Core interfaces plus filesystem-backed AppConfig, AnnotationService, ConsoleLogger, and LayoutModelLocator.

RailReader.Core.Vlm.OpenAI

OpenAI-compatible IVlmService implementation for RailReader. Works against any endpoint that speaks the OpenAI chat-completions protocol (OpenAI, Ollama, vLLM, etc.).

RailReader.Core.Analysis

ONNX-backed ILayoutAnalyzer implementation using PP-DocLayoutV3 for document layout detection.

RailReader.Core.PdfPig

Pure-managed implementations of Core's PDF text/link/outline services using UglyToad.PdfPig. Targets web/mobile/Lite consumers that cannot ship PDFium. Parses only; rasterisation lives in a sibling renderer.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.16.0 10 6/3/2026
0.15.1 15 6/3/2026
0.15.0 20 6/3/2026
0.14.0 23 6/3/2026
0.13.2 135 6/1/2026
0.13.1 122 6/1/2026
0.13.0 127 6/1/2026
0.12.0 133 6/1/2026
0.11.0 132 6/1/2026
0.10.1 133 6/1/2026
0.10.0 136 5/31/2026
0.9.1 135 5/31/2026
0.9.0 156 5/29/2026
0.7.3 156 5/26/2026
0.7.2 151 5/26/2026
0.7.1 149 5/26/2026
0.7.0 146 5/26/2026
0.6.0 144 5/26/2026
0.5.1 141 5/26/2026
0.5.0 136 5/26/2026
Loading failed