Architecture & Features

Built for production.
Designed for developers.

CobaltPDF isn't just a wrapper around Chromium — it's a managed rendering platform for high-throughput .NET applications with a fluent API that gets out of your way.

Rendering Engine

Real Chrome.
Pixel-perfect output.

CobaltPDF drives a real headless Chromium process — the same engine powering Google Chrome. Every PDF is an exact replica of what a user sees in their browser, including every modern CSS feature.

  • CSS Grid, Flexbox, custom web fonts & animations
  • JavaScript-rendered content (React, Vue, Angular)
  • SVG charts, Canvas elements captured at rest
  • @media print CSS rules honoured automatically
Program.cs
var renderer = new CobaltEngine();

var pdf = await renderer
    .WithMediaType(CssMediaType.Print)
    .WithPaperFormat("A4")
    .RenderUrlAsPdfAsync("https://app.example.com/invoice/42");

pdf.SaveAs("invoice.pdf");
Performance

Warm browser pool.
Near-zero startup cost.

Spawning a Chromium process costs 1–2 seconds. CobaltPDF keeps a managed pool of warm browser instances and leases them per-render, eliminating that cost on every request.

  • Configurable MinSize and MaxSize browser count
  • Browsers recycled after N renders to cap memory growth
  • Cloud presets: Docker, Azure, AWS ECS, Low-Memory
  • PreWarmAsync() eliminates first-request latency

Browser Pool — 4 workers

Warm
Rendering
Rendering
Idle
Ready Rendering Idle

// One-time at startup
CobaltEngine.Configure(CloudEnvironment.ConfigureForDocker);
await CobaltEngine.PreWarmAsync();
Thread Safety

Every render is
fully isolated.

Each render gets its own private browser context. Cookies, storage, and session state from one request are completely invisible to concurrent renders.

  • Inject cookies, localStorage, sessionStorage per render
  • Custom HTTP headers and User-Agent per render
  • One CobaltEngine instance safe as a DI singleton
  • Fully async/await — no thread blocking, no deadlocks

Parallel renders — isolated contexts

Render A — User: Alice
session=eyJhbGci…
locale=en-GB
theme=dark
Render B — User: Bob
session=eyJibGNp…
locale=fr-FR
theme=light
Zero state leakage between contexts
Developer Experience

Fluent API.
No ceremony.

Chain options and call a single terminal method. The engine resets after each render — no new instances, no configuration objects, no boilerplate.

  • Render from URL, HTML string, or file path
  • CancellationToken support on every method
  • Returns raw bytes — stream, save, or upload directly
  • ASP.NET Core DI: services.AddCobaltPdf()
ReportController.cs
[HttpGet("report")]
public async Task<IActionResult> GetReport(
    CancellationToken ct)
{
    var pdf = await _renderer
        .WithLandscape()
        .WithPaperFormat("A3")
        .WithHttpHeader("Authorization", $"Bearer {_token}")
        .AddCookie("session", User.SessionId)
        .WithHeader(headerHtml)
        .WithFooter(footerHtml)
        .RenderUrlAsPdfAsync(reportUrl, ct);

    return File(pdf.BinaryData, "application/pdf");
}
Full Capability List

Everything in the box.

A complete PDF generation toolkit — no extensions or add-ons required.

Headers & Footers

Dynamic HTML templates with page number, total pages, and date tokens on every page.

Watermarks

Overlay text or HTML watermarks on every page with configurable opacity, rotation, and position.

PDF Encryption

Password-protect output with user and owner passwords. Control print, copy, and modification permissions.

Cookies & Storage

Inject cookies, localStorage, and sessionStorage before the page loads — render authenticated pages cleanly.

Custom HTTP Headers

Set User-Agent, Authorization, Accept-Language, and any other request header per render.

Custom JavaScript

Execute JS before capture. Signal readiness with cobaltNotifyRender() for full SPA control.

Wait Strategies

networkIdle, DOM selector, JS expression, custom signal, or fixed delay — complete control over capture timing.

Custom Fonts

Load fonts from disk before rendering so PDFs display correctly on servers without those fonts installed.

Lazy Load Support

Auto-scroll before capture to trigger lazy-loaded images and content, then render the complete page.

PDF Metadata

Embed document title, author, subject, keywords, and creator properties directly in the PDF.

Paper & Margins

A4, A3, Letter, Legal, Tabloid — or custom sizes. Per-side margin control with CSS length values.

CobaltPDF.Requests

Companion package for microservices — send PDF jobs from lightweight .NET clients without Chromium on the client.

How it compares

CobaltPDF vs. the alternatives.

wkhtmltopdf and PuppeteerSharp are common choices. Here's how they stack up.

⚡ CobaltPDF PuppeteerSharp wkhtmltopdf
Real Chromium engine✗ old WebKit
Browser pooling (no cold-start per request)✓ built-in✗ manual
Fluent .NET APIPartial
Thread-safe singleton
Cookie & storage injectionManual
Custom HTTP headers per renderManual
Cloud environment presets
Wait strategies (signal, selector, JS)Manual
Modern CSS (Grid, Flexbox, variables)
Chromium bundled via NuGet (no CLI install)CLI downloadSystem install

Ready to ship better PDFs?

Free trial available — no time limit, no credit card required.