Skip to content

Introduction

Papyra is a .NET 10 library for composing and rendering documents. You describe a document once with a fluent builder API, and render the same model to PDF, DOCX, and XLSX.

var document = Document.Create(doc => doc
.Paragraph(p => p.Text("Hello, Papyra")));
byte[] pdf = document.RenderAsPdf();

Papyra processes documents through three independent stages:

Document (fluent API) → LayoutBox tree → byte[] output
Core Layout Renderers
  1. Core - an immutable document model built via the fluent API (Document, DocumentBuilder, TableBuilder, …). The model knows nothing about output formats.
  2. Layout - an internal layout engine computes the position and dimensions of every element and produces a layout tree.
  3. Renderers - each renderer consumes the layout tree and produces format-specific bytes. Layout and the built-in renderers run behind the Render call; only the document model and Render are public API.

Because rendering is separated from the model, a document is composed exactly once - there are no format-specific branches in your composition code.

The PDF renderer is written from scratch; it does not wrap iText, PDFsharp, or a browser engine:

  • PDF/A output - PDF/A-2b (default), PDF/A-3b, and PDF/A-4, with XMP metadata and an embedded sRGB ICC profile. Conformance is verified against veraPDF in the test suite.
  • Full Unicode text - any TrueType font, embedded as Type0/CIDFontType2 and subsetted to the glyphs your document uses.
  • Table pagination - tables split across pages with repeating header and footer rows.
  • Only three dependencies for the whole library: DocumentFormat.OpenXml, SixLabors.Fonts, and SixLabors.ImageSharp. No native code.

Papyra is built for business documents: invoices, order confirmations, reports, certificates - documents that must be correct, archivable, and reproducible. It is not a general-purpose graphics canvas: there is no free-form drawing API.

Papyra is honest about its current gaps - check Known limitations and the roadmap before committing to a use case.