// Specify an absolute or relative path to your document. Ex.: "C:\\Docs\\source.docx"
Watermarkerwatermarker=newWatermarker("source.docx");IDocumentInfoinfo=watermarker.getDocumentInfo();System.out.println("File type: "+info.getFileType());System.out.println("Number of pages: "+info.getPageCount());System.out.println("Document size: "+info.getSize()+" bytes");watermarker.dispose();
Get document information from a stream
This example demonstrates how to get document information from the file stream.
basic_usage.GetDocumentInfoForTheFileFromStream
// Specify an absolute or relative path to your document. Ex: "C:\\Docs\\source.docx"
FileInputStreamstream=newFileInputStream("source.docx");Watermarkerwatermarker=newWatermarker(stream);IDocumentInfoinfo=watermarker.getDocumentInfo();System.out.println("File type: "+info.getFileType());System.out.println("Number of pages: "+info.getPageCount());System.out.println("Document size: "+info.getSize()+" bytes");watermarker.dispose();stream.close();
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.