Get the format family and the additional information
Get the format family and the additional information
Leave feedback
A format family is a group of several file types for which an application provides additional information. For example, archive files (.7z, .rar, .zip, etc.) or Outlook files (.ost, .pst) are format families.
You can get the format family and the additional information using the getViewInfo method that returns a ViewInfo object.
GroupDocs.Viewer provides additional information for the following format families:
The following code snippet shows how to get the file type and the pages count from a file:
importcom.groupdocs.viewer.Viewer;importcom.groupdocs.viewer.options.ViewInfoOptions;importcom.groupdocs.viewer.results.ViewInfo;// ...
try(Viewerviewer=newViewer("sample.pdf")){// Get file information.
ViewInfoOptionsviewInfoOptions=ViewInfoOptions.forHtmlView();ViewInfoviewInfo=viewer.getViewInfo(viewInfoOptions);// Display file type and pages count.
System.out.println("Document type is: "+viewInfo.getFileType());System.out.println("Pages count: "+viewInfo.getPages().size());}
The following image shows a sample console output:
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.