Closed rubyFeedback closed 3 weeks ago
Thanks for reporting this! I'm guessing you can't provide the PDF?
I have extended the informational output on errors. Could you try running the same command using the HexaPDF version from the devel branch?
If it worked before, could you try prior versions of HexaPDF to find out which version still worked?
ps. Nice book! :grin: Read the fantasy books from Hohlbein as a kid.
@rubyFeedback FYI: The new release 1.0.1 contains the mentioned change, so please use the latest version to get more information about the problem - thanks!
I'm experiencing the same issue after upgrading to 1.0 then 1.0.1, we had to revert back as we get quite a few files in a day with the issue
Problem encountered: undefined method `new' for class Symbol
Backtrace (last 10 lines):
/hexapdf-1.0.1/lib/hexapdf/document.rb:388:in `wrap'
/hexapdf-1.0.1/lib/hexapdf/dictionary_fields.rb:211:in `convert'
/hexapdf-1.0.1/lib/hexapdf/dictionary_fields.rb:179:in `block in convert'
/hexapdf-1.0.1/lib/hexapdf/dictionary_fields.rb:178:in `each'
/hexapdf-1.0.1/lib/hexapdf/dictionary_fields.rb:178:in `convert'
/hexapdf-1.0.1/lib/hexapdf/dictionary.rb:172:in `[]'
/hexapdf-1.0.1/lib/hexapdf/dictionary.rb:216:in `block in each'
/hexapdf-1.0.1/lib/hexapdf/dictionary.rb:216:in `each_key'
/hexapdf-1.0.1/lib/hexapdf/dictionary.rb:216:in `each'
/hexapdf-1.0.1/lib/hexapdf/task/optimize.rb:221:in `delete_fields_with_defaults'
--> The problem might indicate a faulty PDF or a bug in HexaPDF.
It worked with the pre-1.0 release, attaching an example for you
I just ran hexapdf optimize packing_list.pdf packing_list_out.pdf
But it doesn't matter any operation on this file will cause it
@cbillen Thanks for providing the file! I found the culprit and pushed the fix to the devel branch on Github. Could you please test if this now also fixes the problem for you? Thanks!
@gettalong I confirm it works now, thank you
@cbillen Thanks for confirming! I'm currently working on another bug and once that is also fixed, I will release another version.
@cbillen @rubyFeedback The latest version of HexaPDF contains the fix for this bug.
Sers,
I issued the following command, from the commandline (terminal):
The result was:
I am using hexapdf version 1.0.0 right now.
It has worked on the same .pdf file before; not sure why hexapdf suddenly does not work on it. I did, however had, re-install my ruby too.
Anyway. The error message "Problem encountered: undefined method `new' for class Symbol" is not extremely helpful in that it says "new" is called on a class Symbol variant, but not much more than that. Not sure how the code there can call .new on a Symbol.
The .pdf file could also be faulty, but even then it is a bit odd to see .new called on a Symbol. That should ideally not happen. Either way, it could also be considered to show a bit more context here. As far as I know I just tested the above on the commandline directly. If I made a syntax error then hexapdf should probably notify me of that; otherwise I think hexapdf should "just work" here, without relying on that weird .new for class Symbol.
Anyway, I reported this just as the commandline notification recommended to do so. Perhaps there may be simple ways to obtain additional information or enabling more debug-support (and perhaps mention this somewhere on the homepage, if that is the case; right now we seem to only get those ~3 lines shown above, which I am unsure is sufficient to find out where the culprit code is to call .new on a Symbol).
Edit: The same command works fine on other .pdf files; and hexapdf also worked fine on that .pdf file itself. I'll test that .pdf file a bit and see whether qpdf manages to chop off the first page.
Edit2: Yes, qpdf works fine on the same .pdf file (it removed those pages from the .pdf file just fine), so I am almost 100% certain that hexapdf must be doing something incorrectly. I'll play with it around a little and see whether I can perhaps create a 3 pages .pdf from that, showing just that problem in hexapdf.