IRONSOFTWAREHOME
Watermarking
from ironpdf import *

# Instantiate the Renderer and create PdfDocument from URL
renderer = ChromePdfRenderer()
pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")
 
# Apply watermark
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, VerticalAlignment.Middle, HorizontalAlignment.Center)
 
# Save your new PDF
pdf.SaveAs("Watermarked.pdf")
pip install ironpdf
Watermarking

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.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required