This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/print/with-watermark.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. PDF print with watermark in C# .NET | Nutrient .NET SDK

It’s possible to use PDF layers — or optional content groups (OCGs) — to add a watermark that’s invisible onscreen but visible when a PDF is printed (or vice versa). This guide demonstrates how to configure an existing OCG to be visible when a document is printed and invisible when the document is viewed onscreen.

To learn how to add an OCG to a PDF document, see our PDF layers guide.

if (status == GdPictureStatus.OK)
if ((pdf.SetOCGLockedState(ocgId, true) == GdPictureStatus.OK) &&
(pdf.SetOCGPrintState(ocgId, PdfOcgState.StateOn) == GdPictureStatus.OK) &&
(pdf.SetOCGViewState(ocgId, PdfOcgState.StateOff) == GdPictureStatus.OK))
{
pdf.SaveToFile("orpalis-demo-watermarked.pdf");
}

The code above calls: