1

I'm getting empty combo box value from PDF file using 'pdf2json' parser in express.js. The value on PDF file showing the different option inside the combo box and it also storing state of the selection while saving the file, but when I try to parse the file it parses all fields except combo box value.

Click to view the sample PDF image

Following snippet is for getting data from PDF:-

function parsePDF(data) {
    return new Promise(function (resolve, reject) {
        let pdfParser = new PDFParser();
        pdfParser.on("pdfParser_dataError", errData => {
          console.error(errData.parserError);
          reject({ message: "no data"});
        });

        pdfParser.on("pdfParser_dataReady", pdfData => {
          var data = JSON.stringify(pdfParser.getAllFieldsTypes());
          var jsonData = JSON.parse(data);
          var pdfData = {};
          jsonData.forEach(element => {
            pdfData[element.id] = element.value;
          });
          resolve(pdfData);
        });
        pdfParser.parseBuffer(data);
    });

  }

I got response back JSON data of all fields but not combo box value.

 {
    "address": "East Street",
    "city": "San Diego",
    "state": ""
}
jasmeetsohal
  • 141
  • 1
  • 2
  • 11

0 Answers0