Stamping adds text, images, or HTML overlays to existing PDFs. It's how you apply watermarks, add signatures, place logos, or mark documents as "CONFIDENTIAL" or "APPROVED."
using IronPdf;
using IronPdf.Stamps;
// Install via NuGet: Install-Package IronPdf
var pdf = PdfDocument.FromFile("document.pdf");
var stamp = new TextStamper
{
Text = "CONFIDENTIAL",
FontSize = 48,
Opacity = 30,
Rotation = -45
};
pdf.ApplyStamp(stamp);
pdf.SaveAs("watermarked.pdf");
IronPDF provides four stamper types: TextStamper, ImageStamper, HtmlStamper, and BarcodeStamper.
What Stamper Types Are Available?
| Stamper | Use Case |
|---|---|
| TextStamper | Simple text watermarks, labels |
| ImageStamper | Logos, signatures, approval stamps |
| HtmlStamper | Complex layouts with CSS styling |
| BarcodeStamper | QR codes, barcodes |
Each stamper supports positioning, opacity, rotation, and page selection.
How Do I Add a Text Watermark?
Classic diagonal watermark across the page:
using IronPdf;
using IronPdf.Stamps;
// Install via NuGet: Install-Package IronPdf
var pdf = PdfDocument.FromFile("contract.pdf");
var watermark = new TextStamper
{
Text = "DRAFT",
FontFamily = "Arial",
FontSize = 72,
IsBold = true,
Opacity = 25,
Rotation = -45,
FontColor = Color.Red,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Middle
};
pdf.ApplyStamp(watermark);
pdf.SaveAs("draft-contract.pdf");
The rotation and low opacity create a subtle but visible watermark.
How Do I Stamp an Image?
Add logos, signatures, or approval stamps:
using IronPdf;
using IronPdf.Stamps;
// Install via NuGet: Install-Package IronPdf
var pdf = PdfDocument.FromFile("report.pdf");
var logo = new ImageStamper("company-logo.png")
{
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Top,
HorizontalOffset = new Length(-20, MeasurementUnit.Pixels),
VerticalOffset = new Length(-20, MeasurementUnit.Pixels),
Scale = 50 // 50% of original size
};
pdf.ApplyStamp(logo);
pdf.SaveAs("branded-report.pdf");
Negative offsets pull the stamp inward from the edge.
How Do I Position Stamps Precisely?
Control placement with alignment and offsets:
using IronPdf;
using IronPdf.Stamps;
// Install via NuGet: Install-Package IronPdf
var pdf = PdfDocument.FromFile("document.pdf");
// Top-left corner
var topLeft = new TextStamper
{
Text = "Page Header",
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
HorizontalOffset = new Length(20),
VerticalOffset = new Length(20)
};
// Bottom-right corner
var bottomRight = new TextStamper
{
Text = "Footer Text",
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalOffset = new Length(-20),
VerticalOffset = new Length(-20)
};
// Centered
var center = new TextStamper
{
Text = "CONFIDENTIAL",
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Middle,
Opacity = 20,
Rotation = -45
};
pdf.ApplyStamp(topLeft);
pdf.ApplyStamp(bottomRight);
pdf.ApplyStamp(center);
pdf.SaveAs("multi-stamp.pdf");
How Do I Use HTML for Complex Stamps?
HtmlStamper renders full HTML with CSS:
using IronPdf;
using IronPdf.Stamps;
// Install via NuGet: Install-Package IronPdf
var pdf = PdfDocument.FromFile("invoice.pdf");
var htmlStamp = new HtmlStamper
{
Html = @"
<div style='
background: rgba(0,0,0,0.1);
padding: 10px 20px;
border-radius: 5px;
font-family: Arial;
'>
<strong>PAID</strong><br/>
<small>2024-01-15</small>
</div>",
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Top,
HorizontalOffset = new Length(-30),
VerticalOffset = new Length(-30)
};
pdf.ApplyStamp(htmlStamp);
pdf.SaveAs("paid-invoice.pdf");
HTML stamps support images, custom fonts, and complex layouts.
How Do I Add Barcodes or QR Codes?
Stamp scannable codes onto documents:
using IronPdf;
using IronPdf.Stamps;
// Install via NuGet: Install-Package IronPdf
var pdf = PdfDocument.FromFile("document.pdf");
var qrStamp = new BarcodeStamper("https://example.com/verify/12345")
{
BarcodeType = BarcodeType.QRCode,
Width = 100,
Height = 100,
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalOffset = new Length(-20),
VerticalOffset = new Length(-20)
};
pdf.ApplyStamp(qrStamp);
pdf.SaveAs("document-with-qr.pdf");
QR codes can link to verification pages or contain document metadata.
How Do I Stamp Specific Pages?
Apply stamps to selected pages only:
using IronPdf;
using IronPdf.Stamps;
// Install via NuGet: Install-Package IronPdf
var pdf = PdfDocument.FromFile("multipage.pdf");
var stamp = new TextStamper
{
Text = "APPROVED",
FontSize = 36,
FontColor = Color.Green,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Top
};
// First page only
pdf.ApplyStamp(stamp, 0);
// Or specific pages (0-indexed)
pdf.ApplyStamp(stamp, new[] { 0, 2, 4 });
// Or a range
pdf.ApplyStamp(stamp, Enumerable.Range(0, 5).ToArray());
pdf.SaveAs("partially-approved.pdf");
How Do I Apply Multiple Stamps?
Combine different stamps on the same document:
using IronPdf;
using IronPdf.Stamps;
// Install via NuGet: Install-Package IronPdf
var pdf = PdfDocument.FromFile("document.pdf");
// Company logo in header
var logo = new ImageStamper("logo.png")
{
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Scale = 30
};
// Confidentiality watermark
var watermark = new TextStamper
{
Text = "CONFIDENTIAL",
FontSize = 60,
Opacity = 15,
Rotation = -45,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Middle
};
// Page number footer
var pageNum = new HtmlStamper
{
Html = "<div style='text-align:center; font-size:10px;'>Page {page}</div>",
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalAlignment = HorizontalAlignment.Center
};
pdf.ApplyStamp(logo);
pdf.ApplyStamp(watermark);
pdf.ApplyStamp(pageNum);
pdf.SaveAs("branded-confidential.pdf");
How Do I Control Stamp Opacity?
Set transparency for subtle watermarks:
using IronPdf;
using IronPdf.Stamps;
// Install via NuGet: Install-Package IronPdf
var pdf = PdfDocument.FromFile("document.pdf");
// Very subtle (barely visible)
var subtle = new TextStamper
{
Text = "SAMPLE",
Opacity = 10,
FontSize = 100,
Rotation = -45
};
// Medium visibility
var medium = new TextStamper
{
Text = "DRAFT",
Opacity = 40,
FontSize = 100,
Rotation = -45
};
// Bold watermark
var bold = new TextStamper
{
Text = "VOID",
Opacity = 70,
FontSize = 100,
FontColor = Color.Red,
Rotation = -45
};
Opacity ranges from 0 (invisible) to 100 (fully opaque).
How Do I Create Signature Stamps?
Add signature images to documents:
using IronPdf;
using IronPdf.Stamps;
// Install via NuGet: Install-Package IronPdf
public void AddSignature(string pdfPath, string signaturePath,
string signerName, DateTime signDate)
{
var pdf = PdfDocument.FromFile(pdfPath);
int lastPage = pdf.PageCount - 1;
// Signature image
var signature = new ImageStamper(signaturePath)
{
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalOffset = new Length(100),
VerticalOffset = new Length(100),
Scale = 40
};
// Signature text
var signatureText = new HtmlStamper
{
Html = $@"
<div style='font-family: Arial; font-size: 10px;'>
<hr style='width: 150px; margin-left: 0;'/>
<strong>{signerName}</strong><br/>
Date: {signDate:yyyy-MM-dd}
</div>",
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalOffset = new Length(100),
VerticalOffset = new Length(50)
};
pdf.ApplyStamp(signature, lastPage);
pdf.ApplyStamp(signatureText, lastPage);
pdf.SaveAs(pdfPath.Replace(".pdf", "-signed.pdf"));
}
How Do I Create "COPY" or "ORIGINAL" Stamps?
Mark document copies:
using IronPdf;
using IronPdf.Stamps;
// Install via NuGet: Install-Package IronPdf
public void MarkAsCopy(PdfDocument pdf)
{
var copyStamp = new HtmlStamper
{
Html = @"
<div style='
border: 3px solid red;
color: red;
padding: 5px 15px;
font-size: 24px;
font-family: Arial;
font-weight: bold;
transform: rotate(-15deg);
'>
COPY
</div>",
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Top,
HorizontalOffset = new Length(-50),
VerticalOffset = new Length(-50)
};
pdf.ApplyStamp(copyStamp);
}
public void MarkAsOriginal(PdfDocument pdf)
{
var originalStamp = new HtmlStamper
{
Html = @"
<div style='
border: 3px solid green;
color: green;
padding: 5px 15px;
font-size: 24px;
font-family: Arial;
font-weight: bold;
'>
ORIGINAL
</div>",
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Top,
HorizontalOffset = new Length(-50),
VerticalOffset = new Length(-50)
};
pdf.ApplyStamp(originalStamp);
}
How Do I Batch Stamp Multiple Documents?
Process entire folders:
using IronPdf;
using IronPdf.Stamps;
// Install via NuGet: Install-Package IronPdf
public void BatchWatermark(string inputFolder, string outputFolder, string watermarkText)
{
var stamp = new TextStamper
{
Text = watermarkText,
FontSize = 60,
Opacity = 20,
Rotation = -45,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Middle
};
var files = Directory.GetFiles(inputFolder, "*.pdf");
foreach (var file in files)
{
var pdf = PdfDocument.FromFile(file);
pdf.ApplyStamp(stamp);
var outputPath = Path.Combine(outputFolder, Path.GetFileName(file));
pdf.SaveAs(outputPath);
pdf.Dispose();
Console.WriteLine($"Watermarked: {Path.GetFileName(file)}");
}
}
Quick Reference
| Stamper | Key Properties |
|---|---|
| TextStamper |
Text, FontFamily, FontSize, FontColor, IsBold
|
| ImageStamper | Image path in constructor, Scale
|
| HtmlStamper | Html |
| BarcodeStamper | Value in constructor, BarcodeType, Width, Height
|
| Common Property | Purpose |
|---|---|
HorizontalAlignment |
Left, Center, Right |
VerticalAlignment |
Top, Middle, Bottom |
HorizontalOffset |
X offset from alignment |
VerticalOffset |
Y offset from alignment |
Opacity |
0-100 transparency |
Rotation |
Degrees (negative = counter-clockwise) |
Stamps are non-destructive—they overlay content without modifying the original PDF structure. Perfect for adding branding, watermarks, and approval markers.
For more stamping options, see the IronPDF stamp documentation.
Written by Jacob Mellor, CTO at Iron Software. Jacob created IronPDF and leads a team of 50+ engineers building .NET document processing libraries.
Top comments (0)