ReliableHtmlToPdf 1.0.2

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

ReliableHtmlToPdf

ReliableHtmlToPdf is a lightweight, production-ready HTML to PDF converter for .NET built on top of Microsoft Playwright (Chromium).

It is designed for:

  • Server-side PDF generation
  • Large HTML documents
  • Embedded fonts
  • Headers, footers, and page numbers
  • Reliable rendering across environments (Windows, Linux, Docker)

✨ Features

  • ✅ Chromium-based rendering (high fidelity)
  • ✅ Embedded fonts (Base64)
  • ✅ Headers & footers
  • ✅ Page margins & print backgrounds
  • ✅ Large HTML support
  • ✅ Async & memory-safe
  • ✅ No native dependencies

📦 Installation

dotnet add package ReliableHtmlToPdf

🚀 Basic Usage

using ReliableHtmlToPdf.Models;
using ReliableHtmlToPdf;

await using var converter = await HtmlToPdfConverter.CreateAsync();

var html = """
<!DOCTYPE html>
<html>
<head>
  <style>
    body { font-family: Arial; }
  </style>
</head>
<body>
  <h1>Hello PDF</h1>
  <p>This PDF was generated using ReliableHtmlToPdf.</p>
</body>
</html>
""";

var options = new PdfOptions
{
    PrintBackground = true,
    MarginTop = 60,
    MarginBottom = 60,
    MarginLeft = 40,
    MarginRight = 40
};

byte[] pdf = await converter.ConvertAsync(html, options);

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

🔤 Embedded Fonts

ReliableHtmlToPdf supports fully embedded fonts using Base64 encoding. This ensures consistent rendering across all environments (Windows, Linux, Docker).

Add Embedded Font (C#)

options.EmbeddedFonts.Add("Inter", interBase64);

Use the Font (HTML)

<style>
body {
  font-family: 'Inter';
}
</style>

📄 Headers & Footers

Headers and footers support dynamic page numbers using Chromium placeholders.

options.HeaderHtml = """
<div style="font-size:10px; text-align:center; width:100%;">
  ReliableHtmlToPdf Demo
</div>
""";

options.FooterHtml = """
<div style="font-size:10px; text-align:center; width:100%;">
  Page <span class="pageNumber"></span> of <span class="totalPages"></span>
</div>
""";

🧠 Notes

  • Chromium is downloaded automatically on first run by Playwright
  • Suitable for APIs, background jobs, and server-side rendering
  • Always dispose the converter after use

📜 License

MIT License © Daniel Alemu

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

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
1.0.2 179 12/26/2025
1.0.1 174 12/26/2025
1.0.0 179 12/26/2025