Pragmatic.Email.Model 1.0.0-alpha.1

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

Pragmatic.Documents

Document, email, spreadsheet, templating, and export tooling for Pragmatic.Design: render a single document model to PDF, DOCX, HTML email, CSV, and XLSX.

Pragmatic.Documents is an umbrella module: a JSON-serializable document model plus renderers, template resolvers, markup parsers, and data-source integrations. You build a DocumentModel (directly or from markup/templates) and render it to whichever format you need: the model is the single source.

Package map

Package Purpose
Models
Pragmatic.Documents.Model Page-oriented document model (DocumentModel, DocumentBuilder)
Pragmatic.Email.Model HTML email model
Pragmatic.Documents.Spreadsheet Spreadsheet model for XLSX/CSV
Renderers and I/O
Pragmatic.Documents.Pdf DocumentModel → PDF, through a native Typst compiler shipped in the package
Pragmatic.Documents.Docx DocumentModel → DOCX
Pragmatic.Documents.Email EmailModel → table-based HTML email with inline CSS (EmailHtmlRenderer), and its plain-text part (EmailTextRenderer)
Pragmatic.Documents.Csv / .Xlsx Read/write CSV / XLSX
Pragmatic.Documents.Csv.Generator Source generator: typed, AOT-safe CSV reader/writer for [CsvSerializable] types
Pragmatic.Documents.Ooxml OOXML parts (namespaces, relationships, theme, core properties) used by the XLSX writer
Templates
Pragmatic.Documents.Markup PDX templates end to end: IPdxTemplates (a template by name, in the reader's language → document model, or mail subject/HTML/text), template sources, the PDX-Doc / PDX-Email parsers
Pragmatic.Documents.Templating Expression engine: parser, evaluator, pipes, data context
Pragmatic.Documents.Templating.I18N Date, currency, percent and t: pipes over IStringLocalizer
Pragmatic.Documents.Templating.Spreadsheet XLSX and CSV files as template data sources
Pragmatic.Documents.Templates / Pragmatic.Email.Templates Template types and resolvers → DocumentModel / EmailModel

Add only the packages you need; each renderer depends on its model, not on the others.

Quick Start

A document is a template and its data. The template is a file, changed, translated and reviewed without a build, shipped inside the module that owns it:


<document title="{{ t:invoice.title }} {{ invoice.number }}">
  <page>
    <heading level="1">{{ t:invoice.title }} {{ invoice.number }}</heading>
    <text>{{ t:invoice.due }}: {{ invoice.total | currency }}</text>
  </page>
</document>

<EmbeddedResource Include="templates\*.pdxdoc;templates\*.pdxemail" />
using Pragmatic.Documents.Markup;
using Pragmatic.Documents.Pdf;
using Pragmatic.Documents.Templating.Data;

// once, in the module: every host that includes it registers the source
[assembly: PdxTemplates<BillingModule>]
// (a hand-built host, or another source: services.AddPdxTemplates(t => t.FromAssemblyOf<BillingModule>()))

// where the document is wanted: IPdxTemplates is injected
var data = new TemplateDataContext()
    .AddSource("invoice", new Dictionary<string, object?> { ["number"] = "INV-001", ["total"] = invoice.Total });

var document = await templates.DocumentAsync("invoice.pdxdoc", customer.Language, data, ct);
byte[] pdf = PdfRenderer.Render(document.Model);   // → PDF
// document.Warnings lists every name the template used and the data did not provide

var mail = await templates.EmailAsync("reminder.pdxemail", customer.Language, data, ct);
// mail.Subject, mail.Html, mail.Text: both bodies from one model

The language is the reader's, and it governs the t: translations and the date / currency / percent pipes alike. Use DocumentBuilder / EmailBuilder when code decides the layout, or for what the markup cannot express (styling, page-number fields, hyperlinks); see Templating, Markup and Getting Started.

Status

Functional within 1.0.0-alpha: PDF, DOCX, HTML email, CSV, and XLSX rendering. Parsing is currently in-memory; see the roadmap for streaming and large files.

Documentation

Guide What you'll learn
Concepts The model-first architecture, choosing a package
Getting Started Build a model and render it
Templating Template resolvers and data binding
Markup Parser Building a model from markup
PDF · DOCX · Email · CSV · XLSX Per-format rendering and options
Common Mistakes · Troubleshooting Pitfalls and fixes

Requirements

  • .NET 10.0+

License

Part of the Pragmatic.Design ecosystem. See Licensing. Pragmatic.Documents is licensed under the PolyForm Small Business 1.0.0 license (free for small businesses; commercial license above the threshold).

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.
  • net10.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Pragmatic.Email.Model:

Package Downloads
Pragmatic.Email.Templates

Email template types and resolver: template with bindings to resolved EmailModel.

Pragmatic.Documents.Email

HTML email renderer: EmailModel to table-based HTML with inline CSS and MSO/VML conditionals.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.6 106 11/21/2026
1.0.0-alpha.5 68 11/21/2026
1.0.0-alpha.4 80 11/16/2026
1.0.0-alpha.3 117 10/17/2026
1.0.0-alpha.2 80 10/12/2026
1.0.0-alpha.1 105 10/3/2026