Recursive AI
LibraryC#Available

onepdf

A PDF library for .NET, written in C# with no dependency beyond .NET itself. It opens the files that are actually out there, reads their text in order, edits and signs them, and lays out new ones.

dotnet add package RecursiveAI.OnePdf

A quick look

Text comes out as glyphs, words, lines and blocks with positions, in reading order: the structure tree for tagged files, geometry otherwise, right-to-left text included.

How reading order works
Program.csC#
using OnePdf;
using OnePdf.Text;
 
using PdfDocument doc = PdfDocument.Open("in.pdf");
 
// Every page, in reading order, in parallel.
var pages = doc.ExtractText();
Console.WriteLine(pages[0].Text);
 
// Words with positions, on one page.
foreach (PdfTextWord w in doc.Pages[0].ExtractText().Words)
    Console.WriteLine($"{w.Text} {w.Bounds}");
What it does

What it does

Opens real-world files

Cross-reference streams, object streams, incremental files and a documented repair chain for damaged ones, with every repair recorded. Encrypted files from RC4 to AES‑256.

Edits and saves

Delete, reorder, rotate, merge and split pages. Fill and flatten forms, redact areas, draw text and images, and save a clean file or an incremental update.

Signs and verifies

Checks signatures, time-stamps and certificate chains, and shows what changed after each signature. Signs as PAdES B-B or B-T, visible or invisible.

PDF/A and PDF/UA

Writes PDF/A-2 and PDF/A-3, and PDF/UA-1 and PDF/UA-2 from documents it laid out or tagged. A save that can’t conform is refused, with every violation listed.

Lays out new documents

RecursiveAI.OnePdf.Layout builds documents from code: shaped text, tables, lists, images, SVG and page X of Y, streamed as a tagged PDF.

Safe on files you didn’t write

No unsafe code. Limits are checked before the work they guard, and the parsers, filters and font readers are fuzzed. It never runs a document’s scripts or touches the network.

Performance and quality

Faster than PdfPig on every task we measured

Against PdfPig 0.1.16 on the same files, with BenchmarkDotNet. Speedups range from 1.10× to 8.50×.

Every result and the method

The packages

Go further