GroupDocs.Annotation provides an ability to extract annotations from document and serializing to XML format. To achieve this you should:
Instantiate Annotator object with input document path or stream;
Instantiate LoadOptions object and set ImportAnnotation = true;
Define variable with type List;
Call Get method and return result to variable above;
Instantiate XmlSerializer object with type List;
Using FileStreamobject, serialize annotations to the file as on example below;
The following code demonstrates how to extract annotation metadata from document:
// for using this example input file ("annotated.pdf") must be with annotationsusing(Annotatorannotator=newAnnotator("annotated.pdf")){List<AnnotationBase>annotations=annotator.Get();XmlSerializerformatter=newXmlSerializer(typeof(List<AnnotationBase>));using(FileStreamfs=newFileStream("annotations.xml",FileMode.Create)){fs.SetLength(0);formatter.Serialize(fs,annotations);}}
More resources
Advanced Usage Topics
To learn more about document annotating features, please refer to the advanced usage section.
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
Along with full-featured .NET library we provide simple but powerful free Apps.
You are welcome to annotate your PDF, DOC or DOCX, XLS or XLSX, PPT or PPTX, PNG and other documents with free to use online GroupDocs Annotation App.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.