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 includeHelp,Note,Comment,Key, and others fromTextAnnotation.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: WhenFalse, the annotation is not included in printed output.Hidden: WhenFalse, the annotation is visible in the PDF viewer.OpenByDefault: WhenTrue, the annotation popup is open when the PDF is first viewed.ReadOnly: WhenFalse, users can edit the annotation in a PDF viewer.Rotatable: WhenTrue, the annotation can be rotated by the user.pdf.Annotations.Add(annotation): Adds the configured annotation to the document.






