extract data from pdf nodejs

You can use the pdf-parse package in Node.js to extract data from PDFs. First, install the pdf-parse package using npm:

npm install pdf-parse

Then, you can use the following example code to extract text from a PDF file:

const pdf = require('pdf-parse');

let dataBuffer = fs.readFileSync('example.pdf');

pdf(dataBuffer).then(function(data) {
    console.log(data.text);
});

This code first reads the PDF file using fs.readFileSync, then uses pdf-parse to extract the text from the PDF and finally logs the extracted text to the console.