X39.Solutions.Papercraft.Core 8.1.1

dotnet add package X39.Solutions.Papercraft.Core --version 8.1.1
                    
NuGet\Install-Package X39.Solutions.Papercraft.Core -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.Core" 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.Core" Version="8.1.1" />
                    
Directory.Packages.props
<PackageReference Include="X39.Solutions.Papercraft.Core" />
                    
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.Core --version 8.1.1
                    
#r "nuget: X39.Solutions.Papercraft.Core, 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.Core@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.Core&version=8.1.1
                    
Install as a Cake Addin
#tool nuget:?package=X39.Solutions.Papercraft.Core&version=8.1.1
                    
Install as a Cake Tool

X39.Solutions.Papercraft.Core

X39.Solutions.Papercraft.Core contains the renderer-neutral Papercraft runtime. It defines the public contracts for templates, controls, data conversion, display lists, render targets, renderer capabilities and validation. It also contains the current XML parser, layout/runtime implementation, built-in controls and built-in template transformers during the Papercraft package split.

Use this package when you need Papercraft contracts without taking a dependency on SkiaSharp or the legacy compatibility package.

Package Role

Area Provided by this package
Core DI entry point services.AddPapercraftCore()
Backend-neutral generation PapercraftGenerator
Application service and contracts Papercraft, PapercraftSession, PapercraftRenderResult, IPapercraftRenderBackend, RenderTarget, RenderOutput
Lowered XML diagnostics RenderTarget.LoweredXml, PapercraftMediaTypes.ApplicationPapercraftLoweredXml
Capability validation RendererCapabilities, RenderValidationResult, RenderDiagnostic
Activity tracing PapercraftInstrumentation.ActivitySource
Built-in controls Text, paragraph, border, image, line, table, lists, charts, page numbers, columns, blocks and related layout controls
Template language for, forEach, if, switch, alternate, var and variable expansion transformers

This package references Microsoft.Extensions.DependencyInjection.Abstractions and intentionally does not reference SkiaSharp, hosting, OpenTelemetry or X39.Solutions.PdfTemplate.

Register Core Services

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

var services = new ServiceCollection();
var builder = services.AddPapercraftCore();

AddPapercraftCore() registers parser/runtime services, default controls, default transformers, Papercraft, PapercraftGenerator, and the compatibility PapercraftRenderer. It does not register a render backend. Normal PDF, raster, SVG or printer-command rendering through a PapercraftSession requires an IPapercraftRenderBackend registration. Lowered XML output is the exception because it stops before backend rendering:

var papercraft = serviceProvider.GetRequiredService<Papercraft>();
await using var session = papercraft.CreateSession();

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

PapercraftSessionExtensions also provides helpers such as RenderPdfAsync, GeneratePdfAsync and GenerateLoweredXmlAsync. These helpers are thin wrappers over the renderer-neutral RenderAsync target model.

Implement A Renderer

Custom renderers implement IPapercraftRenderBackend:

public sealed class MyRenderer : IPapercraftRenderBackend
{
    public RendererCapabilities Capabilities { get; } = new(
        "my-renderer",
        "My Renderer",
        RendererOutputKind.Pdf,
        new[] { PapercraftMediaTypes.ApplicationPdf });

    public ITextService TextService { get; } = new MyTextService();

    public ValueTask<RenderValidationResult> ValidateAsync(
        PapercraftDocument document,
        RenderTarget target,
        CancellationToken cancellationToken = default)
        => ValueTask.FromResult(Capabilities.ValidateTarget(target));

    public ValueTask RenderAsync(
        PapercraftDocument document,
        RenderOutput output,
        CancellationToken cancellationToken = default)
        => ValueTask.CompletedTask;

    public ValueTask RenderRasterPagesAsync(
        PapercraftDocument document,
        RasterPageRenderOutput output,
        CancellationToken cancellationToken = default)
        => ValueTask.CompletedTask;
}

TextService is the backend-specific text measurement and text display-list service used while generating documents for this renderer.

Register the backend in the application service collection:

services.AddPapercraftCore();
services.AddTransient<IPapercraftRenderBackend, MyRenderer>();

Extend Template Behavior

PapercraftServiceBuilder can add, remove or replace controls and transformers:

services.AddPapercraftCore()
        .AddFunction<MyFunction>()
        .AddControl<MyControl>()
        .ReplaceTransformer<MyOldTransformer, MyNewTransformer>();

The source currently exposes the builder through AddPapercraftCore() and through facade packages such as X39.Solutions.Papercraft.

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

Showing the top 5 NuGet packages that depend on X39.Solutions.Papercraft.Core:

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!

X39.Solutions.Papercraft.Rendering.SkiaSharp

Papercraft SkiaSharp renderer package for PDF and raster output. The renderer contains the SkiaSharp-backed legacy PDF and raster implementation.

X39.Solutions.Papercraft

Papercraft facade package for the default application developer path. Default rendering is backed by the SkiaSharp renderer while renderer-neutral contracts are forwarded to Papercraft Core.

X39.Solutions.Papercraft.Controls.ZXing

Optional Papercraft barcode controls backed by ZXing.Net. The package registers renderer-neutral 1D and 2D barcode controls that draw BitMatrix output as vector rectangles.

X39.Solutions.Papercraft.Controls.QrCode

Optional Papercraft QR code controls backed by Net.Codecrete.QrCodeGenerator. The package registers renderer-neutral controls that draw QR modules as vector rectangles.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.1.1 91 6/21/2026
8.1.0 169 6/17/2026
8.0.1 196 6/13/2026
8.0.0 204 6/11/2026
7.1.0 147 6/9/2026
7.0.0 150 6/9/2026