OxidizePdf.NET
0.20.2
See the version list below for details.
dotnet add package OxidizePdf.NET --version 0.20.2
NuGet\Install-Package OxidizePdf.NET -Version 0.20.2
<PackageReference Include="OxidizePdf.NET" Version="0.20.2" />
<PackageVersion Include="OxidizePdf.NET" Version="0.20.2" />
<PackageReference Include="OxidizePdf.NET" />
paket add OxidizePdf.NET --version 0.20.2
#r "nuget: OxidizePdf.NET, 0.20.2"
#:package OxidizePdf.NET@0.20.2
#addin nuget:?package=OxidizePdf.NET&version=0.20.2
#tool nuget:?package=OxidizePdf.NET&version=0.20.2
OxidizePdf.NET
Version 0.20.2 pins Rust core 5.5.5. Current validation and remaining capabilities: feature parity.
The PDF ingestion layer for .NET RAG/LLM pipelines. Turn PDFs into token-aware, structure-aware, citation-ready chunks in one call β built on the native oxidize-pdf Rust engine. MIT-licensed, so it drops into commercial and closed-source products.
Features
- π§ RAG-first - Token-aware, structure-aware chunking (7 profiles) + element-aware semantic splitting, ready for vector-store ingestion
- π Ecosystem-ready - Drops into Semantic Kernel / Kernel Memory and Microsoft.Extensions.AI pipelines
- π Citation-grade - Every chunk carries 1-based page numbers, heading context, token estimates, and bounding boxes
- π Native speed - Rust engine, 3,000-4,000 pages/second
- βοΈ MIT-licensed - No AGPL/commercial-license friction
- π‘οΈ Memory Safe - Zero-copy FFI with automatic resource management
- π¦ Zero Dependencies - Self-contained native binaries in NuGet package
- π Cross-Platform - Linux, Windows, macOS β x64 & ARM64, including musl/Alpine
- π οΈ Full PDF toolkit - Also creates and manipulates PDFs (text, graphics, merge, split, rotate, page extraction)
New in 0.20.2 β core 5.5.5
This patch updates the core dependency with text extraction, encrypted object stream and signature verification fixes while preserving the managed API. See the release notes for validation and remaining limits.
The APIs introduced in 0.20.0 include typed XMP metadata, form calculations, lazy/streaming readers and batch jobs. Batch timeouts do not interrupt work or roll back files; Rotate/Compress and nonzero worker memory caps remain explicitly unsupported by this binding. Stream readers are disposable and leave inputs open by default. The complete NuGet package is validated in CI on .NET 8/9/10. See the acceptance ledger and changelog.
Feature guides
- Existing-document operations
- Incremental signing
- Semantic comparison
- Tagged-PDF editing
- Incremental OCR
- Redaction
- Rust parity audit and tracked gaps
Installation
dotnet add package OxidizePdf.NET
Quick Start
RAG Chunking (start here)
OxidizePdf.NET turns a PDF into token-aware, structure-aware chunks ready
for vector-store ingestion in one call:
using OxidizePdf.NET;
using OxidizePdf.NET.Pipeline;
var extractor = new PdfExtractor();
byte[] pdfBytes = File.ReadAllBytes("document.pdf");
var chunks = await extractor.RagChunksAsync(pdfBytes, ExtractionProfile.Rag);
foreach (var c in chunks)
{
// c.FullText β text + heading context (use this for embeddings)
// c.Text β the chunk's own text
// c.PageNumbers β 1-based source pages (cite results)
// c.TokenEstimate β plan batch sizes / model windows
// c.HeadingContext β section heading the chunk belongs to (or null)
}
Seven profiles: Standard, Academic, Form, Government, Dense,
Presentation, Rag. For fine-grained control pass an explicit
PartitionConfig (reading order, header/footer zones, table confidence)
and/or HybridChunkConfig (max tokens, overlap, merge policy):
var partition = new PartitionConfig()
.WithReadingOrder(ReadingOrderStrategy.XyCut(20.0)) // multi-column
.WithMinTableConfidence(0.7);
var hybrid = new HybridChunkConfig().WithMaxTokens(256).WithOverlap(32);
var chunks = await extractor.RagChunksAsync(pdfBytes, partition, hybrid);
Element-aware semantic chunks (titles/tables kept whole):
var semantic = await extractor.SemanticChunksAsync(
pdfBytes,
new SemanticChunkConfig(maxTokens: 512));
Markdown export with explicit options (RAG-012):
using OxidizePdf.NET.Ai;
var md = await extractor.ToMarkdownAsync(
pdfBytes,
new MarkdownOptions { IncludeMetadata = true, IncludePageNumbers = true });
Plain Text Extraction
When you just need the raw text (no chunking):
using OxidizePdf.NET;
using var extractor = new PdfExtractor();
byte[] pdfBytes = File.ReadAllBytes("document.pdf");
string text = await extractor.ExtractTextAsync(pdfBytes);
Console.WriteLine(text);
Standalone text chunker (no PDF β for non-PDF sources):
using OxidizePdf.NET.Ai;
var chunker = new DocumentChunker(chunkSize: 512, overlap: 50);
var pieces = chunker.ChunkText(rawText);
var tokens = DocumentChunker.EstimateTokens(rawText);
End-to-end vector-store ingestion with KernelMemory:
using OxidizePdf.NET;
using OxidizePdf.NET.Pipeline;
using Microsoft.KernelMemory;
var extractor = new PdfExtractor();
var memory = new KernelMemoryBuilder().Build();
var chunks = await extractor.RagChunksAsync(pdfBytes, ExtractionProfile.Rag);
foreach (var c in chunks)
{
await memory.ImportTextAsync(
text: c.FullText,
documentId: $"doc_p{c.PageNumbers[0]}_c{c.ChunkIndex}",
tags: new Dictionary<string, object>
{
["source"] = "SharePoint/Documents/report.pdf",
["pages"] = string.Join(",", c.PageNumbers),
["heading"] = c.HeadingContext ?? string.Empty,
["tokens"] = c.TokenEstimate,
});
}
Legacy character-based chunking (
ChunkOptions+ExtractChunksAsync) is marked[Obsolete]since 0.9.0-rag.1 and will be removed one minor release later. Prefer the token-aware overloads above.
SharePoint Crawler Example
using OxidizePdf.NET;
using Microsoft.Graph;
var extractor = new PdfExtractor();
var graphClient = new GraphServiceClient(...);
// Crawl SharePoint document library
var driveItems = await graphClient.Sites["root"]
.Drives["Documents"]
.Root
.Children
.Request()
.Filter("endsWith(name,'.pdf')")
.GetAsync();
foreach (var item in driveItems)
{
var stream = await graphClient.Sites["root"]
.Drives["Documents"]
.Items[item.Id]
.Content
.Request()
.GetAsync();
using var ms = new MemoryStream();
await stream.CopyToAsync(ms);
var chunks = await extractor.ExtractChunksAsync(ms.ToArray());
// Process chunks for embeddings...
}
Performance
Based on oxidize-pdf v1.6.4 benchmarks:
- Text Extraction: 3,000-4,000 pages/second
- Chunking: 0.62ms for 100 pages
- Memory Overhead: <1MB per document
- PDF Parsing: 98.8% success rate on 759 real-world PDFs
Supported Platforms
| Platform | Runtime Identifier | Status |
|---|---|---|
| Linux x64 (glibc) | linux-x64 |
β Supported |
| Linux x64 (musl / Alpine) | linux-musl-x64 |
β Supported |
| Linux ARM64 (glibc) | linux-arm64 |
β Supported |
| Linux ARM64 (musl / Alpine) | linux-musl-arm64 |
β Supported |
| Windows x64 | win-x64 |
β Supported |
| Windows ARM64 | win-arm64 |
β Supported |
| macOS x64 | osx-x64 |
β Supported |
| macOS ARM64 (Apple Silicon) | osx-arm64 |
β Supported |
Native binaries are automatically included in the NuGet package.
Architecture
- native/ - Rust FFI layer (cdylib)
- dotnet/ - C# wrapper with P/Invoke
- examples/ - Integration examples (KernelMemory, BasicUsage)
See ARCHITECTURE.md for detailed design decisions.
API Reference
PdfExtractor
public class PdfExtractor : IDisposable
{
// Extract plain text from PDF
public Task<string> ExtractTextAsync(byte[] pdfBytes);
// Extract text chunks optimized for RAG/LLM
public Task<DocumentChunks> ExtractChunksAsync(
byte[] pdfBytes,
ChunkOptions options = null
);
// Extract metadata (page count, title, author)
public Task<PdfMetadata> ExtractMetadataAsync(byte[] pdfBytes);
}
ChunkOptions
public class ChunkOptions
{
public int MaxChunkSize { get; set; } = 512; // Max tokens per chunk
public int Overlap { get; set; } = 50; // Overlap between chunks
public bool PreserveSentenceBoundaries { get; set; } = true;
public bool IncludeMetadata { get; set; } = true;
}
DocumentChunk
public class DocumentChunk
{
public int Index { get; set; } // Chunk index in document
public int PageNumber { get; set; } // Source page number
public string Text { get; set; } // Chunk text content
public double Confidence { get; set; } // Extraction confidence (0.0-1.0)
public BoundingBox BoundingBox { get; set; } // Optional spatial info
}
Requirements
- .NET 8.0+ (tested on .NET 8, 9)
- Native Runtime: Automatically included in NuGet package
Note: .NET 6 support was dropped in v0.2.0 as it reached end-of-support in November 2024. Use v0.1.0 if you still require .NET 6 compatibility.
Building from Source
# Clone repository
git clone https://github.com/bzsanti/oxidize-pdf-dotnet.git
cd oxidize-pdf-dotnet
# Build native library
cd native
cargo build --release
# Build .NET wrapper
cd ../dotnet
dotnet build
# Run tests
dotnet test
Examples
See examples/ directory:
- BasicUsage/ - Simple text extraction
- KernelMemory/ - Full SharePoint crawler with RAG pipeline
License
This project is licensed under the MIT License - see LICENSE file.
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.
Acknowledgments
Built on top of oxidize-pdf by Santiago FernΓ‘ndez MuΓ±oz.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 is compatible. 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 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on OxidizePdf.NET:
| Package | Downloads |
|---|---|
|
OxidizePdf.NET.KernelMemory
Kernel Memory content decoder backed by oxidize-pdf: structure-aware, page-cited PDF chunks dropped into your KM RAG pipeline in one call. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 0.23.0 | 152 | 11/17/2026 | |
| 0.22.0 | 133 | 11/14/2026 | |
| 0.21.0 | 152 | 11/2/2026 | |
| 0.20.2 | 161 | 10/30/2026 | |
| 0.20.1 | 172 | 10/29/2026 | |
| 0.20.0 | 220 | 10/19/2026 | |
| 0.19.0 | 183 | 10/11/2026 | |
| 0.18.0 | 678 | 9/27/2026 | |
| 0.17.0 | 195 | 8/22/2026 | |
| 0.16.1 | 226 | 6/29/2026 | |
| 0.16.0 | 200 | 6/27/2026 | |
| 0.15.0 | 190 | 6/26/2026 | |
| 0.14.0 | 176 | 6/12/2026 | |
| 0.13.0 | 173 | 6/12/2026 | |
| 0.12.0 | 185 | 6/6/2026 | |
| 0.11.0 | 190 | 6/5/2026 | |
| 0.10.0 | 206 | 5/28/2026 | |
| 0.9.0 | 277 | 5/10/2026 | |
| 0.8.0 | 289 | 5/6/2026 | |
| 0.7.1 | 290 | 4/20/2026 |