Get document info

Use get_document_info() or the static get_info() method to retrieve document metadata without performing a full conversion. This is useful for building file browsers, validation pipelines, and pre-conversion UIs.

Using static method

from groupdocs.markdown import MarkdownConverter

def get_info_static():
    """Retrieve document metadata using the static GetInfo method."""

    # Step 1: Get document info without performing a full conversion
    info = MarkdownConverter.get_info("business-plan.docx")

    # Step 2: Print the metadata fields
    print(f"Format:    {info.file_format}")     # Docx
    print(f"Pages:     {info.page_count}")      # 42
    print(f"Title:     {info.title}")            # "Q3 Report"
    print(f"Author:    {info.author}")           # "Jane Doe"
    print(f"Encrypted: {info.is_encrypted}")     # False

if __name__ == "__main__":
    get_info_static()

business-plan.docx is sample file used in this example. Click here to download it.

Format:    Docx
Pages:     18
Title:     
Author:    
Encrypted: False

Download full output

Format:    Docx
Pages:     18
Title:     
Author:    
Encrypted: False

Download full output

Using instance method

from groupdocs.markdown import MarkdownConverter

def get_info_instance():
    """Retrieve document metadata using the instance API."""

    # Step 1: Open the spreadsheet with a context manager
    with MarkdownConverter("cost-analysis.xlsx") as converter:
        # Step 2: Retrieve document metadata
        info = converter.get_document_info()

        print(f"Format:     {info.file_format}")
        print(f"Pages:      {info.page_count}")
        print(f"Title:      {info.title}")
        print(f"Author:     {info.author}")
        print(f"Encrypted:  {info.is_encrypted}")

if __name__ == "__main__":
    get_info_instance()

cost-analysis.xlsx is sample file used in this example. Click here to download it.

## Cost data and chart

|  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
|  |  | Cost Analysis |  |  |  |  |  |
|  |  | PARETO CHART |  |  |  |  |  |
|  |  | COST ANALYSIS |  |  |  |  | COST CENTER |
|  |  | Cost center | Annual cost  | Percent of total | Cumulative percent |  |  |
|  |  | Parts and materials | $1,325,000.00  | 31.17% | 31.17% |  |  |
|  |  | Manufacturing equipment | $900,500.00  | 21.19% | 52.36% |  |  |
...

Download full output

Format:     Xlsx
Pages:      1
Title:      Cost Analysis
Author:     GroupDocs
Encrypted:  False

Download full output

DocumentInfo properties

PropertyTypeDescription
file_formatFileFormatDetected file format (e.g., FileFormat.DOCX)
page_countintNumber of pages or worksheets
titlestrDocument title from metadata
authorstrDocument author from metadata
is_encryptedboolWhether the document is password-protected