GroupDocs.Conversion for Python via .NET provides a standard method to obtain information about a document. You can retrieve a basic document information or detailed as shown below for various formats.
Example 1: Get Basic Document Info
To retrieve document information, use the Converter.get_document_info() method. It returns a DocumentInfo object containing details common to all supported document types, such as format, creation date, size, and page count.
fromgroupdocs.conversionimportConverterdefget_document_info():# Load the document and retrieve informationwithConverter("./lorem-ipsum.txt")asconverter:info=converter.get_document_info()# Print basic document infoprint("Format:",info.format)print("Pages count:",info.pages_count)print("Creation date:",info.creation_date)print("Size, bytes:",info.size)if__name__=="__main__":get_document_info()
weekly-plan.mpp is sample file used in this example. Click here to download it.
Example 5: Get Image Info
You can find which file types belong to this format family in the Image documentation section.
fromgroupdocs.conversionimportConverterdefget_image_info():# Load the document and retrieve informationwithConverter("./infographic-elements.tiff")asconverter:doc_info=converter.get_document_info()# Print TIFF document infoprint("Bits per Pixel:",doc_info.bits_per_pixel)print("Creation Date:",doc_info.creation_date)print("Format:",doc_info.format)print("Height:",doc_info.height)print("Width:",doc_info.width)print("Size, bytes:",doc_info.size)if__name__=="__main__":get_image_info()
Bits per Pixel:32Creation Date:2024-11-03 11:00:45.101493+00:00Format:tiffHeight:2000Width:1500Size, bytes:1734560
infographic-elements.tiff is sample file used in this example. Click here to download it.
Example 6: Get Presentation Document Info
You can find which file types belong to this format family in the Presentation documentation section.
fromgroupdocs.conversionimportConverterdefget_pres_document_info():# Load the document and retrieve informationwithConverter("./presentation-template.pptx")asconverter:doc_info=converter.get_document_info()# Print PPTX document infoprint("Author:",doc_info.author)print("Creation Date:",doc_info.creation_date)print("Format:",doc_info.format)print("Is Password Protected:",doc_info.is_password_protected)print("Pages Count:",doc_info.pages_count)print("Size, bytes:",doc_info.size)print("Title:",doc_info.title)if__name__=="__main__":get_pres_document_info()
blocks-and-tables.dwg is sample file used in this example. Click here to download it.
Example 9: Get Email Message Info
You can find which file types belong to this format family in the Email documentation section.
fromgroupdocs.conversionimportConverterdefget_email_document_info():# Load the document and retrieve informationwithConverter("./invitation.eml")asconverter:doc_info=converter.get_document_info()# Print EML document infoprint("Creation Date:",doc_info.creation_date)print("Format:",doc_info.format)print("Is Encrypted:",doc_info.is_encrypted)print("Is Body in HTML:",doc_info.is_html)print("Is Signed:",doc_info.is_signed)print("Size:",doc_info.size)print("Attachments Count:",doc_info.attachments_count)forattachment_nameindoc_info.attachments_names:print("Attachment Name:",attachment_name)if__name__=="__main__":get_email_document_info()
Creation Date:2017-04-25 11:28:29+00:00Format:emlIs Encrypted:FalseIs Body in HTML:TrueIs Signed:FalseSize:91948Attachments Count:0
invitation.eml is sample file used in this example. Click here to download it.
The DocumentInfo object provides an extensive set of metadata, which varies depending on the document format. You can consult the API reference for additional format-specific document metadata details.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.