HTML to PDF for .NET. Chromium precision.
Generate pixel-perfect PDFs from any URL or HTML in C# — headers, watermarks, encryption and more, in a few lines of code. Powered by a managed Chromium browser pool for maximum fidelity and speed — one fluent API, one license.
dotnet add package CobaltPdf
* Free evaluation mode runs without a license key for as long as you need. Output is watermarked until a license is activated.
using CobaltPdf;
// Render a URL to PDF
await new CobaltEngine()
.RenderUrlAsPdfAsync("https://example.com")
.SaveAsAsync("website.pdf");
// Render an HTML string to PDF
await new CobaltEngine()
.RenderHtmlAsPdfAsync("<h1>Hello, World!</h1>")
.SaveAsAsync("hello.pdf");
// Render a local HTML file to PDF
await new CobaltEngine()
.RenderHtmlFileAsPdfAsync("invoice.html")
.SaveAsAsync("invoice.pdf");
A complete PDF toolkit. One fluent API.
Generate, secure, split and customise PDFs — all through the CobaltPDF fluent API.
True Browser Rendering
Real Chromium — HTML5, CSS Grid, web fonts, JS.
Headers & Footers
Dynamic HTML with page-number, date & custom tokens.
Cookies & Auth
Inject cookies, storage & headers to render gated pages.
AES-256 Encryption
User/owner passwords with print, copy & modify controls.
PDF Metadata
Embed title, author, subject, keywords & creator.
Custom JavaScript
Run JS before capture to trigger loaders or set state.
Wait Strategies
Network-idle, selector, JS expression, delay or manual.
Cloud-Ready Presets
One-line setup for Docker, Azure, AWS & bare-metal.
Microservice Mode
Standalone HTTP service via CobaltPDF.Requests.
Watermarks
Text or HTML — or rasterized so they can't be removed.
Split, Extract & Merge
Split, extract or merge any PDF — even external ones.
Custom Fonts
Load fonts from disk so servers render text correctly.
Image Compression
Re-encodes embedded images to shrink output — on by default.
A fluent API that
reads like prose.
Every option chains. Every method has a sensible default. No XML config, no boilerplate, no ceremony — just clean, readable code that renders exactly what you mean, in either library.
var pdf = await new CobaltEngine()
.WithPaperFormat("A4")
.WithMargins(new MarginOptions(15, MarginUnit.Millimeters))
.WithHeader("<b>Q3 Report</b>")
.WithFooter("Page <span class='pageNumber'/>")
.WithEncryption(new PdfEncryptionOptions { UserPassword = "user123", OwnerPassword = "owner456" })
.WithMetadata(m => {
m.Title = "Q3 Financial Report";
m.Author = "Finance Team";
})
.RenderUrlAsPdfAsync(reportUrl);
await blobStorage.UploadAsync(pdf.BinaryData);
No cold-start.
Just fast.
Spawning a new browser process for every PDF is expensive — often costing over a second before rendering even begins. Both CobaltPDF libraries keep a pool of warm renderer instances ready to go, so every request skips the cold-start tax entirely.
- Configurable pool with min/max renderer count
- Renderers recycled after N renders — no memory leaks
- Thread-safe: concurrent renders from one instance
-
Optional
PreWarmAsync()to eliminate first-request latency
Why developers choose CobaltPDF
A side-by-side look at what matters in production.
| Feature | CobaltPDF | PuppeteerSharp | wkhtmltopdf | iTextSharp |
|---|---|---|---|---|
| Modern CSS support | ✓ | ✓ | ✗ | ✗ |
| Modern, maintained Chromium engine | ✓ | ✗ | ✗ | ✗ |
| Browser pool (no cold-start) | ✓ | ✗ | ✗ | ✗ |
| Fluent .NET API | ✓ | Partial | ✗ | Partial |
| Engine bundled via NuGet | ✓ | ✗ | ✗ | ✗ |
| Cookie & auth injection | ✓ | ✓ | Limited | ✗ |
| PDF encryption (AES-256) | ✓ | ✗ | Limited | ✓ |
| Split, extract & merge pages | ✓ | ✗ | ✗ | ✓ |
| Cloud environment presets | ✓ | ✗ | ✗ | ✗ |
| Microservice support | ✓ | ✗ | ✗ | ✗ |
| Actively maintained | ✓ | ✓ | ✗ archived | ✓ |
Start rendering PDFs
in minutes.
CobaltPDF runs free, unlimited, in evaluation mode — watermarked output until you activate your key.