Namespace IronPdf.Editing
Classes
BarcodeEncoding
PDF Barcode Encoding Types. Please check the supported characters for each encoding type as some do not support all symbols.
Setting a BarcodeEncoding when rendering Barcodes chooses the type and design of barcode to be generated.
// Add product barcode:
var barcode = new BarcodeStamper("ABC123456", BarcodeEncoding.Code128);
pdf.ApplyStamp(barcode);
// Add QR code for URL:
var qr = new BarcodeStamper("https://example.com", BarcodeEncoding.QRCode);
pdf.ApplyStamp(qr);
// Add inventory code:
var code39 = new BarcodeStamper("ITEM-12345", BarcodeEncoding.Code39);
pdf.ApplyStamp(code39);
See: https://ironpdf.com/how-to/add-barcodes-to-pdfs/
BarcodeStamper
Stamps barcodes and QR codes onto PDF pages for tracking, URLs, and data encoding. Supports Code128, Code39, and QR Code formats with customizable dimensions.
Example - Add barcodes to PDFs:
var pdf = PdfDocument.FromFile("invoice.pdf");
// QR code for payment URL (top-right corner):
var paymentQR = new BarcodeStamper(
"https://pay.example.com/inv-12345",
BarcodeEncoding.QRCode)
{
Width = 100,
Height = 100,
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Top,
VerticalOffset = new Length(20, MeasurementUnit.Pixel)
};
pdf.ApplyStamp(paymentQR);
// Product barcode (bottom of page):
var productCode = new BarcodeStamper(
"SKU-2024-0012345",
BarcodeEncoding.Code128)
{
Width = 200,
Height = 50,
VerticalAlignment = VerticalAlignment.Bottom
};
pdf.ApplyStamp(productCode);
pdf.SaveAs("invoice_with_barcodes.pdf");
HorizontalAlignment
The horizontal alignment relative to the page.
HtmlStamper
Stamps rich HTML content onto PDF pages with full CSS/JavaScript support. Enables complex layouts, images, tables, and dynamic content for advanced stamping.
// Simple HTML watermark:
var watermark = new HtmlStamper(@"
<div style='opacity:0.3; font-size:72px; color:red;
transform:rotate(-45deg)'>
CONFIDENTIAL
</div>");
pdf.ApplyStamp(watermark);
// Complex footer with table:
var footer = new HtmlStamper(@"
<table style='width:100%'>
<tr>
<td>{date}</td>
<td style='text-align:center'>Page {page}</td>
<td style='text-align:right'>© 2024</td>
</tr>
</table>");
pdf.ApplyStamp(footer);
// Logo with external image:
var logo = new HtmlStamper(
"<img src='logo.png' width='100'/>",
@"C:\images\"); // Base URL for resources
pdf.ApplyStamp(logo);Supports full HTML5/CSS3/JavaScript rendering
External resources require HtmlBaseUrl to be set
See: https://ironpdf.com/how-to/stamping/#html-stamper
ImageStamper
Stamps images onto PDF pages for logos, signatures, watermarks, and visual elements. Supports various image formats and flexible positioning/sizing options.
// Company logo:
var logo = new ImageStamper("logo.png") {
Width = new Length(100, MeasurementUnit.Pixel),
Height = new Length(50, MeasurementUnit.Pixel),
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Top
};
pdf.ApplyStamp(logo);
// Signature on last page:
var signature = new ImageStamper("signature.jpg") {
HorizontalOffset = new Length(400, MeasurementUnit.Pixel),
VerticalOffset = new Length(100, MeasurementUnit.Pixel)
};
pdf.ApplyStamp(signature, pdf.PageCount - 1);
// Semi-transparent watermark:
var watermark = new ImageStamper("watermark.png") {
Opacity = 30,
Layer = StampLayer.BehindExistingPDFContent,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Middle
};
pdf.ApplyStamp(watermark);
// From bitmap (requires disposal):
using (var stamper = new ImageStamper(myBitmap)) {
pdf.ApplyStamp(stamper);
}Supports PNG, JPG, GIF, BMP, TIFF, WEBP formats
Always dispose when using AnyBitmap constructor
See: https://ironpdf.com/how-to/stamping/#image-stamper
Length
Represents a value with a specific measurement unit.
MeasurementUnit
The unit of measurement used for positioning and sizing.
Stamper
Defines a PDF Stamper.
To see a full class walkthrough with diagrams and examples visit: https://ironpdf.com/tutorials/csharp-edit-pdf-complete-tutorial/#stamping-and-watermarking
StampLayer
Controls whether stamps appear above or below existing PDF content. Essential for watermarks, backgrounds, and overlay positioning.
// Watermark behind content (won't obscure text):
var watermark = new TextStamper("CONFIDENTIAL") {
Layer = StampLayer.BehindExistingPDFContent,
Opacity = 30
};
pdf.ApplyStamp(watermark);
// Annotation on top (covers content):
var stamp = new HtmlStamper("<div>APPROVED</div>") {
Layer = StampLayer.OnTopOfExistingPDFContent
};
pdf.ApplyStamp(stamp);Behind = watermarks, On top = annotations/signatures
See: https://ironpdf.com/how-to/stamping/
TextStamper
Stamps text content onto PDF pages with full styling control. Perfect for watermarks, page numbers, annotations, and dynamic text overlay.
// Simple watermark:
var watermark = new TextStamper("CONFIDENTIAL") {
FontSize = 60,
Color = Color.Red,
Opacity = 30,
Rotation = -45,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Middle
};
pdf.ApplyStamp(watermark);
// Page numbers:
var pageNum = new TextStamper("Page {page} of {total-pages}") {
FontFamily = "Arial",
FontSize = 10,
VerticalAlignment = VerticalAlignment.Bottom
};
pdf.ApplyStamp(pageNum);
// Bold approval stamp:
var approved = new TextStamper("APPROVED") {
IsBold = true,
FontSize = 48,
Color = Color.Green,
BackgroundColor = Color.LightYellow
};
pdf.ApplyStamp(approved, 0); // First page onlySupports {page} and {total-pages} merge fields
Google Fonts require UseGoogleFont = true
See: https://ironpdf.com/how-to/stamping/#text-stamper
VerticalAlignment
The vertical alignment relative to the page.