Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active November 2, 2019 14:02
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/e04a73ccf29f6bab61c59ffa5a8daeca to your computer and use it in GitHub Desktop.
Save GroupDocsGists/e04a73ccf29f6bab61c59ffa5a8daeca to your computer and use it in GitHub Desktop.
WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
using (Watermarker watermarker = new Watermarker("document.docx", loadOptions))
{
TextWatermark watermark = new TextWatermark("Watermark text", new Font("Arial", 19));
watermark.ForegroundColor = Color.Red;
WordProcessingWatermarkPagesOptions options = new WordProcessingWatermarkPagesOptions();
options.IsLocked = true;
options.LockType = WordProcessingLockType.AllowOnlyComments;
/*
options.LockType = WordProcessingLockType.AllowOnlyRevisions;
options.LockType = WordProcessingLockType.AllowOnlyFormFields;
options.LockType = WordProcessingLockType.ReadOnlyWithEditableContent;
options.LockType = WordProcessingLockType.ReadOnly;
*/
// To protect with password
//options.Password = "7654321";
watermarker.Add(watermark, options);
watermarker.Save("document_watermarked.docx");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment