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: Write the metadata fields to a text filewithopen("get-info-static.txt","w",encoding="utf-8")asf:f.write(f"Format: {info.file_format}\n")# Docxf.write(f"Pages: {info.page_count}\n")# 42f.write(f"Title: {info.title}\n")# "Q3 Report"f.write(f"Author: {info.author}\n")# "Jane Doe"f.write(f"Encrypted: {info.is_encrypted}\n")# Falseif__name__=="__main__":get_info_static()
business-plan.docx is sample file used in this example. Click here to download it.
Format: Docx
Pages: 5
Title: Meridian Outdoor Co. — Business Plan
Author: Meridian Outdoor Co.
Encrypted: False
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()# Step 3: Write the metadata fields to a text filewithopen("get-info-instance.txt","w",encoding="utf-8")asf:f.write(f"Format: {info.file_format}\n")f.write(f"Pages: {info.page_count}\n")f.write(f"Title: {info.title}\n")f.write(f"Author: {info.author}\n")f.write(f"Encrypted: {info.is_encrypted}\n")if__name__=="__main__":get_info_instance()
cost-analysis.xlsx is sample file used in this example. Click here to download it.