LoadOptions class

LoadOptions class

Provides options that will be used to open a file.

Learn more

The LoadOptions type exposes the following members:

Constructors

Constructor Description
init Initializes a new instance of LoadOptions class.
init Initializes a new instance of LoadOptions with the specified password.
init Initializes a new LoadOptions instance with the specified pre‑rasterization flag.
init Initializes a new LoadOptions instance with the specified password.

Properties

Property Description
password The password for password-protected documents.
pre_rasterize The pre_rasterize flag indicating whether the file should be pre‑rasterized.

Example

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

# Specify the load options with the document password
load_opt = LoadOptions("mypassword")

# Define a redaction
repl_opt = ReplacementOptions("[personal]")
ex_red = ExactPhraseRedaction("John Doe", repl_opt)

# Open the password‑protected document
with Redactor("./protected.docx", load_opt) as redactor:
    redactor.apply(ex_red)

    # Save the redacted document
    save_opt = SaveOptions()
    save_opt.add_suffix = True
    result_path = redactor.save(save_opt)
    print(f"Document redacted successfully. Check output in {result_path}.")

See Also