CobaltPDF 1.1.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package CobaltPDF --version 1.1.0
                    
NuGet\Install-Package CobaltPDF -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CobaltPDF" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CobaltPDF" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="CobaltPDF" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CobaltPDF --version 1.1.0
                    
#r "nuget: CobaltPDF, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CobaltPDF@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CobaltPDF&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=CobaltPDF&version=1.1.0
                    
Install as a Cake Tool

CobaltPDF

CobaltPDF is a high-performance .NET 8 library that converts HTML pages and strings into pixel-perfect PDFs using a managed Chromium browser pool.

NuGet License


Features

  • 🚀 Browser pooling — Chromium instances kept warm between requests; no per-request startup cost
  • ✍️ Fluent API — chain options naturally: renderer.Landscape().AddCookie(…).RenderUrlAsPdfAsync(…)
  • Wait strategies — network idle, fixed delay, CSS selector, JavaScript expression, or manual signal
  • 🍪 Cookie & storage injection — set cookies, localStorage, and sessionStorage before navigation
  • 🖋️ Custom JavaScript — execute arbitrary JS before capture; use window.cobaltNotifyRender() for precise control
  • 🔤 Fonts — point to a local directory and any .ttf, .otf, .woff, .woff2 file is injected automatically
  • 📄 Headers, footers & watermarks — full HTML templates with pageNumber/totalPages tokens
  • 🔒 Encryption — user + owner passwords with 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 supportservices.AddCobaltPdf(…) for ASP.NET Core / generic host
  • ☁️ Cloud-ready — built-in presets for Linux, Docker, Azure, and AWS
  • 📡 Microservice-ready — companion CobaltPDF.Requests package lets clients send JSON payloads without installing Chromium

Quick Start

dotnet add package CobaltPDF
using CobaltPdf;
using CobaltPdf.Configuration;

// One-time setup at application startup
CobaltEngine.Configure(options =>
{
    options.MinSize = 2;
    options.MaxSize = Environment.ProcessorCount;
});
// On Linux, --no-sandbox, --disable-gpu, and --disable-dev-shm-usage are added automatically.
// Or use a cloud preset: CobaltEngine.Configure(CloudEnvironment.ConfigureForDocker);

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

// Render an HTML string
var pdf2 = await renderer.RenderHtmlAsPdfAsync("<h1>Hello, World!</h1>");
Console.WriteLine($"{pdf2.Length} bytes");

Cloud Deployments

Use the built-in CloudEnvironment presets instead of configuring flags manually:

// Docker
CobaltEngine.Configure(CloudEnvironment.ConfigureForDocker);

// Azure Functions Premium Plan
CobaltEngine.Configure(CloudEnvironment.ConfigureForAzure);

// AWS ECS / Fargate
CobaltEngine.Configure(CloudEnvironment.ConfigureForAwsEcs);

// Memory-constrained (AWS Lambda custom runtime, small containers)
CobaltEngine.Configure(CloudEnvironment.ConfigureForLowMemory);

See the Deployment guide for full platform walkthroughs.


Fluent API

var pdf = await new CobaltEngine()
    .Landscape()
    .WithPaperFormat("A3")
    .EmulateMediaType(CssMediaType.Print)
    .WithHeader("<div style='text-align:center;width:100%'>My Report</div>")
    .WithFooter("<div style='text-align:center;width:100%'>Page <span class='pageNumber'></span></div>")
    .AddCookie("session", "abc123", "example.com")
    .WaitFor(WaitOptions.NetworkIdle)
    .RenderUrlAsPdfAsync("https://example.com/report");

pdf.SaveAs("report.pdf");

ASP.NET Core Integration

// Program.cs
builder.Services.AddCobaltPdf(o =>
{
    CloudEnvironment.ConfigureForDocker(o);
    o.MaxSize = 4;
});

// Controller / service
public class ReportService(CobaltEngine renderer)
{
    public async Task<byte[]> GenerateAsync(string url)
        => (await renderer.RenderUrlAsPdfAsync(url)).BinaryData;
}

Microservice / Azure Function Pattern

When deploying CobaltPDF as a dedicated PDF rendering service, use the companion CobaltPDF.Requests package in your client application. It contains only the serialisable request and response models — no Chromium, no Playwright.

[Web App]  ──── CobaltPDF.Requests (tiny, ~50 KB) ────▶ HTTP POST ──▶ [Azure Function]
                PdfRequest / PdfResponse                               CobaltPDF (full)

Client (web app):

dotnet add package CobaltPDF.Requests
var request = new PdfRequest
{
    Url         = "https://myapp.com/invoice/42",
    Landscape   = true,
    PaperFormat = "A4",
    Metadata    = new() { Title = "Invoice #42" },
    Encryption  = new() { UserPassword = "open123" }
};

var response = await httpClient.PostAsJsonAsync("/api/pdf", request);
var pdfBytes = (await response.Content.ReadFromJsonAsync<PdfResponse>())!.ToBytes();

Azure Function (rendering service):

dotnet add package CobaltPDF   # CobaltPDF.Requests is included automatically
[Function("GeneratePdf")]
public async Task<HttpResponseData> Run(
    [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req,
    CancellationToken ct)
{
    var request = await req.ReadFromJsonAsync<PdfRequest>();
    var pdf = await request!.ExecuteAsync(_renderer, ct);

    var response = req.CreateResponse(HttpStatusCode.OK);
    response.Headers.Add("Content-Type", "application/pdf");
    await response.Body.WriteAsync(pdf.BinaryData, ct);
    return response;
}

See the HTTP Requests guide for the full JSON schema and more examples.


Requirements

Requirement Version
.NET 8.0 or later
OS Windows x64, Linux x64

Chromium is bundled as a NuGet dependency — no separate installation required.


Documentation

Full documentation is available at cobaltpdf.com/docs.


License

CobaltPDF is a commercial product. A license key is required for production use. A trial watermark is applied to all PDFs generated without a valid license.

CobaltEngine.SetLicense("YOUR-LICENSE-KEY");

View licensing options →


© 2026 Modus Squared Ltd. All rights reserved.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated

v1.1.0
     - Consolidated all public types into the CobaltPdf namespace (single using statement).
     - Added WithPrintBackground(), WithScale(), WithPageRanges(), WithPageSize() to the fluent API.
     - Extracted WatermarkOptions, PdfEncryptionOptions, MetadataOptions to top-level classes.

     v1.0.1
     - Added WithPaperFormat() and WithMargins() to the fluent API.
     - Added CancellationToken support to all render methods.
     - Added SaveAsAsync() and Task<PdfDocument> fluent chaining extensions.
     - Added CloudEnvironment presets for Linux, Docker, Azure, and AWS.
     - Improved browser pool with linked CancellationTokenSource for lease timeouts.