Get document 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.Parser 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-parser -- dnx GroupDocs.Parser.Mcp --yes
Folders, licensing and more →

GroupDocs.Parser provides the functionality to get the basic document info by the getDocumentInfo() method:

parser.getDocumentInfo(); // returns IDocumentInfo

The IDocumentInfo interface has the following members:

MemberDescription
getFileType()The document type.
getPageCount()The total number of document pages.
getRawPageCount()The total number of document raw pages.
getSize()The size of the document in bytes.

Here are the steps to get document info:

  • Instantiate the Parser object for the initial document;
  • Call the getDocumentInfo() method and obtain the object with the IDocumentInfo interface;
  • Call methods such as getFileType(), getPageCount() or getSize().

The following example shows how to get document info:

const groupdocs = require('@groupdocs/groupdocs.parser');

// Create an instance of Parser class
const parser = new groupdocs.Parser('sample.docx');
try {
  // Get the document info
  const info = parser.getDocumentInfo();
  // Print document information
  console.log(`FileType: ${info.getFileType().toString()}`);
  console.log(`PageCount: ${info.getPageCount()}`);
  console.log(`Size: ${info.getSize()}`);
} finally {
  parser.close();
}

process.exit(0);

The output looks like this:

FileType: Microsoft Word Open XML Document (.docx)
PageCount: 2
Size: 15214

More resources

Advanced usage topics

To learn more about document data extraction features and get familiar how to extract text, images, forms and more, please refer to the advanced usage section.

Free online document parser App

Along with the full-featured library we provide simple, but powerful free Apps.

You are welcome to extract data from PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Parser App.