protect method
Leave feedback
On this page
Protects the document from changes and sets a protection password.
To have the content of the document editable use appropriate method of adding watermark with WordProcessingLockType.allow_only_form_fields or WordProcessingLockType.read_only_with_editable_content parameter.
def protect(self, protection_type, password):
...
| Parameter | Type | Description |
|---|---|---|
| protection_type | WordProcessingProtectionType |
Specifies the protection type for the document. |
| password | str |
The password to protect the document with. |
import groupdocs.watermark as gw
import groupdocs.watermark.contents.wordprocessing as gwc_wp
load_options = gw.WordProcessingLoadOptions()
with gw.Watermarker("document.docx", load_options) as watermarker:
content = watermarker.get_content(gwc_wp.WordProcessingContent)
content.protect(gwc_wp.WordProcessingProtectionType.READ_ONLY, "7654321")
watermarker.save("document.docx")
- class
WordProcessingContent
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.