IRONSOFTWAREHOME
Annotations
from ironpdf import *

# Load an existing PDF or create a new one
pdf = PdfDocument("existing.pdf")

pageIndex = 0

# Create a TextAnnotation object
annotation = TextAnnotation(pageIndex)
annotation.Title = "This is the major title"
annotation.Subject = "This is a subtitle"
annotation.Contents = "This is the long 'sticky note' comment content..."
annotation.Icon = TextAnnotation.AnnotationIcon.Help
annotation.X = 150
annotation.Y = 200
annotation.Width = 200
annotation.Height = 50
annotation.Opacity = 0.9
annotation.Printable = False
annotation.Hidden = False
annotation.OpenByDefault = True
annotation.ReadOnly = False
annotation.Rotatable = True

# Add the annotation to a specific page and location within the PDF
pdf.Annotations.Add(annotation)

# Save the PDF
pdf.SaveAs("existing.pdf")
pip install ironpdf
Annotations

Annotations

IronPDF for Python can add interactive text annotations - also known as sticky notes - to PDF documents, allowing you to attach comments, review notes, or metadata to specific locations on a page.

Getting Started

Load or create a PdfDocument, instantiate a TextAnnotation with the target page index, configure its properties, add it to the document's Annotations collection, and save.

Understanding the Code

  • TextAnnotation(pageIndex): Creates a new annotation targeting the specified zero-based page index.
  • Title: The primary heading text of the annotation popup.
  • Subject: A subtitle or secondary heading for the annotation.
  • Contents: The body text of the annotation - the main comment or note content.
  • Icon: The visual icon displayed on the page. Options include Help, Note, Comment, Key, and others from TextAnnotation.AnnotationIcon.
  • X / Y: The position of the annotation anchor point on the page, in points.
  • Width / Height: The dimensions of the annotation popup box.
  • Opacity: A value from 0.0 to 1.0 controlling the transparency of the annotation.
  • Printable: When False, the annotation is not included in printed output.
  • Hidden: When False, the annotation is visible in the PDF viewer.
  • OpenByDefault: When True, the annotation popup is open when the PDF is first viewed.
  • ReadOnly: When False, users can edit the annotation in a PDF viewer.
  • Rotatable: When True, the annotation can be rotated by the user.
  • pdf.Annotations.Add(annotation): Adds the configured annotation to the document.

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