How to Apply Custom PDF Watermarks in C#

How to Add Watermarks to PDFs in C# Using IronPDF

IronPDF adds text or image watermarks to any PDF with the ApplyWatermark method, which takes an HTML string so you control styling, opacity, rotation, and placement through CSS and a 3x3 alignment grid. The watermark sits behind the page content, keeping the document readable while it carries branding or a security mark.

Quickstart: Apply a Watermark in One Line

Render or open a PDF, then call ApplyWatermark with an HTML string. The four-argument overload takes the HTML, an opacity value, and a VerticalAlignment / HorizontalAlignment pair that places the mark on the page.

  1. Install IronPDF with NuGet Package Manager

    PM > Install-Package IronPdf
  2. Copy and run this code snippet.

    IronPdf.PdfDocument.FromFile("input.pdf")
        .ApplyWatermark("<h1 style='color:red;'>Confidential</h1>", 50, IronPdf.Editing.VerticalAlignment.Top, IronPdf.Editing.HorizontalAlignment.Center)
        .SaveAs("output.pdf");
  3. Deploy to test on your live environment

    Start using IronPDF in your project today with a free trial

    arrow pointer


How Do I Apply a Watermark to My PDF?

Call ApplyWatermark on a freshly rendered or imported PdfDocument. The method accepts an HTML string, so the watermark can carry images, text, custom fonts, colors, and CSS layout. The example below combines a logo image and a heading into one mark. Watermarks apply to every page in the document; per-page marks are not supported through this method.

If you need to build the source document first, see the guides on creating PDFs and HTML to PDF conversion.

What HTML Can I Put in a Watermark?

:path=/static-assets/pdf/content-code-examples/how-to/custom-watermark-apply-watermark.cs
using IronPdf;

string watermarkHtml = @"
<img src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>
<h1>Iron Software</h1>";

ChromePdfRenderer renderer = new ChromePdfRenderer();

PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Watermark</h1>");

// Apply watermark
pdf.ApplyWatermark(watermarkHtml);

pdf.SaveAs("watermark.pdf");
Imports IronPdf

Private watermarkHtml As String = "
<img src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>
<h1>Iron Software</h1>"

Private renderer As New ChromePdfRenderer()

Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Watermark</h1>")

' Apply watermark
pdf.ApplyWatermark(watermarkHtml)

pdf.SaveAs("watermark.pdf")
$vbLabelText   $csharpLabel

The watermark string accepts any standard HTML and CSS, including remote images and web fonts and icons. Because the mark renders behind the page content, the original text stays legible while the watermark supplies branding or a status label.

What Does the Watermarked PDF Look Like?


How Can I Adjust Watermark Opacity and Rotation?

A watermark applies at 50% opacity by default. To change it, pass opacity: (0 to 100, where 0 is transparent and 100 is fully opaque) and rotation: (0 to 360 degrees) as named arguments. A 45-degree rotation produces the diagonal mark common on draft and confidential documents.

What Parameters Control Opacity and Rotation?

:path=/static-assets/pdf/content-code-examples/how-to/custom-watermark-apply-rotation-opacity.cs
using IronPdf;
using IronPdf.Editing;

string watermarkHtml = @"
<img style='width: 200px;' src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>
<h1>Iron Software</h1>";

ChromePdfRenderer renderer = new ChromePdfRenderer();

PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Watermark</h1>");

// Apply watermark with 45 degrees rotation and 70% opacity
pdf.ApplyWatermark(watermarkHtml, rotation: 45, opacity: 70);

pdf.SaveAs("watermarkOpacity&Rotation.pdf");
Imports IronPdf
Imports IronPdf.Editing

Private watermarkHtml As String = "
<img style='width: 200px;' src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>
<h1>Iron Software</h1>"

Private renderer As New ChromePdfRenderer()

Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Watermark</h1>")

' Apply watermark with 45 degrees rotation and 70% opacity
pdf.ApplyWatermark(watermarkHtml, rotation:= 45, opacity:= 70)

pdf.SaveAs("watermarkOpacity&Rotation.pdf")
$vbLabelText   $csharpLabel

The rotation argument turns the mark around its center, and opacity sets how strongly it shows through. Together they tune how prominent the watermark is against the page beneath it.

What Does Rotation and Opacity Produce?


Icon Quote related to What Does Rotation and Opacity Produce?

My favorite library of this kind is IronPDF. It allows for fast and efficient manipulation of PDF files. It also has many valuable features, like exporting to PDF/A format and digitally signing PDF documents.

Milan Jovanovic related to What Does Rotation and Opacity Produce?

Milan Jovanovic

Microsoft MVP

View case study
Icon Quote related to What Does Rotation and Opacity Produce?

IronOCR means we can save $40,000 annually from manual processing, while enhancing productivity and freeing up resources for high-impact tasks. I would highly recommend it.

Brent Matzelle related to What Does Rotation and Opacity Produce?

Brent Matzelle

Chief Technology Officer, OPYN

View case study
Icon Quote related to What Does Rotation and Opacity Produce?

The IronSuite play a crucial role in our operations. These are tools that increase efficiencies across the business including creating floor plans and improving inventory management.

David Jones related to What Does Rotation and Opacity Produce?

David Jones

Lead Software Engineer, Agorus Build

View case study

How Do I Position My Watermark on the PDF?

IronPDF places watermarks on a 3x3 grid: three horizontal columns (left, center, right) and three vertical rows (top, middle, bottom), giving nine positions per page. Select a spot with the VerticalAlignment and HorizontalAlignment enums from the IronPdf.Editing namespace. The image below maps each enum pair to its position.

IronPDF watermark alignment grid showing 9 positioning options with vertical and horizontal alignment properties

These are the same enums used by the stamp text and image feature, so positioning behaves consistently across both.

Which Alignment Enums Position the Watermark?

:path=/static-assets/pdf/content-code-examples/how-to/custom-watermark-apply-watermark-top-right.cs
using IronPdf;
using IronPdf.Editing;

string watermarkHtml = @"
<img style='width: 200px;' src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>
<h1>Iron Software</h1>";

ChromePdfRenderer renderer = new ChromePdfRenderer();

PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Watermark</h1>");

// Apply watermark on the top-right of the document
pdf.ApplyWatermark(watermarkHtml, 50, VerticalAlignment.Top, HorizontalAlignment.Right);

pdf.SaveAs("watermarkLocation.pdf");
Imports IronPdf
Imports IronPdf.Editing

Private watermarkHtml As String = "
<img style='width: 200px;' src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>
<h1>Iron Software</h1>"

Private renderer As New ChromePdfRenderer()

Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Watermark</h1>")

' Apply watermark on the top-right of the document
pdf.ApplyWatermark(watermarkHtml, 50, VerticalAlignment.Top, HorizontalAlignment.Right)

pdf.SaveAs("watermarkLocation.pdf")
$vbLabelText   $csharpLabel

This call passes an opacity value followed by VerticalAlignment.Top and HorizontalAlignment.Right, anchoring the mark to the top-right corner. Swap the enum values to move the watermark to any of the nine grid positions.

What Does the Positioned Watermark Look Like?

Conclusion

You have applied text and image watermarks with ApplyWatermark, tuned their opacity and rotation, and anchored them with the VerticalAlignment / HorizontalAlignment grid. When a single mark is not enough, the same alignment enums drive the stamp text and image feature for per-region overlays and full-page layers.

Frequently Asked Questions

How do I add a watermark to a PDF in C#?

You can add a watermark to a PDF using IronPDF's ApplyWatermark method with just one line of code. Load your PDF document and call ApplyWatermark with an HTML string, an opacity value, and a VerticalAlignment / HorizontalAlignment pair: IronPdf.PdfDocument.FromFile("input.pdf").ApplyWatermark("

Confidential

", 50, IronPdf.Editing.VerticalAlignment.Top, IronPdf.Editing.HorizontalAlignment.Center).SaveAs("output.pdf");

What types of watermarks can I add to my PDF?

IronPDF supports both text and image watermarks. You can use any HTML content as a watermark, including text with custom fonts, images in various formats (PNG, JPG), and even complex layouts with full CSS styling. The watermark appears behind the main content to ensure document readability.

Can I customize the position of my watermark?

Yes, IronPDF uses a simple 3x3 grid for watermark positioning. Select a spot with the VerticalAlignment (Top, Middle, Bottom) and HorizontalAlignment (Left, Center, Right) enums from the IronPdf.Editing namespace, giving nine standard positions on the page. The alignment pair is passed as arguments to the ApplyWatermark method.

How do I adjust watermark opacity and rotation?

IronPDF applies watermarks with a default opacity of 50%, but you can customize this using the opacity parameter. The ApplyWatermark method includes an overload that accepts both rotation and opacity parameters, allowing you to create semi-transparent or rotated watermarks for enhanced visual effects.

Can I apply different watermarks to specific pages?

Currently, IronPDF applies watermarks to all pages in a PDF document. Page-specific watermarks are not supported. When you use the ApplyWatermark method, the watermark will appear on every page of your PDF.

What HTML and CSS features are supported in watermarks?

IronPDF's watermark feature supports all standard HTML elements and CSS styling. This includes custom fonts, colors, web fonts, icons, and complex layouts. You can create watermarks that match your branding requirements using standard HTML and CSS.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More
Ready to Get Started?
Nuget Downloads 19,570,275 | Version: 2026.6 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast? PM > Install-Package IronPdf
run a sample watch your HTML become a PDF.