Guest User

Untitled

a guest
Jan 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. app.post('/', function(req, res) {
  2. console.log("post request detected");
  3.  
  4. let pdfParser = new PDFParser(this, 1);
  5.  
  6. pdfParser.on("pdfParser_dataError", function(errData) {
  7. console.error(errData.parserError)
  8. });
  9. pdfParser.on("pdfParser_dataReady", function(pdfData) {
  10. fs.writeFile("./public/data.json", JSON.stringify(pdfData));
  11. });
  12. //so here I have to pass the path of the file, now i wrote it manually to test
  13. pdfParser.loadPDF("C:\Users\Lenovo\Downloads\schedule.pdf");
  14. });
  15.  
  16. <input type="file" id="file"/>
  17. <input class="btn btn-primary" ng-click="fileSubmit()" type="submit" value="submit"/>
  18.  
  19. $scope.fileSubmit = function() {
  20. //here it work when i write it manually :)
  21. $http.post('/', "C:\Users\Lenovo\Downloads\Personal Schedule.pdf");
  22. };
Add Comment
Please, Sign In to add comment