The following code snippet demonstrates how to obtain information about document stored on local disk.
Signaturesignature=newSignature("sample.pdf");// Document description
IDocumentInfodocInfo=signature.getDocumentInfo();System.out.print("Document contains "+docInfo.getPageCount()+" pages");System.out.print("File type is "+docInfo.getFileType().getFileFormat());System.out.print("Width for Max Height "+docInfo.getWidthForMaxHeight());System.out.print("Max Page Height"+docInfo.getMaxPageHeight());System.out.print("File size in bytes is "+docInfo.getSize());System.out.print("Width of first page is "+docInfo.getPages().get(0).getWidth());for(PageInfopage:docInfo.getPages()){System.out.print("- page-"+page.getPageNumber()+" Height "+page.getHeight()+" Width "+page.getWidth());}
Get document information from a stream
The following code snippet demonstrates how to obtain information about document provided as a stream.
FileInputStreamstream=newFileInputStream("sample.pdf")Signaturesignature=newSignature(stream);// Document description
IDocumentInfodocInfo=signature.getDocumentInfo();System.out.print("Document contains "+docInfo.getPageCount()+" pages");System.out.print("File type is "+docInfo.getFileType().getFileFormat());System.out.print("Width for Max Height "+docInfo.getWidthForMaxHeight());System.out.print("Max Page Height"+docInfo.getMaxPageHeight());System.out.print("File size in bytes is "+docInfo.getSize());System.out.print("Width of first page is "+docInfo.getPages().get(0).getWidth());for(PageInfopage:docInfo.getPages()){System.out.print("- page-"+page.getPageNumber()+" Height "+page.getHeight()+" Width "+page.getWidth());}
More resources
Advanced Usage Topics
To learn more about document eSign features, please refer to the advanced usage section.
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
Along with full-featured .NET library we provide simple, but powerful free Apps. You are welcome to eSign PDF, Word, Excel, PowerPoint documents with free to use online GroupDocs Signature App.
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.