usmanazizgroupdocs
3/15/2016 - 3:09 PM

AddTextReplacementAnnotation.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 replacement annotation
AnnotationInfo textReplacementAnnotation = new AnnotationInfo
{
    Box = new Rectangle((float)101.76, (float)826.73, (float)229, 27),
    PageNumber = 1,
    SvgPath = "[{\"x\":101.76,\"y\":264.69},{\"x\":331,\"y\":264.69},{\"x\":101.76,\"y\":243.06},{\"x\":331,\"y\":243}]",
    Type = AnnotationType.TextReplacement,
    CreatorName = "Anonym A.",
    FieldText = "Replaced text",
    FontSize = 10
};
// Add annotation to list
annotations.Add(textReplacementAnnotation);
                
// Export annotation and save output file
CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Pdf);