Get document information
Leave feedback
On this page
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.
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()}`);
}
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.