X39.Solutions.PdfTemplate
6.1.0.56
dotnet add package X39.Solutions.PdfTemplate --version 6.1.0.56
NuGet\Install-Package X39.Solutions.PdfTemplate -Version 6.1.0.56
<PackageReference Include="X39.Solutions.PdfTemplate" Version="6.1.0.56" />
<PackageVersion Include="X39.Solutions.PdfTemplate" Version="6.1.0.56" />
<PackageReference Include="X39.Solutions.PdfTemplate" />
paket add X39.Solutions.PdfTemplate --version 6.1.0.56
#r "nuget: X39.Solutions.PdfTemplate, 6.1.0.56"
#:package X39.Solutions.PdfTemplate@6.1.0.56
#addin nuget:?package=X39.Solutions.PdfTemplate&version=6.1.0.56
#tool nuget:?package=X39.Solutions.PdfTemplate&version=6.1.0.56
Note for NuGet.org: This README is intentionally short. For the full template-author documentation, use the GitHub Pages user manual.

X39.Solutions.PdfTemplate
X39.Solutions.PdfTemplate generates PDF documents and images from XML templates in .NET. It renders with SkiaSharp and provides built-in controls for text, borders, images, lines, tables, page numbers and charts.
User Manual
Template authors should start with the GitHub Pages user manual. The manual explains document structure, template data, layout, controls, transformers, complete examples and troubleshooting from the perspective of people who edit XML templates. The Pages site includes a persistent manual table of contents so chapters can be reached without returning to the landing page.
Useful manual entry points:
- First document
- Template data
- Layout fundamentals
- Quick reference
- Controls
- Template language
- Complete examples
- Developer integration appendix
Requirements
- .NET 8.0 or later
- A dependency injection container that can provide the services registered by
AddPdfTemplateService - On Linux, the SkiaSharp native Linux assets package
The package is marked trim-compatible and depends on SkiaSharp,
Microsoft.Extensions.DependencyInjection.Abstractions and X39.Util.
Issues are tracked in the
GitHub repository.
Install
Install the NuGet package:
dotnet add package X39.Solutions.PdfTemplate
On Linux, also install the SkiaSharp native Linux assets:
dotnet add package SkiaSharp.NativeAssets.Linux
Minimal Template
Templates are XML documents:
<template>
<body>
<text>Hello, world!</text>
</body>
</template>
For template-author guidance, use the manual. For application setup, use the developer integration appendix.
Generate a PDF
Register the library services at startup:
services.AddPdfTemplateService();
Then resolve a Generator and render the template:
using System.Globalization;
using System.Xml;
using Microsoft.Extensions.DependencyInjection;
using X39.Solutions.PdfTemplate;
await using var scope = serviceProvider.CreateAsyncScope();
using var generator = scope.ServiceProvider.GetRequiredService<Generator>();
using var reader = XmlReader.Create(xmlTemplateStream);
await using var output = File.Create("document.pdf");
await generator.GeneratePdfAsync(
output,
reader,
CultureInfo.CurrentUICulture);
Common extension points are documented in the developer integration appendix:
- Set template variables with
generator.TemplateData.SetVariable("Name", value). - Add custom functions with
services.AddPdfTemplateService((builder) => builder.AddFunction<MyFunction>()). - Add custom controls with
services.AddPdfTemplateService((builder) => builder.AddControl<TControl>()). - Add custom transformers with
services.AddPdfTemplateService((builder) => builder.AddTransformer<TTransformer>()). - Configure document-level options such as margin through
DocumentOptions.
Building and Testing
Restore and build locally:
dotnet restore
dotnet build --no-restore
Run tests:
dotnet test --framework net8.0 --no-build --verbosity normal
Create a local package:
dotnet pack --configuration Release
The pull-request workflow is defined in .github/workflows/run-dotnet-tests.yml.
The publish workflow is defined in .github/workflows/main.yml.
Documentation
The GitHub Pages source lives under docs.
The Pages table of contents is maintained in docs/_data/navigation.yml.
Executable documentation samples live under test/X39.Solutions.PdfTemplate.Test/Samples
and write generated preview assets under docs/assets/samples.
Contributing
Contributions are welcome. Please submit a pull request or create a discussion to discuss changes.
Add yourself to CONTRIBUTORS for your first pull request and include this agreement text:
By contributing to this project, you agree to the following terms:
- You grant me and any other person who receives a copy of this project the right to use your contribution under the
terms of the GNU Lesser General Public License v3.0.
- You grant me and any other person who receives a copy of this project the right to relicense your contribution under
any other license.
- You grant me and any other person who receives a copy of this project the right to change your contribution.
- You waive your right to your contribution and transfer all rights to me and every user of this project.
- You agree that your contribution is free of any third-party rights.
- You agree that your contribution is given without any compensation.
- You agree that I may remove your contribution at any time for any reason.
- You confirm that you have the right to grant the above rights and that you are not violating any third-party rights
by granting these rights.
- You confirm that your contribution is not subject to any license agreement or other agreement or obligation, which
conflicts with the above terms.
Additional controls are welcome when they do not add dependencies to the core library. Controls that need additional libraries should usually live in separate packages.
Semantic Versioning
This library follows the principles of Semantic Versioning.
| Change | Meaning |
|---|---|
| Patch | Backwards-compatible bug fixes or small internal changes. |
| Minor | Backwards-compatible features or additions. |
| Major | Breaking changes. |
License
This project is licensed under the GNU Lesser General Public License v3.0. See the LICENSE file for details.
| Product | Versions 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- SkiaSharp (>= 3.119.4)
- X39.Util (>= 1.0.0.56)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 6.1.0.56 | 105 | 5/27/2026 | |
| 6.0.0.53 | 98 | 5/27/2026 | |
| 5.3.1.52 | 171 | 2/8/2026 | |
| 5.3.0.51 | 123 | 2/8/2026 | |
| 5.1.2.49 | 345 | 11/3/2024 | |
| 5.1.1.48 | 230 | 10/31/2024 | |
| 5.1.0.47 | 264 | 10/31/2024 | |
| 5.0.0.46 | 247 | 10/25/2024 | |
| 4.1.0.45 | 332 | 7/5/2024 | |
| 4.1.0.44 | 300 | 6/24/2024 | |
| 4.0.1.42 | 646 | 5/10/2024 | |
| 4.0.0.38 | 338 | 2/1/2024 |