Extract annotations from document

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Annotation MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-annotation -- dnx GroupDocs.Annotation.Mcp --yes
Folders, licensing and more →

On this page

GroupDocs.Annotation allows you to extract annotations from a document and serialize them to the XML format.

To do this, follow these steps:

  1. Instantiate the Annotator class. Specify the input document path or stream.
  2. Instantiate the LoadOptions class and set ImportAnnotation = true.
  3. Define a variable of the List<AnnotationBase> type.
  4. Call the get() method to get result to variable defined on the previous step.
  5. Instantiate the XmlSerializer class with the List<AnnotationBase> type.
  6. Using FileStream object, serialize annotations to the file.

The following code snippet shows how to extract annotations from a document:

// for using this example input file ("annotated.pdf") must have annotations
LoadOptions loadOptions = new LoadOptions();

// Create an instance of Annotator class
Annotator annotator = new Annotator("annotated.pdf", loadOptions);

// Get all annotations
List<AnnotationBase> annotations = annotator.get();

On this page