Skip to content Skip to sidebar Skip to footer

Pdf2json Gives Me A Blank Output Txt File?

I am following their 'Code Example' guide on their github. https://github.com/modesty/pdf2json#code-example In the example that says 'Parse a PDF then write a .txt file (which only

Solution 1:

The frontpage documentation is a bit wrong! In order to make this work simply set to PDFParser parameters null and 1

This one works:

var fs = require("fs");

// https://github.com/modesty/pdf2jsonvarPDFParser = require("./node_modules/pdf2json/PDFParser");
var pdfParser = newPDFParser(this,1);

pdfParser.on("pdfParser_dataError", errData =>console.error(errData.parserError));
pdfParser.on("pdfParser_dataReady", pdfData => {
    console.log(pdfParser)
    fs.writeFile("./content.txt", pdfParser.getRawTextContent());
});

HTH -XDVarpunen

Link to issue in pdf2json: https://github.com/modesty/pdf2json/issues/76

Post a Comment for "Pdf2json Gives Me A Blank Output Txt File?"