Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GroupDocs.Watermark for .NET 18.6
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
using (WordsDocument doc = Document.Load<WordsDocument>(Utilities.MapSourceFilePath(FILE_PATH)))
{
TextWatermark watermark = new TextWatermark("Watermark text", new Font("Arial", 19));
watermark.ForegroundColor = Color.Red;
WordsShapeSettings settings = new WordsShapeSettings();
settings.IsLocked = true;
settings.LockType = WordsLockType.AllowOnlyFormFields;
// To protect with password
//settings.Password = "7654321";
doc.AddWatermark(watermark, settings);
doc.Save();
}
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
using (WordsDocument doc = Document.Load<WordsDocument>(Utilities.MapSourceFilePath(FILE_PATH)))
{
TextWatermark watermark = new TextWatermark("Watermark text", new Font("Arial", 19));
watermark.ForegroundColor = Color.Red;
WordsShapeSettings settings = new WordsShapeSettings();
settings.PageNumbers = new int[] { 1, 3 };
settings.IsLocked = true;
settings.LockType = WordsLockType.AllowOnlyComments;
// To protect with password
//settings.Password = "7654321";
doc.AddWatermark(watermark, settings);
doc.Save();
}
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
using (WordsDocument doc = Document.Load<WordsDocument>(Utilities.MapSourceFilePath(FILE_PATH)))
{
TextWatermark watermark = new TextWatermark("Watermark text", new Font("Arial", 19));
watermark.ForegroundColor = Color.Red;
WordsShapeSettings settings = new WordsShapeSettings();
settings.IsLocked = true;
settings.LockType = WordsLockType.ReadOnlyWithEditableContent;
// To protect with password
//settings.Password = "7654321";
doc.Sections[0].AddWatermark(watermark, settings);
doc.Save();
}
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
using (WordsDocument doc = Document.Load<WordsDocument>(Utilities.MapSourceFilePath(FILE_PATH)))
{
doc.Protect(WordsProtectionType.ReadOnly, "7654321");
doc.Save();
}
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
using (WordsDocument doc = Document.Load<WordsDocument>(Utilities.MapSourceFilePath(FILE_PATH)))
{
doc.Unprotect();
doc.Save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.