Paperwork.Core 9.7.4.4

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

Paperwork.Core

Core PDF generation library for Paperwork. Provides a fluent builder API over the Scryber rendering engine, to generate PDFs from HTML templates, CSS, and JSON data. For documentation see Paperwork.help

Installation

dotnet add package Paperwork.Core

Quick Start

using Paperwork;

using var factory = PaperworkFactory.Create(httpClient).Build();
//using var factory = PaperworkFactory.Create(); - own internal httpClient

var bytes = await factory.NewDocument()
    .WithLayout("<html><body><p data-content='{{$fields[\"title\"]}}'></p></body></html>")
    .WithField("title", "Hello World")
    .BuildBytesAsync();

await File.WriteAllBytesAsync("output.pdf", bytes);

Usage

Setup

// Minimal — no auth
var factory = PaperworkFactory.Create(httpClient).Build();

// With custom auth
var factory = PaperworkFactory.Create(httpClient)
    .WithAuth(new MyAuthService())
    .Build();

// ASP.NET Core DI
services.AddPaperwork();

Layout

// Inline HTML string
builder.WithLayout("<html><body>...</body></html>");

// From a file
builder.WithLayoutFile("invoice.html");

// From a URL (fetched at render time)
builder.WithLayoutUrl("https://cdn.example.com/template.html");

// Pre-built Document
builder.WithLayout(document);

// Add custom partials that can be accessed via $layouts["name"]
builder.WithLayout("<p> Injected by {{model.name}}</p>", "innerPartial");

Styles

builder.WithStyle("body { font-family: sans-serif; }");
builder.WithStyleFile("styles.css");
builder.WithStyleUrl("https://cdn.example.com/styles.css");
builder.WithStyle(styleGroup);  // Custom StyleGroup

Data

// JSON string — bound as {{name.field}} in templates
builder.WithData("order", "{\"total\": 1200}");

// From a file
builder.WithDataFile("order", "order.json");

// Any object — set directly on doc.Params
builder.WithData("order", new { total = 1200 });

Fields

Values accessible in templates as $fields["key"]:

builder.WithField("date", "2026-03-25");
builder.WithField("title", "Invoice #1001");
<p data-content='{{$fields["title"]}}'></p>

WithField(id, value, type) only accepts a scalar string value. A field whose value is a nested object or array (e.g. a Designer-authored single/list-type field) can't be built up this way — load it via FromConfig/FromDefinition instead (below), which preserves nested values as JsonElement.

Loading a full template config

// From a stream/file — deserializes straight into TemplateDefinitionV1,
// preserving any nested field values as JsonElement rather than flattening them
using var stream = File.OpenRead("template-config.json");
var builder = factory.FromConfig(stream);

var bytes = await builder.BuildBytesAsync();

The JSON is the same {"schemaVers": "1.1", "template": {...}} shape a published Paperwork template is stored as — see Paperwork.CLI's config-format docs for the full schema, including nested field values.

Generate

// As bytes
byte[] pdf = await builder.BuildBytesAsync();

// Save to file
await builder.SaveAsync("output.pdf");

// Full result with metadata
PaperworkResult result = await builder.BuildAsync();

Template Binding

Inside HTML templates, use handlebars-style expressions:


<p data-content='{{$fields["date"]}}'></p>


<p data-content='{{order.customerName}}'></p>


{{#each items}}
<p data-content='{{.label}}'></p>
{{/each}}
  • Paperwork.Core.Extensions — shared portal config, $assets/$maps remote-file resolution, and cross-platform auth handlers (Atlassian, Firebase Asset) for consumers that need them. Not a dependency of this package — install it separately if you need that functionality.
  • Paperwork.CLI — command-line PDF generation built on this package.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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 Paperwork.Core:

Package Downloads
Paperwork.Core.Extensions

Shared portal config, asset/map file resolution, and auth handlers for Paperwork.Core consumers (Paperwork.Service, Paperwork.CLI).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.7.4.6 0 10/6/2026
9.7.4.5 0 10/6/2026
9.7.4.4 87 10/1/2026
9.7.4.3 66 10/1/2026
9.7.4.2 91 9/30/2026
9.7.1 112 8/27/2026
9.6.0.4 144 7/7/2026
9.6.0.1 120 5/18/2026
9.6.0 119 5/15/2026
1.2.0 138 3/27/2026
1.1.0 132 3/27/2026
1.0.0 125 3/26/2026