RedactorSettings class
Leave feedback
On this page
Represents redaction settings, allowing to customize the redaction process.
Learn more
- More details about implementing ILogger interface: https://docs.groupdocs.com/redaction/python-net/use-advanced-logging/
- More details about implementing IRedactionCallback interface: https://docs.groupdocs.com/redaction/python-net/use-redaction-callback/
The RedactorSettings type exposes the following members:
| Constructor | Description |
|---|---|
| init | Initializes a new instance of the RedactorSettings class. |
| init | Initializes a new RedactorSettings instance with the specified logger. |
| init | Initializes a new RedactorSettings instance with a given IRedactionCallback implementation. |
| init | Initializes a new RedactorSettings instance with the specified IOcrConnector. |
| init | Initializes a new instance of the RedactorSettings class with given ILogger and IRedactionCallback instances. |
| init | Initializes a new RedactorSettings instance with optional logger, callback, and OCR connector. |
| Property | Description |
|---|---|
| logger | The logger used for logging events and errors. It must implement ILogger. |
| ocr_connector | The OCR connector used to recognize text in images, which must implement IOcrConnector. |
| redaction_callback | The redaction callback that implements IRedactionCallback and is invoked for each redaction. |
from groupdocs.redaction import Redactor
from groupdocs.redaction.options import LoadOptions, RedactorSettings
from groupdocs.redaction.redactions import ExactPhraseRedaction, ReplacementOptions
class RedactionDump:
def accept_redaction(self, description):
print(f"{description.redaction_type.name} redaction, {description.action_type.name} action, item {description.original_text}.")
if description.replacement is not None:
print(f"Text {description.replacement.original_text} is replaced with {description.replacement.replacement}.")
return True
settings = RedactorSettings(RedactionDump())
with Redactor("./sample.docx", LoadOptions(), settings) as redactor:
redactor.apply(ExactPhraseRedaction("Emily Johnson", ReplacementOptions("[personal]")))
result_path = redactor.save()
print("Document redacted. Output saved to", result_path)
Task guides that use RedactorSettings:
- module
groupdocs.redaction.options
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.