Extract annotations from document

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 FileStreamobject, serialize annotations to the file.

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

// This example demonstrates how to extract annotations.

LoadOptions tmp0 = new LoadOptions();

// Create an instance of Annotator class
Annotator annotator = new Annotator("InputPath", tmp0);

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

On this page