Metadata
PDF metadata is embedded in the document's Information Dictionary and is visible to users through "Document Properties" in most PDF viewers. It also aids search engines and document management systems.
Setting Metadata
var pdf = await renderer
.WithMetadata(m =>
{
m.Title = "Q4 Financial Report";
m.Author = "Alice Smith";
m.Subject = "Quarterly earnings summary for Q4 2025";
m.Keywords = "finance, quarterly, earnings, 2025";
m.Creator = "MyApp v2.1";
})
.RenderUrlAsPdfAsync("https://example.com/q4-report");
pdf.SaveAs("report.pdf");
MetadataOptions Reference
| Property | Type | Default | Description |
|---|---|---|---|
Title |
string? |
null |
Document title |
Author |
string? |
null |
Author name |
Subject |
string? |
null |
Subject or description |
Keywords |
string? |
null |
Comma-separated keywords |
Creator |
string? |
null |
Application that created the content |
Producer |
string? |
"CobaltPdf" |
PDF producer (note: PDFsharp may override this) |
CreationDate |
DateTime? |
null |
Creation date. null = current UTC time |
Combining Metadata and Encryption
Metadata and encryption can be applied together in the same fluent chain. CobaltPdf runs both through PDFsharp in a single document pass:
var pdf = await renderer
.WithMetadata(m =>
{
m.Title = "Confidential Contract";
m.Author = "Legal Department";
})
.WithEncryption(new PdfEncryptionOptions
{
UserPassword = "contract2025",
AllowCopying = false
})
.RenderUrlAsPdfAsync("https://example.com/contract");
Tip
For password-protecting the document and restricting print/copy permissions, see the Encryption article.