modesty / pdf2json

converts binary PDF to JSON and text, for server-side PDF processing and command-line use.
https://github.com/modesty/pdf2json
Other
2.02k stars 377 forks source link

when passing an invalid buffer to PdfReader, an error should be returned. #306

Open linto17 opened 1 year ago

linto17 commented 1 year ago

The code and the pdf file are attached.

  import PDFParser from "pdf2json";
  var pdfParser = new PDFParser();
  pdfParser.on("pdfParser_dataError", console.log);
  pdfParser.on("pdfParser_dataReady", console.log);
  var verbosity = 1;
  pdfParser.loadPDF("./test-pdf.pdf", verbosity);
  setTimeout(() => console.log("does not display"), 1000);

test-pdf.pdf