The following code samples demonstrate how to get document information.
Get document information from a file from local disk
This example demonstrates how to get document information from the local file.
BasicUsage.GetDocumentInfoForTheFileFromLocalDisk
// Specify an absolute or relative path to your document. Ex: @"C:\Docs\source.docx"using(Watermarkerwatermarker=newWatermarker("source.docx")){IDocumentInfoinfo=watermarker.GetDocumentInfo();Console.WriteLine("File type: {0}",info.FileType);Console.WriteLine("Number of pages: {0}",info.PageCount);Console.WriteLine("Document size: {0} bytes",info.Size);}
Get document information from a stream
This example demonstrates how to get document information from the file stream.
BasicUsage.GetDocumentInfoForTheFileFromStream
// Specify an absolute or relative path to your document. Ex: @"C:\Docs\source.docx"using(FileStreamstream=File.OpenRead("source.docx")){using(Watermarkerwatermarker=newWatermarker(stream)){IDocumentInfoinfo=watermarker.GetDocumentInfo();Console.WriteLine("File type: {0}",info.FileType);Console.WriteLine("Number of pages: {0}",info.PageCount);Console.WriteLine("Document size: {0} bytes",info.Size);}}
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.