CobaltPDF 1.1.0
dotnet add package CobaltPDF --version 1.1.0
NuGet\Install-Package CobaltPDF -Version 1.1.0
<PackageReference Include="CobaltPDF" Version="1.1.0" />
<PackageVersion Include="CobaltPDF" Version="1.1.0" />
<PackageReference Include="CobaltPDF" />
paket add CobaltPDF --version 1.1.0
#r "nuget: CobaltPDF, 1.1.0"
#:package CobaltPDF@1.1.0
#addin nuget:?package=CobaltPDF&version=1.1.0
#tool nuget:?package=CobaltPDF&version=1.1.0
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.
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, andsessionStoragebefore 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,.woff2file is injected automatically - 📄 Headers, footers & watermarks — full HTML templates with
pageNumber/totalPagestokens - 🔒 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 support —
services.AddCobaltPdf(…)for ASP.NET Core / generic host - ☁️ Cloud-ready — built-in presets for Linux, Docker, Azure, and AWS
- 📡 Microservice-ready — companion
CobaltPDF.Requestspackage 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");
© 2026 Modus Squared Ltd. All rights reserved.
| Product | Versions 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. |
-
net8.0
- chromium (>= 2026.2.1)
- chromium.win-x64 (>= 2026.2.1)
- CobaltPDF.Requests (>= 1.1.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.3)
- Microsoft.Playwright (>= 1.58.0)
- PDFsharp (>= 6.2.4)
- System.Formats.Asn1 (>= 10.0.3)
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.