Skip to content

Commit

Permalink
Corrected the order of subscription of events.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBone committed Sep 11, 2018
1 parent f1cf252 commit de557d9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scraper.js
Expand Up @@ -101,10 +101,8 @@ function parsePdfs(database, url) {
// strings, being the text that has been parsed from the PDF.

let pdfParser = new pdf2json();
request({ url: pdfUrl, encoding: null }).pipe(pdfParser)
pdfParser
.on("pdfParser_dataError", error => console.error(error))
.on("error", function() { console.log("Error"); })
.on("finish", function() { console.log("Finish"); })
.on("pdfParser_dataReady", pdf => {
// Convert the JSON representation of the PDF into a collection of PDF rows.

Expand Down Expand Up @@ -208,6 +206,7 @@ function parsePdfs(database, url) {
for (let developmentApplication of developmentApplications)
insertRow(database, pdfFileName, developmentApplication);
});
request({ url: pdfUrl, encoding: null }).pipe(pdfParser);
}
});
}
Expand Down

0 comments on commit de557d9

Please sign in to comment.