statement.js (528B)
1 2 3 import fs from "fs"; 4 import PDFParser from "pdf2json"; 5 6 function process() { 7 } 8 9 const args = process.argv.slice(2) 10 const file = args[0] 11 if (!file) { 12 console.log("expected statement.pdf argument") 13 process.exit(1) 14 } 15 16 const pdfParser = new PDFParser(); 17 18 pdfParser.on("pdfParser_dataError", errData => console.error(errData.parserError) ); 19 pdfParser.on("pdfParser_dataReady", pdfData => { 20 fs.writeFile("./pdf2json/test/F1040EZ.json", JSON.stringify(pdfData)); 21 }); 22 23 pdfParser.loadPDF("./pdf2json/test/pdf/fd/form/F1040EZ.pdf");