GroupDocs.Parser provides the functionality to get the basic document info by the getDocumentInfo() method:
parser.getDocumentInfo();// returns IDocumentInfo
The IDocumentInfo interface has the following members:
Member
Description
getFileType()
The document type.
getPageCount()
The total number of document pages.
getRawPageCount()
The total number of document raw pages.
getSize()
The size of the document in bytes.
Here are the steps to get document info:
Instantiate the Parser object for the initial document;
Call the getDocumentInfo() method and obtain the object with the IDocumentInfo interface;
Call methods such as getFileType(), getPageCount() or getSize().
The following example shows how to get document info:
constgroupdocs=require('@groupdocs/groupdocs.parser');// Create an instance of Parser class
constparser=newgroupdocs.Parser('sample.docx');try{// Get the document info
constinfo=parser.getDocumentInfo();// Print document information
console.log(`FileType: ${info.getFileType().toString()}`);console.log(`PageCount: ${info.getPageCount()}`);console.log(`Size: ${info.getSize()}`);}finally{parser.close();}process.exit(0);
The output looks like this:
FileType: Microsoft Word Open XML Document (.docx)
PageCount: 2
Size: 15214
More resources
Advanced usage topics
To learn more about document data extraction features and get familiar how to extract text, images, forms and more, please refer to the advanced usage section.
Free online document parser App
Along with the full-featured library we provide simple, but powerful free Apps.
You are welcome to extract data from PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Parser App.
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.
On this page
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.