Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active June 19, 2019 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/1ef15f1094a8064f52832fd8bc439b8f to your computer and use it in GitHub Desktop.
Save GroupDocsGists/1ef15f1094a8064f52832fd8bc439b8f to your computer and use it in GitHub Desktop.
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
using (WordsDocument doc = Document.Load<WordsDocument>(@"D:\test.docx"))
{
TextWatermark watermark = new TextWatermark("Test watermark", new Font("Arial", 19));
WordsShapeSettings shapeSettings = new WordsShapeSettings();
//Some settings for watermark
watermark.VerticalAlignment = VerticalAlignment.Center;
watermark.HorizontalAlignment = HorizontalAlignment.Center;
watermark.RotateAngle = 25.0;
watermark.ForegroundColor = Color.Red;
watermark.Opacity = 1.0;
// Set the shape name
shapeSettings.Name = "Shape 1";
// Set the descriptive (alternative) text that will be associated with the shape
shapeSettings.AlternativeText = "Test watermark";
doc.AddWatermark(watermark, shapeSettings);
doc.Save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment