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
fromgroupdocs.markdownimportMarkdownConverterdefget_info_static():"""Retrieve document metadata using the static GetInfo method."""# Step 1: Get document info without performing a full conversioninfo=MarkdownConverter.get_info("business-plan.docx")# Step 2: Print the metadata fieldsprint(f"Format: {info.file_format}")# Docxprint(f"Pages: {info.page_count}")# 42print(f"Title: {info.title}")# "Q3 Report"print(f"Author: {info.author}")# "Jane Doe"print(f"Encrypted: {info.is_encrypted}")# Falseif__name__=="__main__":get_info_static()
business-plan.docx is sample file used in this example. Click here to download it.
fromgroupdocs.markdownimportMarkdownConverterdefget_info_instance():"""Retrieve document metadata using the instance API."""# Step 1: Open the spreadsheet with a context managerwithMarkdownConverter("cost-analysis.xlsx")asconverter:# Step 2: Retrieve document metadatainfo=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.