// For complete examples and data files, please go to https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-.NET
// Create instance of annotator.
AnnotationConfig cfg = CommonUtilities.GetConfiguration();
AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);
// Get file stream
Stream manifestResourceStream = new FileStream(CommonUtilities.MapSourceFilePath(filePath), FileMode.Open, FileAccess.ReadWrite);
List<AnnotationInfo> annotations = new List<AnnotationInfo>();
Stream stream = annotator.ExportAnnotationsToDocument(manifestResourceStream,annotations, DocumentType.Pdf);
// Save result stream to file.
using (FileStream fileStream = new FileStream(CommonUtilities.MapDestinationFilePath("Annotated.pdf"), FileMode.Create))
{
byte[] buffer = new byte[stream.Length];
stream.Seek(0, SeekOrigin.Begin);
stream.Read(buffer, 0, buffer.Length);
fileStream.Write(buffer, 0, buffer.Length);
fileStream.Close();
}