// 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);
IDocumentDataHandler documentRepository = annotator.GetDocumentDataHandler();
if (!Directory.Exists(cfg.StoragePath))
{
Directory.CreateDirectory(cfg.StoragePath);
}
Stream result = annotator.ExportAnnotationsToDocument(inputFile, annotations, DocumentType.Pdf);
// Save result stream to file.
using (FileStream fileStream = new FileStream(MapDestinationFilePath("Annotated.pdf"), FileMode.Create))
{
byte[] buffer = new byte[result.Length];
result.Seek(0, SeekOrigin.Begin);
result.Read(buffer, 0, buffer.Length);
fileStream.Write(buffer, 0, buffer.Length);
fileStream.Close();
}