CobaltPDF 1.5.0
Prefix Reserveddotnet add package CobaltPDF --version 1.5.0
NuGet\Install-Package CobaltPDF -Version 1.5.0
<PackageReference Include="CobaltPDF" Version="1.5.0" />
<PackageVersion Include="CobaltPDF" Version="1.5.0" />
<PackageReference Include="CobaltPDF" />
paket add CobaltPDF --version 1.5.0
#r "nuget: CobaltPDF, 1.5.0"
#:package CobaltPDF@1.5.0
#addin nuget:?package=CobaltPDF&version=1.5.0
#tool nuget:?package=CobaltPDF&version=1.5.0
CobaltPDF
Pixel-perfect PDFs from HTML and URLs in 3 lines of C#. Powered by a managed Chromium browser pool that stays warm between renders — every request reuses a ready browser instead of paying the Chromium startup cost.
cobaltpdf.com · Documentation · Quick start · Pricing
Free for any purpose, with no time limit. Every feature works out of the box—no trial countdowns, no feature gating, and no restrictions. Use it freely for prototyping, learning, development, or testing; the only difference is that generated PDFs carry a watermark until you activate a license key.
dotnet add package CobaltPDF
using CobaltPdf;
// Render a URL to PDF
await new CobaltEngine()
.RenderUrlAsPdfAsync("https://example.com")
.SaveAsAsync("website.pdf");
// Render an HTML string to PDF
await new CobaltEngine()
.RenderHtmlAsPdfAsync("<h1>Hello, World!</h1>")
.SaveAsAsync("hello.pdf");
// Render a local HTML file to PDF
await new CobaltEngine()
.RenderHtmlFileAsPdfAsync("invoice.html")
.SaveAsAsync("invoice.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.
Split, extract & merge
Pull pages out of any PDF — freshly rendered or loaded from disk — or merge documents back together. Pure in-process post-processing; no browser involved.
var pdf = await new CobaltEngine().RenderHtmlAsPdfAsync(html);
// One file per page
foreach (var (page, i) in pdf.SplitIntoPages().Select((p, i) => (p, i)))
page.SaveAs($"page_{i + 1}.pdf");
// Extract a range, or load an existing PDF and take what you need
pdf.ExtractPages(0, 2).SaveAs("first-three.pdf");
PdfDocument.FromFile("legacy.pdf").ExtractPage(0).SaveAs("cover.pdf");
// Merge documents
PdfDocument.Merge(coverPdf, bodyPdf, appendixPdf).SaveAs("combined.pdf");
Features
| Fluent API | Chain any combination of options in a single expression |
| Headers, footers & watermarks | HTML templates with pageNumber/totalPages tokens, built-in watermark presets, and opt-in .WithRasterize() to bake the watermark into the page pixels |
| AES-256 encryption | User + owner passwords with print/copy/modify permissions |
| Split, extract & merge | PageCount, ExtractPage(s), SplitIntoPages, FromFile, FromBytes, Merge — works on any PDF |
| 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 | 8.0 or later |
| OS | Windows x64, Linux x64 |
Targets net8.0 — fully compatible with .NET 8, 9, and 10.
Need a lighter engine?
CobaltPDF.WebKit is our standalone WebKit-based sister library: the same CobaltEngine type and fluent API, with up to 96% lower idle memory and 57% faster warm renders — built for high-volume rendering on Linux containers. Your CobaltPDF license key activates both libraries. Compare the engines →
Links
- Documentation & API reference
- Quick start snippets
- Deployment guides
- CobaltPDF.Requests (microservice mode)
License
Free to evaluate indefinitely — no time limit, no feature restrictions. Every render path, configuration option, and cloud preset works without a license key. The only difference: unlicensed PDFs include a watermark.
When you're ready to ship to production, activate a license key to remove the watermark:
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.5.16)
- chromium.linux-x64 (>= 2026.5.16)
- chromium.win-x64 (>= 2026.5.16)
- CobaltPDF.Requests (>= 1.5.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.8)
- Microsoft.Playwright (>= 1.60.0)
- PDFsharp (>= 6.2.4)
- System.Formats.Asn1 (>= 10.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.5.0
- Added PDF page splitting, extraction, and merging on PdfDocument: PageCount, ExtractPage, ExtractPages (range or subset), SplitIntoPages, FromFile, FromBytes, and Merge. Works on any PDF, on any OS — no browser involved.
- Added watermark rasterization: WatermarkOptions.Rasterize / .WithRasterize() flattens a watermark into an image baked into every page, so it has no selectable text and no separately deletable object in a PDF editor. Opt-in; default behaviour unchanged.
- Encryption upgraded from AES-128 to AES-256 (security handler V5/R6). The WithEncryption API and all password/permission behaviour are unchanged — only the cipher strength improved.
- Added WithoutPostProcessing() as an accepted no-op for drop-in compatibility with CobaltPDF.WebKit (Chromium's PDF backend already subsets fonts and compresses images natively, so it has no effect here).
- CobaltPDF.Requests dependency updated to v1.5.0, forwarding the watermark Rasterize flag and the new SkipPostProcessing flag through PdfRequest.ExecuteAsync (SkipPostProcessing is honoured by the WebKit edition and ignored here).
- All changes are backward compatible; no public API was renamed or removed.
v1.4.1
- WithUserAgent, WithHttpHeader, and WithHttpHeaders are now declared on the IPdfGenerator and IPdfGeneratorFinal interfaces (previously only on CobaltEngine).
- Fixed AddCookie(name, value) without an explicit domain throwing "Invalid cookie fields" when the final URL is localhost, an IP address, or a single-label intranet hostname. Such cookies are now registered as standard host-only cookies.
v1.4.0
- Updated bundled Chromium from 2026.2.1 to 2026.5.16 to resolve upstream security advisories.
- Dropped .NET 6.0 target. The package now targets .NET 8.0 (compatible with .NET 8, 9, and 10). Consumers on .NET 6 should stay on v1.3.0 or upgrade their runtime; .NET 6 is out of Microsoft support as of November 2024.
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.