Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.