---
title: "PDF print with watermark in C# .NET | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/print/with-watermark/"
md_url: "https://www.nutrient.io/guides/dotnet/print/with-watermark.md"
last_updated: "2026-05-21T17:12:02.215Z"
description: "Learn how to print PDF documents with watermarks programmatically in C# using Nutrient .NET SDK. Add branding or security to printed PDFs."
---

# PDF printing with watermarks in C#

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](https://www.nutrient.io/guides/dotnet/layers.md).

```csharp

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:

- [`SetOCGLockedState()`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~SetOCGLockedState.html) to prevent the reader from changing visibility.

- [`SetOCGPrintState()`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~SetOCGPrintState.html) to make the OCG visible when printed.

- [`SetOCGViewState()`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~SetOCGViewState.html) to make the OCG invisible onscreen.
---

## Related pages

- [Print PDF or images using C#](/guides/dotnet/print.md)
- [Configuring the printing process in C#](/guides/dotnet/print/configuring-printing.md)
- [Printing PDFs silently in C#](/guides/dotnet/print/silently.md)
- [Printing PDFs programmatically in C#](/guides/dotnet/print/programmatic.md)
- [Printing PDFs to a network printer in C#](/guides/dotnet/print/to-network-printer.md)
- [Printing PDFs to a specific printer in C#](/guides/dotnet/print/to-specific-printer.md)
- [UI control for PDF printing](/guides/dotnet/print/ui-control.md)

