gettalong / hexapdf

Versatile PDF creation and manipulation for Ruby
https://hexapdf.gettalong.org
Other
1.21k stars 69 forks source link

Problem when using: "hexapdf modify foobar.pdf -i 2-e barfoo.pdf" #242

Closed rubyFeedback closed 1 year ago

rubyFeedback commented 1 year ago

I get this as result:

Problem encountered: undefined method `value' for nil:NilClass

Could this error message be improved? What error is there?

hexapdf works fine on many other .pdf files, but I seem to have a faulty .pdf file.

For instance I was using exiftool before and it said:

Error: Invalid xref table - foobar.pdf

So something may be wrong with this .pdf file. Actually right now I don't even know if this comes from hexapdf, but it appears to be.

Perhaps hexapdf could show a bit more information in regards to such misbehaving .pdf files. I'll try to see what I can do with this .pdf file - it's a bit too big to upload (27 MB); I'll see whether qpdf works with it in a moment.

gettalong commented 1 year ago

Please try running hexapdf info --check foobar.pdf which will produce debug output.

The error message comes from HexaPDF because somewhere the PDF is not following the PDF standard (probable case) or there is a bug in HexaPDF. The PDF may still be fine but I would need to have a look at it to determine the exact cause and where the problem lies.

And yes, the error output could be improved. I will see to that.

gettalong commented 1 year ago

@rubyFeedback I have added some additional information for such non-HexaPDF errors, available with HexaPDF 0.32.2.

If you could provide the faulty PDF, I could have a look and fix the underlying issue.

gettalong commented 1 year ago

@rubyFeedback I will close this issue for now since I can't really do anything without inspecting the faulty PDF. If you like me to inspect the file, you could use a file transfer service or upload it to cloud storage provider.