get_document_info method

get_document_info

Retrieves general information about the document, such as size and page count.

def get_document_info(self):
    ...

Returns: IDocumentInfo: An object containing document size, file type, page count, and page details.

Raises Description
PasswordRequiredException If the document is password protected.
IncorrectPasswordException If an invalid password is provided.

Example

from groupdocs.redaction import Redactor

def get_local_file_info():
    # Load the document from local disk
    with Redactor("./sample.docx") as redactor:
        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")

See Also