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.
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.
-
1Install IronPDF with NuGet Package Manager
-
2Copy 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");C# -
3Deploy to test on your live environment
Start using IronPDF in your project today with a free trial
Minimal Workflow (5 steps)
- Download the IronPDF Library from NuGet
- Render a new PDF or open an existing one
- Write the watermark as an HTML string
- Call the
ApplyWatermarkmethod - Adjust rotation, opacity, and alignment as needed
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?
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")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?
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")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?
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.
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.

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?
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")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 using IronPDF?
To add a watermark to a PDF with IronPDF, call the `ApplyWatermark` method on a `PdfDocument`. This method accepts an HTML string, which can include text, images, custom fonts, and CSS layout. The watermark can be positioned using a 3x3 alignment grid.
Can I use HTML to style my watermark in IronPDF?
Yes, you can use HTML to style your watermark in IronPDF. The `ApplyWatermark` method accepts an HTML string, allowing you to include images, text, colors, and CSS styles in your watermark.
How can I adjust the opacity of a watermark in IronPDF?
In IronPDF, you can adjust the opacity of a watermark by passing an opacity value (from 0 to 100) to the `ApplyWatermark` method. The default opacity is set to 50%.
Is it possible to rotate a watermark with IronPDF?
Yes, you can rotate a watermark in IronPDF. Pass a rotation angle (from 0 to 360 degrees) as an argument to the `ApplyWatermark` method. This helps in creating diagonal marks commonly used for confidential or draft documents.
How do I position a watermark on a PDF page using IronPDF?
IronPDF allows you to position a watermark on a PDF page using vertical and horizontal alignment enums. These are part of a 3x3 grid system with options such as `VerticalAlignment.Top` and `HorizontalAlignment.Center` to anchor the watermark in a specific position.
What types of content can I add to a watermark in IronPDF?
In IronPDF, you can include a variety of content in a watermark, such as images, text, web fonts, icons, and any HTML/CSS styling. This flexibility allows you to create rich and customized watermarks.
What does the default watermark opacity look like in IronPDF?
The default watermark opacity in IronPDF is set to 50%, which provides a balance between visibility and transparency, allowing the underlying document text to remain legible.
Are there specific examples of applying watermarks in IronPDF?
Yes, the provided examples in IronPDF documentation demonstrate applying watermarks with various adjustments, such as changing opacity, rotation, and positioning using the `ApplyWatermark` method.
Can I apply different watermarks to each page in a PDF using IronPDF?
Currently, the `ApplyWatermark` method in IronPDF applies the same watermark to all pages in the document. For unique marks on each page, additional logic would be needed.
Does IronPDF support remote images in watermarks?
Yes, IronPDF supports remote images in watermarks. You can specify URLs in the HTML string used in the `ApplyWatermark` method to include images hosted online.

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.