__init__ constructor

init

Initializes a new instance of the RedactorSettings class.

def __init__(self):
    ...

Example

from groupdocs.redaction import Redactor
from groupdocs.redaction.redactions import ExactPhraseRedaction, ReplacementOptions
from groupdocs.redaction.options import RedactorSettings

def accept(description):
    # description.original_text, .redaction_type, .action_type
    return "keep-me" not in (description.original_text or "")

with Redactor("document.docx", RedactorSettings(callback=accept)) as redactor:
    redactor.apply(ExactPhraseRedaction("secret", ReplacementOptions("[X]")))
    redactor.save()

init

Initializes a new RedactorSettings instance with a given ILogger instance.

def __init__(self, logger):
    ...
Parameter Type Description
logger ILogger An instance of a class implementing the ILogger interface.

init

Initializes a new instance of the RedactorSettings class with a given IRedactionCallback instance.

def __init__(self, callback):
    ...
Parameter Type Description
callback IRedactionCallback An instance of a class implementing IRedactionCallback interface.

Example

from groupdocs.redaction import Redactor
from groupdocs.redaction.redactions import ExactPhraseRedaction, ReplacementOptions
from groupdocs.redaction.options import LoadOptions, RedactorSettings

def accept(description):
    # description.original_text, .redaction_type, .action_type
    return "keep-me" not in (description.original_text or "")

with Redactor("document.docx", LoadOptions(), RedactorSettings(callback=accept)) as redactor:
    redactor.apply(ExactPhraseRedaction("secret", ReplacementOptions("[X]")))
    redactor.save()

init

Initializes a new RedactorSettings instance with the specified IOcrConnector.

def __init__(self, ocr_connector):
    ...
Parameter Type Description
ocr_connector IOcrConnector A valid implementation of IOcrConnector interface.

init

Initializes a new RedactorSettings instance with the specified logger and callback.

def __init__(self, logger, callback):
    ...
Parameter Type Description
logger ILogger An instance of a class implementing the ILogger interface.
callback IRedactionCallback An instance of a class implementing the IRedactionCallback interface.

Example

from groupdocs.redaction.options import RedactorSettings

def accept(description):
    # description.original_text, .redaction_type, .action_type
    return "keep-me" not in (description.original_text or "")

settings = RedactorSettings(callback=accept)

init

Initializes a new instance of the RedactorSettings class with given ILogger, IRedactionCallback and IOcrConnector instances.

def __init__(self, logger, callback, ocr_connector):
    ...
Parameter Type Description
logger ILogger An instance of a class implementing ILogger interface.
callback IRedactionCallback An instance of a class implementing IRedactionCallback interface.
ocr_connector IOcrConnector An instance of IOcrConnector interface implementation. Can be None.

Example

from groupdocs.redaction.options import RedactorSettings

def accept(description):
    # description.original_text, .redaction_type, .action_type
    return "keep-me" not in (description.original_text or "")

settings = RedactorSettings(callback=accept)

See Also