DocumentInfo class

DocumentInfo class

Provides common information about a loaded document.

Learn more:

The DocumentInfo type exposes the following members:

Properties

Property Description
file_type The file type of the loaded document.
is_encrypted The property indicates whether the document is encrypted and requires a password to open.
page_count The number of pages (slides, worksheets, etc) in the loaded document.
pages The pages property returns a collection of objects representing common information about the document pages (slides, worksheets, etc).
size The size of the loaded document in bytes.

Example

from groupdocs.metadata import Metadata, FileFormat, Constants

with Metadata(Constants.InputXlsx) as metadata:
    if metadata.file_format != FileFormat.Unknown:
        info = metadata.get_document_info()
        print(f"File format: {info.file_type.file_format}")
        print(f"File extension: {info.file_type.extension}")
        print(f"MIME Type: {info.file_type.mime_type}")
        print(f"Number of pages: {info.page_count}")
        print(f"Document size: {info.size} bytes")
        print(f"Is document encrypted: {info.is_encrypted}")

See Also