Answers for "nodejs extract pdf data"

47

nodejs extract pdf data

// Installation
// npm install pdf-parse

// Basic Usage
const fs = require('fs');
const pdf = require('pdf-parse'); 
let dataBuffer = fs.readFileSync('path to PDF file...'); 
pdf(dataBuffer).then(function(data) {
     /*  number of pages    
	console.log(data.numpages);     
	number of rendered pages    
	console.log(data.numrender);     
	PDF info    
	console.log(data.info);     
	PDF metadata    
	console.log(data.metadata);      
	PDF.js version     
	check https://mozilla.github.io/pdf.js/getting_started/    
	console.log(data.version);     PDF text    console.log(data.text);  */ 
});
Posted by: Guest on February-14-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language