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 ascolorandfont-sizeare fully supported.rotation: Angle in degrees to rotate the watermark text.30produces 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.






