GroupDocs.Parser for Node.js via Java provides the functionality to extract data from documents on the local disk. Pass the file path to the Parser constructor.
The following example shows how to load the document from the local disk:
constgroupdocs=require('@groupdocs/groupdocs.parser');// Set the file path
constfilePath='sample.pdf';// Create an instance of Parser class with the file path
constparser=newgroupdocs.Parser(filePath);try{// Extract a text into the reader
constreader=parser.getText();// If text extraction isn't supported, a reader is null
if(reader===null){console.log("Text extraction isn't supported");}else{try{// Print a text from the document
console.log(reader.readToEnd());}finally{reader.close();}}}finally{parser.close();}process.exit(0);
A relative path is resolved against the current working directory of the Node.js process. Use path.join(__dirname, 'sample.pdf') to resolve the path against the script folder.
More resources
Free online document parser App
Along with the full-featured library we provide simple but powerful free Apps.
You are welcome to parse documents and extract data from PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our 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.