X-Ray.Content 26.9.4917

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

<img src="logo.png" alt="X-Ray" width="160" align="right" />

X-Ray.Content

NuGet Downloads License

Content extraction for .NET. Point it at a document — Office, PDF, HTML, email, an archive — and get back the text, metadata, tables, images and a structured element tree, in whichever output format you ask for.

X-Ray.Content is the content-extraction package of the X-Ray family of .NET libraries. The engine is a native C# port of the Rust xberg extraction engine: every extractor, type and renderer is reimplemented in managed C#, not wrapped over a native library.

Install

dotnet add package X-Ray.Content

The package id is hyphenated; the API lives under the XRay.Content namespace, since a hyphen is not valid in a C# identifier.

Targets net10.0.

Extract a document

using XRay.Content.Core;

var extractor = new Extractor();

var result = extractor.Extract(
    ExtractInput.FromUri("quarterly-report.pdf"),
    new ExtractionConfig { OutputFormat = OutputFormat.Markdown });

var doc = result.Results[0];

Console.WriteLine(doc.MimeType);              // application/pdf
Console.WriteLine(doc.Content);               // the rendered Markdown
Console.WriteLine(doc.Metadata.Title);
Console.WriteLine(doc.Tables.Count);

Bytes work the same way when you already hold the file:

var input = ExtractInput.FromBytes(bytes, "application/vnd.openxmlformats-officedocument.wordprocessingml.document");

Extract never throws for a bad document: a failure lands in result.Errors with a type and code, and an unsupported MIME type comes back as an empty document carrying a ProcessingWarning. ExtractAsync is available for the same call.

Output formats

OutputFormat selects how ExtractedDocument.Content is rendered — the extracted document model is the same either way:

Format Value
Plain text (default) OutputFormat.Plain
Markdown (GFM) OutputFormat.Markdown
HTML OutputFormat.Html
Djot OutputFormat.Djot
JSON section tree OutputFormat.Json
Structured element list OutputFormat.Structured
DocTags OutputFormat.DocTags

Set IncludeDocumentStructure = true to also get the Document heading tree, and ResultFormat.ElementBased to get the flat element stream instead of one rendered string.

Formats it reads

Word, Excel, PowerPoint (modern and legacy binary), OpenDocument, RTF, WordPerfect, PDF, HTML/XML, Markdown/Djot/AsciiDoc/reStructuredText/Org/Typst/LaTeX, EPUB and FictionBook, email (EML, MSG, PST), iWork, HWP/HWPX, images (metadata and EXIF), CSV/TSV/DBF, JSON/YAML/TOML, BibTeX and citation formats, Jupyter notebooks, source code, and ZIP/TAR/7z/GZip archives (extracted recursively as child documents).

Optional OCR

Extraction is pure managed and pulls no native dependencies. OCR is the one exception, and it is off by default:

var config = new ExtractionConfig
{
    Ocr = new OcrOptions { Mode = OcrMode.ScanOnly },   // or AllImages
};

ScanOnly recognises the PDF pages a scan detector flags; AllImages also reads every embedded image and inserts its text inline after the image it came from. OCR is additive — native text is never replaced — and never fatal: a missing checkpoint or an undecodable image becomes a ProcessingWarning, not an exception.

Turning it on loads PaddleOCR, which brings SkiaSharp and PDFium. A caller that never sets Ocr loads neither. Nothing is downloaded on your behalf: point OcrOptions.ModelDirectory at a checkpoint you already have.

License

MIT AND Apache-2.0. The package is MIT, except for a handful of files that are derivative works of Apache-2.0-only Rust crates and remain under that license — see THIRD_PARTY_NOTICES.md for exactly which files and which upstreams.

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.

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
26.9.4917 38 9/9/2026