X39.Solutions.Papercraft 8.1.1

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

X39.Solutions.Papercraft

X39.Solutions.Papercraft is the default application-facing package for Papercraft. It combines the renderer-neutral core runtime with the SkiaSharp renderer so normal consumers can register one package and render XML templates to PDF, raster output or backend-free lowered XML diagnostics.

Use this package when you are writing an application and want the current default Papercraft stack. Use X39.Solutions.Papercraft.Core instead when you are implementing a custom renderer or building a package that must not depend on SkiaSharp.

Package Role

Area Provided by this package
Dependency injection entry point services.AddPapercraft()
Main application service Papercraft
Per-render workflow state PapercraftSession
Default backend X39.Solutions.Papercraft.Rendering.SkiaSharp
Core contracts Type-forwarded from X39.Solutions.Papercraft.Core

The package references:

  • X39.Solutions.Papercraft.Core
  • X39.Solutions.Papercraft.Rendering.SkiaSharp
  • Microsoft.Extensions.DependencyInjection.Abstractions

Register Services

using Microsoft.Extensions.DependencyInjection;
using X39.Solutions.Papercraft;

var services = new ServiceCollection();
services.AddPapercraft();

AddPapercraft() registers the core parser, default controls, default transformers, Papercraft, the compatibility PapercraftRenderer, and the SkiaSharp render backend.

Use the overload when adding custom template behavior:

services.AddPapercraft((builder) =>
{
    builder.AddFunction<MyFunction>();
    builder.ReplaceControl<MyTextControl>();
});

Render A PDF

using System.Globalization;
using System.Xml;
using Microsoft.Extensions.DependencyInjection;
using X39.Solutions.Papercraft;

await using var provider = services.BuildServiceProvider();
var papercraft = provider.GetRequiredService<Papercraft>();
await using var session = papercraft.CreateSession();

using var reader = XmlReader.Create(templateStream);
await using var output = File.Create("document.pdf");

await session.GeneratePdfAsync(output, reader, CultureInfo.InvariantCulture);

The same session can validate templates before rendering, write page-by-page PNG raster output through RenderRasterPagesAsync, and inspect lowered XML diagnostics through ReadLoweredXmlAsync(...) or RenderAsync(..., RenderTarget.LoweredXml, ...).

Template Data

Template data belongs to the session:

session.TemplateData.SetVariable("CustomerName", "Ada Lovelace");

The template can then read @CustomerName through the template language.

Lowered XML Diagnostics

using var reader = XmlReader.Create(templateStream);

var loweredXml = await session.ReadLoweredXmlAsync(reader, CultureInfo.InvariantCulture);

PapercraftRenderer remains available as an obsolete compatibility adapter for existing code.

The template-author manual lives in ../../docs/manual.

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 X39.Solutions.Papercraft:

Package Downloads
X39.Solutions.PdfTemplate

Papercraft is a template-driven document rendering engine for XML templates. This package is the X39.Solutions.PdfTemplate compatibility bridge and keeps the existing PDF generation UX available. The current default backend uses SkiaSharp for PDF and raster rendering and supports a variety of controls for creating complex layouts. You can easily integrate .NET objects into your templates by using so-called "variables" (`@myVariable`) or pull data from a database as needed, by providing a custom function (`@myFunction()`). You may even create your own controls by deriving from the `Control` base class!

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.1.1 65 6/21/2026
8.1.0 102 6/17/2026
8.0.1 108 6/13/2026
8.0.0 116 6/11/2026
7.1.0 105 6/9/2026
7.0.0 114 6/9/2026