Get document information
Leave feedback
GroupDocs.SignatureΒ allows to get document information which includes:
- FileType
- Size
- PageCount
- Pages dimensions -Β HeightΒ andΒ WidthΒ for each page in a documentΒ PagesΒ collection.
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);
}
}
The following code snippet demonstrates how to obtain information about document provided as a stream.
using (var stream = File.OpenRead("sample.pdf"))
{
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);
}
}
}
NoteGroupDocs.Signature also provides an abilityto 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
To learn more about document eSign features, please refer to theΒ advanced usage section.
You may easily run the code above and see the feature in action in ourΒ GitHub examples:
- GroupDocs.Signature for .NET examples, plugins, and showcase
- GroupDocs.Signature for Java examples, plugins, and showcase
- Document Signature for .NET MVC UI Example
- Document Signature for .NET App WebForms UI Example
- Document Signature for Java App Dropwizard UI Example
- Document Signature for Java Spring UI Example
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.
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.