GroupDocsGists
10/24/2017 - 5:12 PM

AddWatermarkAnnotationImages.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>();

// Watermark annotation
AnnotationInfo watermarkAnnotation = new AnnotationInfo
{
    AnnotationPosition = new Point(100.0, 300.0),
    FieldText = "TEXT STAMP",
    FontFamily = "Microsoft Sans Serif",
    FontSize = 10,
    FontColor = 2222222,
    Box = new Rectangle(430f, 272f, 66f, 51f),
    PageNumber = 0,
    Type = AnnotationType.Watermark,
    CreatorName = "Anonym A."
};
// Add annotation to list
annotations.Add(watermarkAnnotation);
                
// Export annotation and save output file
CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Images);