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 to get document information which includes:

Get document information from file on local disk

The following code snippet demonstrates how to obtain information about document stored on local disk.

using (Signature signature = new Signature("sample.pdf"))
{
    IDocumentInfo documentInfo = signature.GetDocumentInfo();
    Console.WriteLine("Document properties {0}:", Path.GetFileName("sample.pdf"));
    Console.WriteLine(" - format : {0}", documentInfo.FileType.FileFormat);
    Console.WriteLine(" - extension : {0}", documentInfo.FileType.Extension);
    Console.WriteLine(" - size : {0}", documentInfo.Size);
    Console.WriteLine(" - page count : {0}", documentInfo.PageCount);
    foreach(PageInfo pageInfo in documentInfo.Pages)
    {
        Console.WriteLine(" - page-{0} Width {1}, Height {2}", pageInfo.PageNumber, pageInfo.Width, pageInfo.Height);
    }
}

Get document information from a stream

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

string filePath = "sample.pdf";
using (var stream = File.OpenRead(filePath))
{
    using (Signature signature = new Signature(stream))
    {
        IDocumentInfo documentInfo = signature.GetDocumentInfo();
        Console.WriteLine("Document properties {0}:", Path.GetFileName(filePath));
        Console.WriteLine(" - format : {0}", documentInfo.FileType.FileFormat);
        Console.WriteLine(" - extension : {0}", documentInfo.FileType.Extension);
        Console.WriteLine(" - size : {0}", documentInfo.Size);
        Console.WriteLine(" - page count : {0}", documentInfo.PageCount);
        foreach (PageInfo pageInfo in documentInfo.Pages)
        {
            Console.WriteLine(" - page-{0} Width {1}, Height {2}", pageInfo.PageNumber, pageInfo.Width, pageInfo.Height);
        }
    }
}
Note
GroupDocs.Signature also provides an ability to obtain extended information of document form fields and existing signatures.
To learn more about please refer to the following guides: Obtain document form fields and signatures information
For a complete guide to reading, adding, and securing hidden document metadata, see Work with document metadata.

Advanced Usage Topics

To learn more about document eSign features, please refer to the advanced usage section.

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.