Get document info
Leave feedback
GroupDocs.Metadata allows users to get document information which includes:
- File format (detected by the internal structure)
- File extension
- MIME type
- Number of pages
- File size
- A value indicating whether a file is encrypted
The following code sample demonstrates how to extract basic format information from a file.
basic_usage.GetDocumentInfo
with gm.Metadata(constants.input_xlsx) as metadata:
info = metadata.get_document_info()
print(f"File format: {info.file_type.file_format}")
print(f"File extension: {info.file_type.extension}")
print(f"MIME Type: {info.file_type.mime_type}")
print(f"Number of pages: {info.page_count}")
print(f"Document size: {info.size} bytes")
print(f"Is document encrypted: {info.is_encrypted}")
To learn more about library features and get familiar how to manage metadata and more, please refer to theadvanced usage section.
You may easily run the code above and see the feature in action in our GitHub examples:
Along with a full featured Java library we provide simple, but powerful free Apps.
You are welcome to view and edit metadata of PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, emails, images and more with our free online Free Online Document Metadata Viewing and Editing App.
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.