yob/pdf-reader

PDF::Reader::MalformedPDFError when PDF contains an image

Closed this issue · 0 comments

Full error message:

PDF::Reader::MalformedPDFError: PDF malformed, expected 'endstream' but found 0 instead

For full context, this is happening while using Prawn to add an existing PDF to a new PDF. Stack trace points to pdf-reader library, error coming from here: pdf/reader/error.rb in str_assert at line 36

I believe this to be due to an image in the PDF, because I cannot recreate it when I remove the image. The PDF in question is attached (with PHI altered).

I cannot recreate this using an alternate PDF library (https://github.com/gdelugre/origami), which to me suggests that there is a bug in this one, although I'm open to alternate explanations.

Thanks!

MARGE.pdf