Documents often carry annotations: comments, sticky notes and other markup that reviewers add on top of the content. GroupDocs.Parser reads them with the get_annotations method and returns a list of AnnotationItem objects.
Call
Returns
get_annotations()
The annotations of the whole document
get_annotations(page_index)
The annotations of one page (or slide); page indexes start at 0
Both return None if the document format does not support annotations, and an empty list if the document has none. Annotations are read from PDF, Word processing (DOC, DOCX, RTF) and PowerPoint (PPT, PPTX) documents; check parser.features.annotations when the format is not known in advance.
Prerequisites
GroupDocs.Parser for Python via .NET 26.10 or later installed
A document with comments or notes
Extract annotations from a document
Here are the steps to extract annotations from a document:
Instantiate the Parser object for the initial document;
Call the get_annotations method;
Iterate through the list and read each annotation’s value.
fromgroupdocs.parserimportParser# Create an instance of Parser classwithParser("./reviewed.pdf")asparser:# Extract annotations from the whole documentannotations=parser.get_annotations()ifannotationsisNone:print("Annotation extraction isn't supported for this format")else:# Print the text of each annotationforannotationinannotations:print(annotation.value)
The following sample file is used in this example: reviewed.pdf
Expected behavior: Prints the text of every annotation in the document, one per line: a reviewer’s note and the text of a link annotation for the sample.
Read who annotated, when and where
Each AnnotationItem also tells you who left the annotation, when, and on which page:
Property
Type
Description
value
str
The annotation’s text
annotation_type
str
The annotation type, for example Text for a note or Link for a link
page_index
int
Zero-based index of the page (or slide) the annotation is on
timestamp
datetime or None
When the annotation was created or last modified, as stored in the document (no time zone)
author_name
str
The author’s name; empty when the document does not record one
author_initials
str or None
The author’s initials, when the document records them
The following sample file is used in this example: reviewed.pdf
Expected behavior: For the sample, prints:
Type: Text
Author: Tomas Reyes
Initials: -
Created/modified: 2026-03-02 11:00:00
Page: 1
Content: Approve the hero crop before the print run.
Type: Link
Author: -
Initials: -
Created/modified: 2026-03-02 11:00:00
Page: 1
Content: Aurora Visuals portfolio
Check that the format supports annotations
Not every format can carry annotations. Check parser.features.annotations first, or test the result of get_annotations for None:
fromgroupdocs.parserimportParserwithParser("./sample.xlsx")asparser:# Check if the format supports annotations before extracting themifnotparser.features.annotations:print("Annotation extraction isn't supported for this format")else:annotations=parser.get_annotations()print("Found %d annotations"%len(annotations))
The following sample file is used in this example: sample.xlsx
Expected behavior: Prints Annotation extraction isn't supported for this format for a spreadsheet.
Export annotations to JSON
A review queue, an index or an AI agent usually wants annotations as data. Convert each item to a dictionary: