CobaltPDF 1.3.0
Prefix Reserveddotnet add package CobaltPDF --version 1.3.0
NuGet\Install-Package CobaltPDF -Version 1.3.0
<PackageReference Include="CobaltPDF" Version="1.3.0" />
<PackageVersion Include="CobaltPDF" Version="1.3.0" />
<PackageReference Include="CobaltPDF" />
paket add CobaltPDF --version 1.3.0
#r "nuget: CobaltPDF, 1.3.0"
#:package CobaltPDF@1.3.0
#addin nuget:?package=CobaltPDF&version=1.3.0
#tool nuget:?package=CobaltPDF&version=1.3.0
CobaltPDF
Pixel-perfect PDFs from HTML and URLs in 3 lines of C#. Powered by a managed Chromium browser pool with <75 ms warm renders.
dotnet add package CobaltPDF
using CobaltPdf;
await new CobaltEngine()
.RenderUrlAsPdfAsync("https://example.com")
.SaveAsAsync("output.pdf");
That's it. Chromium is bundled automatically — nothing else to install.
Go further
var pdf = await new CobaltEngine()
.WithPrintBackground()
.WithPaperFormat("A4")
.WithMargins(new MarginOptions(20, 15, 20, 15))
.WithHeader("<div style='font-size:10px;text-align:center;width:100%'>My Report</div>")
.WithFooter("<div style='font-size:10px;text-align:center;width:100%'>Page <span class='pageNumber'></span> of <span class='totalPages'></span></div>")
.WithWatermark(WatermarkOptions.WithText("DRAFT", WatermarkStyle.SoftGray))
.WithEncryption(new PdfEncryptionOptions
{
UserPassword = "viewer-pass",
OwnerPassword = "admin-secret",
AllowPrinting = true,
AllowCopying = false,
})
.WithMetadata(m =>
{
m.Title = "Q4 Financial Report";
m.Author = "Finance Team";
})
.AddCookie("session", "abc123")
.WithWaitStrategy(WaitOptions.DefaultNetworkIdle)
.RenderUrlAsPdfAsync("https://example.com/report");
pdf.SaveAs("report.pdf");
Every option chains. Every method has a sensible default. Use only what you need.
Features
| Fluent API | Chain any combination of options in a single expression |
| Headers, footers & watermarks | HTML templates with pageNumber/totalPages tokens and built-in watermark presets |
| AES encryption | User + owner passwords with print/copy/modify permissions |
| Wait strategies | Network idle, CSS selector, JS expression, fixed delay, or cobaltNotifyRender() signal |
| Cookies & storage | Inject cookies, localStorage, and sessionStorage before navigation |
| Custom JavaScript | Execute JS before capture to manipulate the DOM or set application state |
| Custom fonts | Load .ttf, .otf, .woff, .woff2 from a local directory |
| Lazy loading | Scroll N viewport-heights to trigger IntersectionObserver content |
| Metadata | Embed title, author, subject, and keywords in the PDF |
| DI support | services.AddCobaltPdf() with singleton lifecycle for ASP.NET Core |
| Cloud-ready | Built-in presets for Docker, Azure, AWS ECS/Fargate, and Lambda |
| Microservice mode | Lightweight CobaltPDF.Requests package for JSON-based rendering without Chromium |
ASP.NET Core
// Program.cs
CobaltEngine.SetLicense(builder.Configuration["CobaltPdf:LicenseKey"]!);
builder.Services.AddCobaltPdf(CloudEnvironment.ConfigureForDocker);
// Controller — inject CobaltEngine as a singleton
public class ReportController(CobaltEngine renderer) : ControllerBase
{
[HttpGet("export")]
public async Task<IActionResult> Export(CancellationToken ct)
{
var pdf = await renderer
.WithPrintBackground()
.RenderUrlAsPdfAsync("https://app.example.com/report", ct);
return File(pdf.BinaryData, "application/pdf", "report.pdf");
}
}
Cloud presets: ConfigureForDocker | ConfigureForAzure | ConfigureForAwsEcs | ConfigureForLowMemory | ConfigureForLinux
Requirements
| .NET | 6.0 or later |
| OS | Windows x64, Linux x64 |
Multi-targets net6.0 and net8.0 — NuGet selects the best build for your project automatically.
Links
- Documentation & API reference
- Quick start snippets
- Deployment guides
- CobaltPDF.Requests (microservice mode)
License
CobaltPDF is commercial software. Without a licence key, a trial watermark is applied to all PDFs.
CobaltEngine.SetLicense("YOUR-LICENSE-KEY");
© 2026 Modus Squared Ltd. All rights reserved.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
-
net6.0
- chromium (>= 2026.2.1)
- chromium.linux-x64 (>= 2026.2.1)
- chromium.win-x64 (>= 2026.2.1)
- CobaltPDF.Requests (>= 1.3.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.3)
- Microsoft.Playwright (>= 1.58.0)
- PDFsharp (>= 6.2.4)
- System.Formats.Asn1 (>= 10.0.3)
-
net8.0
- chromium (>= 2026.2.1)
- chromium.linux-x64 (>= 2026.2.1)
- chromium.win-x64 (>= 2026.2.1)
- CobaltPDF.Requests (>= 1.3.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.
v1.3.0
- Added multi-targeting: the package now supports both .NET 6.0 and .NET 8.0+, broadening compatibility with projects on .NET 6, 7, 8, 9, and 10.
v1.2.2
- Fixed Chromium default header/footer appearing when only one template is provided. Setting a footer no longer adds an unwanted date header, and vice versa.
- WithCustomJS now waits for the page to be fully loaded before executing, so dynamically-injected elements (e.g. cookie consent buttons) are available.
- Client-side redirects (e.g. bbc.com → bbc.co.uk) are now detected before cookies, custom JS, and wait strategies run.
- Fixed WithLazyLoadPages not working when combined with WithCustomJS or WithWaitStrategy.
v1.2.0
- Added transitive MSBuild props to auto-configure RuntimeIdentifiers (win-x64, linux-x64) for consuming projects, fixing Chromium.Path resolution in Docker and cloud deployments.
- No manual .csproj changes needed for Docker/Azure/AWS deployments.
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.