galkahana / HummusJS

Node.js module for high performance creation, modification and parsing of PDF files and streams
http://www.pdfhummus.com
Other
1.15k stars 170 forks source link

TypeError: Unable to start parsing PDF file #409

Open blairjanis opened 5 years ago

blairjanis commented 5 years ago

I'm getting this error when trying to createReader ...

var pdfReader = hummus.createReader('not-working.pdf');
TypeError: Unable to start parsing PDF file
    at Object.<anonymous> (/Users/blairjanis/workspace/node/hummus-test/index.js:10:24)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

I think the issue has to do with a header and a link in the document but I'm not sure how to troubleshoot this. The not-working.pdf attached is the troublesome pdf.

Thanks for your help!

not-working.pdf

kilsen commented 4 years ago

Were you ever able to find a solution or workaround for this? I'm having the same issue with some documents.

untrustedlifeswanleap commented 4 years ago

Same, even with proper headers it is failing, also your pdf file looks fine

makinhs commented 3 years ago

same here

FranklinThaker commented 3 years ago

Hummus is declining some PDFs as they're not according to PDF standards. Check your PDF here -> https://www.pdfen.com/pdf-a-validator We might have to convert PDF according to standard in catch block if we receive the same parsing error from Hummus.

FranklinThaker commented 3 years ago

Finally, I've created a solution here. https://stackoverflow.com/questions/69039978/hummus-recipe-npm-typeerror-unable-to-start-parsing-pdf-file/69040034#69040034