Redactor class

Redactor class

Represents the main class that controls the document redaction process, allowing opening, redacting, and saving documents.

Learn more

The Redactor type exposes the following members:

Constructors

Constructor Description
init Initializes a new Redactor instance using a file path.
init Initializes a new Redactor instance using a document stream.
init Initializes a new Redactor instance for a password-protected document using its path.
init Initializes a new instance of Redactor for a password‑protected document using its path and settings.
init Initializes a new Redactor instance for a password‑protected document using a stream.
init Initializes a new instance of Redactor for a password‑protected document using a stream and optional settings.

Methods

Method Description
apply Applies a redaction to the document.
apply Applies a set of redactions to the document.
apply Applies a redaction policy to the document.
dispose Releases resources.
generate_preview Generates preview images of specific pages in a given image format.
get_document_info Retrieves general information about the document, such as size and page count.
save Saves the document to a file using the provided SaveOptions. By default, AddSuffix is set to True and RasterizeToPDF is set to True.
save Saves the document to a file.
save Saves the document to a stream, including custom location.
save Saves the document to the specified stream.

Example

from groupdocs.redaction import Redactor
from groupdocs.redaction.redactions import RemovePageRedaction, PageSeekOrigin

# Open a PDF document
with Redactor("document.pdf") as redactor:
    # Remove the first page
    redactor.apply(RemovePageRedaction(PageSeekOrigin.BEGIN, 0, 1))
    # Save the redacted document (overwrites the original file)
    redactor.save()

Guides

Task guides that use Redactor:

See Also