Table of Contents

HTML to PDF. Perfectly.

CobaltPdf is a fast, fluent .NET 8 library that converts HTML pages and strings into pixel-perfect PDFs using a managed Chromium browser pool. Zero warm-up lag on subsequent requests, a clean chainable API, and first-class support for cookies, storage injection, custom JavaScript, fonts, watermarks, encryption, metadata, and cloud deployments.


Quick Start

using CobaltPdf;
using CobaltPdf.Configuration;

// One-time setup — call once at startup before any renders
// Use a CloudEnvironment preset for Linux, Docker, Azure, or AWS
CobaltEngine.Configure(CloudEnvironment.ConfigureForDocker);

// Render a URL
var renderer = new CobaltEngine();
var pdf = await renderer.RenderUrlAsPdfAsync("https://example.com");
pdf.SaveAs("output.pdf");

// Render an HTML string (in memory — no file written)
var pdf2 = await renderer.RenderHtmlAsPdfAsync("<h1>Hello World</h1>");
Console.WriteLine($"{pdf2.Length} bytes");

Highlights

Feature Details
Browser pooling Chromium instances kept warm between requests — no per-request startup cost
Fluent API Chain options naturally: renderer.Landscape().AddCookie(…).RenderUrlAsPdfAsync(…)
Cloud presets CloudEnvironment presets for Linux, Docker, Azure, and AWS in a single call
Wait strategies Network idle, fixed delay, CSS selector, JavaScript expression, or manual signal
Cookie injection Set cookies before navigation; domain auto-inferred after redirects
Storage injection localStorage and sessionStorage populated before the page loads
Custom JavaScript Execute arbitrary JS before capture; use window.cobaltNotifyRender() for precise control
Fonts Point to a local directory — any .ttf, .otf, .woff, .woff2 file injected automatically
Headers & Footers HTML templates with pageNumber / totalPages tokens
Watermarks HTML overlay, fully positionable, with rotation and opacity
Encryption User + owner passwords, print/copy/modify permissions
Metadata Title, author, subject, keywords, creator embedded in the PDF
Lazy loading Scroll N viewport-heights before capture to trigger infinite-scroll content
DI support services.AddCobaltPdf(…) for ASP.NET Core / generic host
Microservice-ready CobaltPDF.Requests companion package — clients send JSON payloads without installing Chromium
Licensing Call CobaltEngine.SetLicense(key) to remove the trial watermark

Documentation