javascript - pdf2json gives me a blank output txt file? -


i following "code example" guide on github. https://github.com/modesty/pdf2json#code-example

in example says "parse pdf write .txt file (which contains textual content of pdf)", copied , pasted exact implementation local javascript file , called output text file blank.

'use strict';  let fs = require('fs'); let pdfparser = require("pdf2json");  let pdfparser = new pdfparser();  pdfparser.on("pdfparser_dataerror", errdata => console.error(errdata.parsererror) ); pdfparser.on("pdfparser_dataready", pdfdata => {     fs.writefile("./node_modules/pdf2json/test/f1040ez.content.txt", pdfparser.getrawtextcontent()); });  pdfparser.loadpdf("./node_modules/pdf2json/test/pdf/fd/form/f1040ez.pdf"); 

is doing wrong? or not work on part? there alternatives pdf text converters nodejs without additional binaries installed?

the frontpage documentation bit wrong! in order make work set pdfparser parameters null , 1

this 1 works:

var fs = require("fs");  // https://github.com/modesty/pdf2json var pdfparser = require("./node_modules/pdf2json/pdfparser"); var pdfparser = new pdfparser(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 issue in pdf2json: https://github.com/modesty/pdf2json/issues/76


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -