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:
fromgroupdocs.redactionimportRedactorfromgroupdocs.redaction.optionsimportSaveOptionsfromgroupdocs.redaction.redactionsimportDeleteAnnotationRedactiondefload_from_local_disc():# Specify the redaction options - remove all annotationsdel_red=DeleteAnnotationRedaction()# Load the document to be redacted from the local discwithRedactor("./sample.docx")asredactor:# Apply the redactionredactor.apply(del_red)# Save the redacted document in its original format next to the source fileso=SaveOptions()so.add_suffix=Trueso.rasterize_to_pdf=Falseso.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.