GroupDocsGists
10/24/2017 - 5:11 PM

AnnotationExamples-Annotations-AddTextAnnotationInImages.cs

// For complete examples and data files, please go to https://github.com/atirtahirgroupdocs/GroupDocs.Search-for-.NET
// Get input file stream
Stream inputFile = new FileStream(CommonUtilities.MapSourceFilePath(filePath), FileMode.Open, FileAccess.ReadWrite);

// Initialize list of AnnotationInfo
List<AnnotationInfo> annotations = new List<AnnotationInfo>();

// Initialize text annotation.
AnnotationInfo textAnnotation = new AnnotationInfo
{
    PageNumber = 0,
    AnnotationPosition = new Point(1, 2),
    FieldText = "Hello!",
    CreatorName = "John"
};

// Add annotation to list
annotations.Add(textAnnotation);

// Export annotation and save output file
CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Images);