Load from local disc

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Redaction MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-redaction -- dnx GroupDocs.Redaction.Mcp --yes
Folders, licensing and more →

On this page

GroupDocs.Redaction.Redactor class is a main class in Redaction API, providing functionality to open a document. When document is located on the local disk, you can pass its path to Redactor class constructor.

The following example demonstrates how to open a document from local disc:

from groupdocs.redaction import Redactor
from groupdocs.redaction.options import SaveOptions
from groupdocs.redaction.redactions import DeleteAnnotationRedaction


def load_from_local_disc():
    # Specify the redaction options - remove all annotations
    del_red = DeleteAnnotationRedaction()

    # Load the document to be redacted from the local disc
    with Redactor("./sample.docx") as redactor:

        # Apply the redaction
        redactor.apply(del_red)

        # Save the redacted document in its original format next to the source file
        so = SaveOptions()
        so.add_suffix = True
        so.rasterize_to_pdf = False
        so.redacted_file_suffix = "redacted"
        result_path = redactor.save(so)
        print(f"Document redacted successfully.\nCheck output in {result_path}.")


if __name__ == "__main__":
    load_from_local_disc()

sample.docx is the sample file used in this example. Click here to download it.

Binary file (DOCX, 40 KB)

Download full output

On this page