PeachPDF 0.9.0

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

PeachPDF

Peach PDF is a pure .NET HTML → PDF rendering library. This library does not depend on Puppeter, wkhtmltopdf, or any other process to render the HTML to PDF. As a result, this should work in virtually any environment where .NET 8+ works. As a side benefit of being pure .NET, performance improvements in future .NET versions immediately benefit this library.

PeachPDF Requirements

  • .NET 8

Note: This package depends on PeachPDF.PdfSharpCore which has its own license, but the end result is still open source

Installing PeachPDF

Install the PeachPDF package from nuget.org

dotnet add package PeachPDF

Using PeachPDF

Simple example

Simple example to render PDF to a Stream. All images and assets must be local to the file on the file system or in data: URIs

PdfGenerateConfig pdfConfig = new(){
  PageSize = PageSize.Letter,
  PageOrientation = PageOrientation.Portrait
};

PdfGenerator generator = new();

var stream = new MemoryStream();

var document = await generator.GeneratePdf(html, pdfConfig);
document.Save(stream);

Rendering an MHTML file

You can generate PDF documents using self contained MHTML files (what Chrome calls "single page documents") by using the included MimeKitNetworkLoader

PdfGenerateConfig pdfConfig = new(){
  PageSize = PageSize.Letter,
  PageOrientation = PageOrientation.Portrait,
  NetworkLoader = new MimeKitNetworkLoader(File.OpenRead("example.mhtml"))
};

PdfGenerator generator = new();

var stream = new MemoryStream();

// Passing null to GeneratePdf will load the HTML from the provided network loader instance instead
var document = await generator.GeneratePdf(null, pdfConfig);
document.Save(stream);

Rendering HTML from a URI

You can also render HTML from the Internet to a PDF

HttpClient httpClient = new();

PdfGenerateConfig pdfConfig = new(){
  PageSize = PageSize.Letter,
  PageOrientation = PageOrientation.Portrait,
  NetworkLoader = new HttpClientNetworkLoader(httpClient, new Uri("https://www.example.com"))
};

PdfGenerator generator = new();

var stream = new MemoryStream();

// Passing null to GeneratePdf will load the HTML from the provided network loader instance instead
var document = await generator.GeneratePdf(null, pdfConfig);
document.Save(stream);

Note that loading images using relative paths will default to the local file system unless an HttpClientNetworkLoader (or custom RNetworkLoader) with an appropriate BaseUri is provided, or if the HTML has a <base> element with an href set. Images will need to be in the current working directory when using the default loader.

Fonts

Default Font

By default, PeachPDF uses Segoe UI. Segoe UI is installed by default on Windows, but isn't necessarily available on other platforms. You can remap Segoe UI to another font using

PdfGenerator generator = new();
generator.AddFontFamilyMapping("Segoe UI","sans-serif"); // or any other system installed font

Adding custom fonts

The recommended way to install custom fonts is to install them into your operating system. PeachPDF by default picks up TrueType fonts from the operating system (%SystemRoot%\Fonts and %LOCALAPPDATA%\Microsoft\Windows\Fonts on Windows, /Library/Fonts on Mac, and /usr/share/fonts, /usr/local/share/fonts/, and $HOME/.fonts on Linux)

You can also add a font at runtime by loading the font into a Stream, and then using the AddFontFromStream API:

PdfGenerator generator = new();
await generator.AddFontFromStream(fontStream); // Supports TrueType (TTF), CFF, WOFF, and WOFF2 formats

Web fonts loaded via @font-face are also supported.

Supported font formats

We support TrueType, CFF, WOFF, and WOFF2 font formats.

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

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
0.9.0 93 6/30/2026
0.9.0-preview5 56 6/25/2026
0.9.0-preview4 52 6/25/2026
0.9.0-preview3 80 6/24/2026
0.8.0 200 6/18/2026
0.8.0-preview9 93 6/18/2026
0.8.0-preview8 81 6/18/2026
0.8.0-preview7 98 6/18/2026
0.8.0-preview6 92 6/18/2026
0.8.0-preview5 90 6/18/2026
0.8.0-preview4 96 6/18/2026
0.8.0-preview3 99 6/17/2026
0.8.0-preview2 2,747 10/27/2025
0.8.0-preview1 205 10/27/2025
0.7.26 15,111 10/5/2025
0.7.25 3,144 7/30/2025
0.7.24 493 6/26/2025
0.7.23 912 6/23/2025
0.7.22 231 6/18/2025
0.7.21 3,387 5/28/2025
Loading failed