Get file info

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Annotation MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-annotation -- dnx GroupDocs.Annotation.Mcp --yes
Folders, licensing and more →

On this page

GroupDocs.Annotation allows you to get the following file information:

  • FileType is a document file type (PDF, Word document, Excel spreadsheet, PowerPoint presentation or image etc.)
  • PageCount is a count of document pages
  • FileSize is a file size;

PagesInfo represents a List of the PageInfo objects which store information about each page. 

PageInfo has the following properties (in pixels):

This properties supports all formats except Email and Html. Width and height are the same for all pages except the Cells formats.

The following code snippet shows how to get information about a document:

// This example demonstrates document info extraction

// Create an instance of Annotator class
Annotator annotator = new Annotator("inputPath");
try {
	
	// Get document info
	IDocumentInfo info = annotator.getDocument().getDocumentInfo();
	System.out.println(
		"\nFile type: "+info.getFileType()
		+"\nNumber of pages: "+info.getPageCount()
		+"\nDocument size: {2} bytes"+info.getSize()
	);    
} finally {
	if (annotator != null) {
		annotator.dispose();
	}
}

On this page