Architecture & Features

Built for production.
Designed for developers.

CobaltPDF is a managed rendering platform for high-throughput .NET applications, available as two libraries — Chromium for pixel-perfect fidelity, WebKit for a fraction of the memory — behind one 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 supported via .WithMediaType()
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");
New · WebKit Edition

Need it leaner?
CobaltPDF.WebKit.

A separate, standalone library with the identical fluent API, driving a headless WebKit engine instead of Chromium. Built for Linux containers and high-volume pipelines — and activated by the same license key.

  • Up to 96% lower idle memory than the Chromium engine*
  • 57% faster warm-mean render times*
  • Self-provisioning Linux bundle — no Docker image changes, no apt
  • Windows development via WSL2 or Docker Desktop

* Measured across 10 warm renders of three public pages: ~14 MB vs ~310 MB steady RSS; 2.5 s vs 5.7 s warm-mean. Methodology & docs.

InvoiceService.cs
// Only this line changes — the API is identical
using CobaltPdf.WebKit;

var pdf = await new CobaltEngine()
    .WithPaperFormat("A4")
    .WithFooter("Page <span class='pageNumber'/>")
    .RenderHtmlAsPdfAsync(invoiceHtml);

// Per-render memory metrics built in
logger.LogInformation("Steady RSS: {Mb} MB",
    pdf.SteadyRssMb);
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
Recycling
Ready Rendering Recycling

// 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 with configurable opacity, rotation, and position — or rasterize them into the page so they can't be deleted in a PDF editor.

AES-256 Encryption

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

Split, Extract & Merge

Pull out pages or ranges, split any PDF into one file per page, or merge documents — even PDFs CobaltPDF didn't create.

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 margins in mm, cm, inches, or pixels.

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✗ legacy QtWebKit
Lightweight modern WebKit engine option✓ CobaltPDF.WebKit✗ unmaintained
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 to use forever — no time limit, no credit card required, production-ready.