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.6 just released
Still Scrolling Icon

Still Scrolling?

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