Get file info
Leave feedback
On this page
GroupDocs.Comparison allows you to get the following file information:
- FileType represents the document file type (PDF, Word document, Excel spreadsheet, PowerPoint presentation or image etc.).
- PageCount represents count of document pages.
- FileSize represents the document file size.
- PagesInfo represents the page information.
The following code samples show how to get file information:
using System;
using GroupDocs.Comparison;
using GroupDocs.Comparison.Interfaces;
// ...
using (Comparer comparer = new Comparer("source.docx"))
{
IDocumentInfo info = comparer.Source.GetDocumentInfo();
for (int i = 0; i < info.PageCount; i++)
{
Console.WriteLine("\n" +
"Page number: {5}\n" +
"File type: {0}\n" +
"Number of pages: {1}\n" +
"Document size: {2} bytes\n" +
"Width: {3}\n" +
"Height: {4} ",
info.FileType,
info.PageCount,
info.Size,
info.PagesInfo[i].Width,
info.PagesInfo[i].Height, i + 1
);
}
}
The result is as follows:
using System;
using GroupDocs.Comparison;
using GroupDocs.Comparison.Interfaces;
using System.IO;
// ...
using (Comparer comparer = new Comparer(File.OpenRead("source.docx")))
{
IDocumentInfo info = comparer.Source.GetDocumentInfo();
for (int i = 0; i < info.PageCount; i++)
{
Console.WriteLine("\n" +
"Page number: {5}\n" +
"File type: {0}\n" +
"Number of pages: {1}\n" +
"Document size: {2} bytes\n" +
"Width: {3}\n" +
"Height: {4} ",
info.FileType,
info.PageCount,
info.Size,
info.PagesInfo[i].Width,
info.PagesInfo[i].Height, i + 1
);
}
}
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.