Watermarking

IronPDF for Python provides a simple one-line ApplyWatermark method to overlay styled HTML text — such as "DRAFT" or "CONFIDENTIAL" — onto every page of a PDF document.

Getting Started

Load or render a PdfDocument, then call ApplyWatermark with your watermark HTML, rotation angle, and alignment parameters. The watermark is applied to all pages in a single call.

Understanding the Code

  • ApplyWatermark(html, rotation, verticalAlignment, horizontalAlignment): Stamps the provided HTML as a semi-transparent watermark on every page of the document.
    • html: An HTML string that defines the watermark appearance. Inline styles such as color and font-size are fully supported.
    • rotation: Angle in degrees to rotate the watermark text. 30 produces a diagonal watermark.
    • verticalAlignment: Vertical position of the watermark on the page (Top, Middle, Bottom).
    • horizontalAlignment: Horizontal position (Left, Center, Right).
  • SaveAs("Watermarked.pdf"): Saves the watermarked document to disk.

Customizing the Watermark

Any valid HTML can be used as the watermark content. Use inline CSS to control font size, color, opacity, and other visual properties. For a subtle background watermark, wrap the HTML in a <div> with a low opacity style value.

Learn to stamp and watermark PDFs with IronPDF for Python!

Ready to Get Started?
Version: 2026.6 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast?
run a sample watch your HTML become a PDF.