Get document info
Leave feedback
On this page
Use getDocumentInfo() or the static getInfo() method to retrieve document metadata without performing a full conversion. This is useful for building file browsers, validation pipelines, and pre-conversion UIs.
import com.groupdocs.markdown.*;
public class GetInfoStatic {
public static void main(String[] args) {
DocumentInfo info = MarkdownConverter.getInfo("business-plan.docx");
System.out.println("Format: " + info.getFileFormat()); // Docx
System.out.println("Pages: " + info.getPageCount()); // 42
System.out.println("Title: " + info.getTitle()); // "Q3 Report"
System.out.println("Author: " + info.getAuthor()); // "Jane Doe"
System.out.println("Encrypted: " + info.isEncrypted()); // false
}
}
business-plan.docx is a 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
import com.groupdocs.markdown.*;
public class GetInfoInstance {
public static void main(String[] args) {
try (MarkdownConverter converter = new MarkdownConverter("cost-analysis.xlsx")) {
DocumentInfo info = converter.getDocumentInfo();
System.out.println("Format: " + info.getFileFormat());
System.out.println("Pages: " + info.getPageCount());
System.out.println("Title: " + info.getTitle());
System.out.println("Author: " + info.getAuthor());
System.out.println("Encrypted: " + info.isEncrypted());
}
}
}
cost-analysis.xlsx is a sample file used in this example. Click here to download it.
Format: XLSX
Pages: 4
Title:
Author:
Encrypted: false
| Method | Returns | Description |
|---|---|---|
getFileFormat() | FileFormat | Detected file format (e.g., FileFormat.DOCX) |
getPageCount() | int | Number of pages or worksheets |
getTitle() | String | Document title from metadata |
getAuthor() | String | Document author from metadata |
isEncrypted() | boolean | Whether the document is password-protected |
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.