galkahana / HummusJS

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

"Couldn't find tokens in file" Error Thrown #234

Open youmustfight opened 6 years ago

youmustfight commented 6 years ago

Hello!

I'm trying to create a new PDF from the 2nd and 3rd pages of an existing PDF, but I'm getting this message when it tries to parse. Not sure how to deal with that and I don't have any control over how the PDFs were originally generated.

[ 09/01/2018 19:27:15 ] PDFParser::ParseEOFLine, Couldn't find tokens in file
[ 09/01/2018 19:27:15 ] PDFDocumentHandler::StartCopyingContext, failure occurred while parsing PDF file.

when running:

const pdfWriter = hummus.createWriter(`new-file.pdf`, {
  log: `logs.log`,
});
pdfWriter.appendPDFPagesFromPDF(`old-file.pdf`, {
  type: hummus.eRangeTypeSpecific,
  specificRanges: [[1, 2]]
});
pdfWriter.end();

With other PDFs, it works fine. It's just this one. It's not locked and I can edit, so perhaps it is because the digital signature? Here is the PDF with their info removed.

Thanks so much!

youmustfight commented 6 years ago

Maybe related to https://github.com/galkahana/HummusJS/issues/179 since the PDF is version 1.3

chunyenHuang commented 6 years ago

Well, looks like it's your form has problem. I download your pdf (with their info removed) and it works... Do you want to try again? I can not help if you can not provide the bad pdf file~