Get document information

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.Signature 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-signature -- dnx GroupDocs.Signature.Mcp --yes
Folders, licensing and more →

Overview

GroupDocs.Signature allows you to retrieve document information, which includes the following:

  • FileType: The type of the document.
  • Size: The size of the document.
  • PageCount: The total number of pages in the document.
  • Page dimensions for each page in a document:

These properties are available through the Pages collection for each page in the document.

Get document information from a file

The following code snippet demonstrates how to obtain information about document provided as a file.

  // The path to the documents directory.
  const filePath = Constants.SAMPLE_PDF;

  const signature = new signatureLib.Signature(filePath);

  const documentInfo = await signature.getDocumentInfo();

  console.log(`Document properties ${path.basename(filePath)}`);
  console.log(` - format : ${documentInfo.getFileType().getFileFormat()}`);
  console.log(` - extension : ${documentInfo.getFileType().getExtension()}`);
  console.log(` - size : ${documentInfo.getSize()}`);
  console.log(` - page count : ${documentInfo.getPageCount()}`);
  console.log(` - Form Fields count : ${documentInfo.getFormFields().size()}`);
  console.log(` - Text signatures count : ${documentInfo.getTextSignatures().size()}`);
  console.log(` - Image signatures count : ${documentInfo.getImageSignatures().size()}`);
  console.log(` - Digital signatures count : ${documentInfo.getDigitalSignatures().size()}`);
  console.log(` - Barcode signatures count : ${documentInfo.getBarcodeSignatures().size()}`);
  console.log(` - QrCode signatures count : ${documentInfo.getQrCodeSignatures().size()}`);
  console.log(` - FormField signatures count : ${documentInfo.getFormFieldSignatures().size()}`);

  for (const pageInfo of documentInfo.getPages().toArray()) {
    console.log(` - page-${pageInfo.getPageNumber()} Width ${pageInfo.getWidth()}, Height ${pageInfo.getHeight()}`);
  }

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online Apps

Along with the full-featured .NET library, we provide simple but powerful free online apps.

To sign PDF, Word, Excel, PowerPoint, and other documents you can use the online apps from the GroupDocs.Signature App Product Family.