GroupDocsGists
10/24/2017 - 5:13 PM

AddTextFieldAnnotationforwords.cs

// For complete examples and data files, please go to https://github.com/groupdocsannotation/GroupDocs_Annotation_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>();

// Text field annotation
AnnotationInfo textFieldAnnotationforwords = new AnnotationInfo
{
    AnnotationPosition = new Point(852.0, 201.0),
    FieldText = "text in the box",
    FontFamily = "Arial",
    FontSize = 10,
    Box = new Rectangle(66f, 201f, 64f, 37f),
    PageNumber = 0,
    Type = AnnotationType.TextField,
    CreatorName = "Anonym A."
};
// Add annotation to list
annotations.Add(textFieldAnnotationforwords);

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