Get file info

GroupDocs.Annotation allows to get document information which includes.

  • FileType - document file type (PDF, Word document, Excel spreadsheet, PowerPoint presentation or image etc.);
  • PageCount - count of document pages;
  • FileSize - document file size;

PagesInfo represents List of PageInfo objects which store information about each page. 

PageInfo has two properties - Width and Height in pixels. This properties works with all formats except Email And Html that doesn’t have height and width so the won’t store them and will be empty. All pages width and height will be same in all formats except Cells, so you can use size of first element as size of all document.

The following code sample demonstrates how to get information about document and Width and Height of its pages:

//Get file info for the file from local disk
using (Annotator annotator = new Annotator("input.docx"))
{
	IDocumentInfo info = annotator.Document.GetDocumentInfo();
    int width = info.PagesInfo[0].Width;
    int height = info.PagesInfo[0].Height;
    Console.WriteLine("\nFile type: {0}\nNumber of pages: {1}\nDocument size: {2} bytes", info.FileType, info.PageCount, info.Size);
}

More resources

Advanced Usage Topics

To learn more about document annotating 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:

Free Online App

Along with full-featured .NET library we provide simple but powerful free Apps. You are welcome to annotate your PDF, DOC or DOCX, XLS or XLSX, PPT or PPTX, PNG and other documents with free to use online GroupDocs Annotation App.