Papyra 1.0.0-beta.146

This is a prerelease version of Papyra.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Papyra --version 1.0.0-beta.146
                    
NuGet\Install-Package Papyra -Version 1.0.0-beta.146
                    
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="Papyra" Version="1.0.0-beta.146" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Papyra" Version="1.0.0-beta.146" />
                    
Directory.Packages.props
<PackageReference Include="Papyra" />
                    
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 Papyra --version 1.0.0-beta.146
                    
#r "nuget: Papyra, 1.0.0-beta.146"
                    
#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 Papyra@1.0.0-beta.146
                    
#: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=Papyra&version=1.0.0-beta.146&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Papyra&version=1.0.0-beta.146&prerelease
                    
Install as a Cake Tool

Papyra

Compose a document once with a fluent builder API and render it to PDF, DOCX, XLSX, and HTML — the same document model, four output formats.

  • PDF: PDF/A-2b by default (PDF/A-3 and PDF/A-4 selectable), full Unicode, any font via RegisterFont (embedded and subsetted automatically)
  • DOCX / XLSX: native OpenXML output, editable in Word and Excel
  • HTML: one self-contained, reflowable file — semantic markup, deduplicated CSS, images embedded as data: URIs
  • Format-independent: build the document once, pick the output format at render time

Install

dotnet add package Papyra

Requires .NET 10.

Quick start

using Papyra.Core;

var document = Document.Create(doc => doc
    .PageSize(PageSize.A4)
    .Margin(48f)
    .Paragraph(p => p.Text("Quarterly report",
        new TextStyle(FontSize: 24f, FontWeight: FontWeight.BOLD)))
    .Table(table => table
        .Columns(3)
        .Row(row => row.Cell("Name").Cell("Age").Cell("City"))
        .Row(row => row.Cell("Alice").Cell("30").Cell("Vienna"))
        .Row(row => row.Cell("Bob").Cell("25").Cell("Berlin"))
    )
);

byte[] pdf  = document.Render(OutputFormat.PDF);
byte[] docx = document.Render(OutputFormat.DOCX);
byte[] xlsx = document.Render(OutputFormat.XLSX);

File.WriteAllBytes("report.pdf", pdf);

PDF output is PDF/A-2b by default; pass PdfRenderOptions to select PDF/A-3 or PDF/A-4:

byte[] pdfA3 = document.Render(OutputFormat.PDF,
    new PdfRenderOptions { Standard = PdfStandard.PdfA3 });

PDF/A-3 output supports file attachments and ZUGFeRD/Factur-X e-invoicing — embed your invoice XML and Papyra writes the complete Factur-X container (embedded factur-x.xml plus the XMP extension schema, veraPDF-verified):

byte[] invoice = document.Render(OutputFormat.PDF, new PdfRenderOptions
{
    Standard = PdfStandard.PdfA3,
    FacturX = new FacturXOptions(invoiceXml, FacturXProfile.EN16931),
});

Styling

var document = Document.Create(doc => doc
    .DefaultTextStyle(new TextStyle(FontSize: 10f, FontFamily: "Liberation Sans"))
    .Paragraph(p => p.Text("Highlighted",
        new TextStyle(Color: Colors.Red.Darken2, FontWeight: FontWeight.BOLD)))
);

Styles set closer to the content win; anything unset falls back to DefaultTextStyle. Set an explicit FontFamily to keep PDF, DOCX, and XLSX visually aligned (their built-in default fonts differ).

Custom fonts (PDF)

var document = Document.Create(doc => doc
    .RegisterFont("Brand Sans",
        regular: File.ReadAllBytes("BrandSans-Regular.ttf"),
        bold:    File.ReadAllBytes("BrandSans-Bold.ttf"))
    .Paragraph(p => p.Text("Styled with a custom font",
        new TextStyle(FontFamily: "Brand Sans")))
);

Only the variants a document actually uses are embedded, subsetted to the glyphs it needs. Any script the font covers is supported.

License key

Papyra is commercial software with a free Community tier for individuals and small companies. Documents rendered without a valid license key carry a red "unlicensed" notice — there is no other functional difference, no feature gates. Get a free Community key or see the tiers at papyra.rocks.

using Papyra.Licensing;

PapyraSettings.LicenseKey = "<your license key>";

Alternatively, set the PapyraLicense MSBuild property in your project file (or point it at a file kept out of source control):

<PropertyGroup>
  <PapyraLicense Condition="Exists('papyra.license')">$([System.IO.File]::ReadAllText('papyra.license').Trim())</PapyraLicense>
</PropertyGroup>

Live preview

The Papyra Companion app previews documents while you develop: rendered pages, the document's structure tree, click-through navigation to the builder call that created an element, and automatic detection of layout issues. document.ShowInCompanion() pushes the current document to the app. See the companion app guide.

Known limitations

Papyra is honest about its gaps — the most important ones today:

  • Automatic hyphenation is opt-in (doc.Hyphenation("de"), patterns embedded for de/en/es/fr/it/nl/pt); words assembled across styled spans are never pattern-hyphenated
  • Page fields degrade outside PDF/DOCX body textPageNumber()/TotalPages() resolve exactly in PDF (headers, footers, and body via a bounded two-pass layout) and map to native Word fields in DOCX; HTML and XLSX body content drops them (no page concept there) and prints only RenderDate() as literal text
  • XLSX flattens rich cells — run styling collapses to one style per worksheet cell, in-flow images float as anchored drawings, nested tables flatten into the worksheet grid
  • XLSX field-bearing headers/footers can only carry text

The complete per-format picture is in the feature support matrix and known limitations; planned work is on the roadmap.

Documentation

Dependencies

DOCX/XLSX rendering uses DocumentFormat.OpenXml. The PDF renderer uses SixLabors.Fonts for font metrics (Six Labors Split License — free for open-source and small-revenue use; a commercial license is required above $1M annual revenue).

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 (1)

Showing the top 1 NuGet packages that depend on Papyra:

Package Downloads
Papyra.Svg

SVG support for Papyra: adds Svg() to the fluent builders, rendering SVG as true vector graphics in PDF, as native SVG with a PNG fallback in DOCX and XLSX, and as inline SVG in HTML.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-beta.165 0 9/3/2026
1.0.0-beta.164 0 9/3/2026
1.0.0-beta.162 0 9/3/2026
1.0.0-beta.161 0 9/3/2026
1.0.0-beta.160 0 9/3/2026
1.0.0-beta.159 0 9/3/2026
1.0.0-beta.157 0 9/3/2026
1.0.0-beta.156 27 9/3/2026
1.0.0-beta.155 25 9/3/2026
1.0.0-beta.153 33 9/2/2026
1.0.0-beta.146 59 8/28/2026
1.0.0-beta.145 53 8/28/2026
1.0.0-beta.144 56 8/28/2026
1.0.0-beta.143 46 8/28/2026
1.0.0-beta.142 46 8/28/2026
1.0.0-beta.141 45 8/28/2026
1.0.0-beta.140 52 8/28/2026
1.0.0-beta.139 47 8/28/2026
1.0.0-beta.137 53 8/28/2026
1.0.0-beta.136 50 8/28/2026
Loading failed