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()
lorem-ipsum.txt is sample file used in this example. Click here to download it.
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()
infographic-elements.tiff is sample file used in this example. Click here to download it.
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()
invitation.eml is sample file used in this example. Click here to download it.
Creation Date: 2017-04-25T11:28:29.0000000Z
Format: eml
Is Encrypted: False
Is Body in HTML: True
Is Signed: False
Size: 91948
Attachments Count: 1
Attachment Name: bg_pattern.gif
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.
On this page
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.