HTML to PDF.
Built for .NET.
Convert any URL or HTML string to a pixel-perfect PDF.
Chromium rendering, browser pooling for speed, and a clean fluent API — all in one NuGet package.
dotnet add package CobaltPdf
* Free trial runs without a licence key for as long as you need. Output is watermarked until a licence is activated.
// 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");
No cold-start.
Just fast.
Spawning a new browser process for every PDF is expensive — often costing over a second before rendering even begins. CobaltPDF keeps a pool of warm Chromium instances ready to go, slashing render times to under 100ms.
- Configurable pool with min/max browser count
- Browsers recycled after N renders — no memory leaks
- Thread-safe: concurrent renders from one instance
-
Optional
PreWarmAsync()to eliminate first-request latency
A complete PDF toolkit.
Ready out of the box.
Everything you need to generate, secure, and customise PDFs — in a single NuGet package.
Full HTML5, CSS3, Flexbox, Grid, custom web fonts, and JavaScript — rendered pixel-perfectly as it appears in Chrome. @media print rules honoured.
Dynamic HTML headers and footers with page number tokens, dates, and fully custom templates.
Inject cookies, localStorage, sessionStorage, and HTTP headers — render authenticated pages effortlessly.
AES 128-bit with user/owner passwords and permission controls (print, copy, modify).
Embed title, author, subject, keywords, and creator directly into the document properties.
Execute JS before capture — trigger lazy loaders, manipulate the DOM, or set application state.
Network idle, CSS selector, JS expression, fixed delay, or manual cobaltNotifyRender().
One-line setup for Docker, Azure App Service, AWS ECS/Fargate, Lambda, and bare-metal Linux — no manual Chromium flags.
Deploy as a standalone HTTP service with CobaltPDF.Requests — call it from any stack.
Inject HTML watermarks — full opacity control, positioning, and per-page targeting.
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.
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);
Why developers choose CobaltPDF
A side-by-side look at what matters in production.
| Feature | CobaltPDF | PuppeteerSharp | wkhtmltopdf | iTextSharp |
|---|---|---|---|---|
| Modern CSS support | ✓ | ✓ | ✗ | ✗ |
| Browser pool (no cold-start) | ✓ | ✗ | ✗ | ✗ |
| Fluent .NET API | ✓ | Partial | ✗ | Partial |
| Chromium bundled via NuGet | ✓ | ✗ | ✗ | ✗ |
| Cookie & auth injection | ✓ | ✓ | Limited | ✗ |
| PDF encryption | ✓ | ✗ | ✓ | ✓ |
| Cloud environment presets | ✓ | ✗ | ✗ | ✗ |
| Microservice support | ✓ | ✗ | ✗ | ✗ |
Start rendering PDFs
in minutes.
Free trial available. Chromium bundled. No configuration required.