Initializes a new instance of Redactor using a stream.
def__init__(self,document):...
Parameter
Type
Description
document
io.RawIOBase
Source stream of the document.
Example
fromgroupdocs.redactionimportRedactordefopen_from_stream():# Open the document as a binary streamwithopen("./sample.pdf","rb")asstream:# Load the document from the streamwithRedactor(stream)asredactor:# Perform redactions herepass
init
Initializes a new instance of Redactor for a password‑protected document using its path.
def__init__(self,file_path,load_options):...
Parameter
Type
Description
file_path
str
Path to the file.
load_options
LoadOptions
Options, including password.
Example
fromgroupdocs.redactionimportRedactor# Load a password‑protected document from a file pathwithRedactor("protected.docx")asredactor:# Perform redaction operations herepass
init
Initializes a new Redactor instance for a password‑protected document using its path and settings.
fromgroupdocs.redactionimportRedactorwithRedactor("./sample.docx")asredactor:info=redactor.get_document_info()print(f"File type: {info.file_type}")print(f"Number of pages: {info.page_count}")print(f"Document size: {info.size} bytes")
init
Initializes a new Redactor instance for a password‑protected document using a stream.
def__init__(self,document,load_options):...
Parameter
Type
Description
document
io.RawIOBase
Source input stream.
load_options
LoadOptions
Options, including password.
Example
fromgroupdocs.redactionimportRedactor,LoadOptionsdefopen_protected_doc():# Open the protected PDF as a binary streamwithopen(r"C:\sample.pdf","rb")asstream:# Provide the password via LoadOptionsload_options=LoadOptions("mypassword")# Initialize Redactor with the stream and load optionswithRedactor(stream,load_options)asredactor:# Perform redaction operations herepass
init
Initializes a new instance of Redactor for a password‑protected document using a stream and settings.