📅  最后修改于: 2022-03-11 15:01:39.698000             🧑  作者: Mango
// 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); */
});