galkahana/HummusJS

Not able to read the pdf file

Opened this issue · 3 comments

Hello @galkahana ,

I have tried to read the uploaded pdf using nodejs, but the response of the uploaded file is getting empty.
Below is the following code I have used

var app = express();
app.get('/', function(req, res){
    res.writeHead(200, {'Content-Type': 'application/pdf'});
    console.log("hey",__dirname)
    var pdfParser = hummus.createReader(__dirname +'/appointments.pdf'); // the path to the pdf file
    console.log("pdfParser", pdfParser)
  });
app.listen(3000);

The pdfParser returns an empty object.
Can anyone tell what's wrong with it and help me out to use this package

Thank you

Hi!

It seems to be the correct behaviour, since, by my newbie looks, PDFReader's class doesn't implement the .toString() method. You won't be able to use console.log() like this.

What exactly you want to do?

Thank you @freebeans

I want to read the PDF which contains form fields, and then add the data to the form fields given in the PDF and generate new PDF