node-pdf-to-json
v1.0.2
Published
```js npm i node-pdf-to-json ```
Downloads
4
Readme
pdf-to-json
example
npm i node-pdf-to-json
const fs = require('fs');
const pdf2json = require('node-pdf-to-json');
const url = __dirname + '/pro.pdf';
fs.readFile(url, function (error, data) {
if (error) {
console.log(error);
return;
}
var unitArray = new Uint8Array(data);
// 指定buffer或路径都可以
pdf2json.load(unitArray).then((contents) => {
fs.writeFileSync(__dirname + '/pdf.json', JSON.stringify(contents));
});
});
pdf2json.load(url).then((contents) => {
fs.writeFileSync(__dirname + '/pdf.json', JSON.stringify(contents));
});