Docs / Guides
Metadata and watermarks
Metadata describes a document to viewers, search engines and archives; a watermark marks every page as a draft, confidential or branded copy.
Document metadata
Set properties on document.Info; properties you leave null are omitted.
using SoftZenPdf;
var document = new PdfDocument();
document.Info.Title = "Annual report 2026";
document.Info.Author = "Finance team";
document.Info.Subject = "Results for the year";
document.Info.Keywords = "report, finance";
document.Info.CreationDate = DateTimeOffset.Now;
document.AddPage();
document.Save("metadata.pdf");
var info = PdfReader.Open("metadata.pdf").Info;
Console.WriteLine($"{info.Title} by {info.Author}");
| Property | Meaning |
|---|---|
Title | Document title; many viewers show it in the title bar |
Author | Person or organisation that wrote it |
Subject | Subject or short description |
Keywords | Keywords, usually comma-separated |
Creator | Application that created the original content |
Producer | Software that produced the PDF |
CreationDate, ModificationDate | Written with second precision and their UTC offset |
The properties are written to the PDF Info dictionary and mirrored in an XMP metadata stream, the format archives and
PDF/A require. Set document.WriteXmpMetadata = false to write only the Info dictionary (not allowed in
PDF/A mode). PdfReader.Info reads the properties of existing files.
Text watermarks
Assign document.Watermark and it is drawn on every page when the document is saved, centred, rotated by
angle degrees counter-clockwise and made translucent with real opacity.
using SoftZenPdf;
var document = new PdfDocument();
document.AddPage().Content.DrawText("Contract", 72, 770, StandardFont.HelveticaBold, 20);
document.AddPage().Content.DrawText("Terms", 72, 770, StandardFont.HelveticaBold, 20);
document.Watermark = Watermark.Text("DRAFT", StandardFont.HelveticaBold, 120, PdfColor.Red, angle: 45, opacity: 0.15);
document.Save("watermark.pdf");
Image watermarks
Watermark.Image stamps a logo or seal instead. scale is relative to the largest size at which
the image fits the page, so 1 fills the page width or height.
using SoftZenPdf;
var document = new PdfDocument();
document.AddPage().Content.DrawText("Confidential brochure", 72, 770, StandardFont.HelveticaBold, 20);
document.Watermark = Watermark.Image(PdfImage.FromFile("logo.png"), scale: 0.5, angle: 0, opacity: 0.1);
document.Save("image-watermark.pdf");
How watermarks are applied
- The watermark is centred on each page's crop box (or media box) and drawn on top of the page content, so keep the opacity low.
- It is applied at save time to every page, including pages imported from other PDFs.
- A document has one watermark; set
Watermarktonullto remove it. In PDF/A mode a text watermark needs an embedded TrueType font.
API: PdfDocumentInfo, Watermark.