Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

combine_pdf/parser.rb:188:in `[]': no implicit conversion of Symbol into Integer (TypeError) #240

Open
shahafabileah opened this issue Jun 4, 2024 · 0 comments

Comments

@shahafabileah
Copy link

Thanks for all your work on CombindPDF. It's been great to use!

Here's one PDF that CombinePDF seems to have trouble parsing.
AHN AGB.pdf

I try to parse the attached PDF like this:

CombinePDF.load(file_path, allow_optional_content: true)

I get this error:

/app/vendor/bundle/ruby/3.2.0/gems/combine_pdf-1.0.24/lib/combine_pdf/parser.rb:188:in `[]': no implicit conversion of Symbol into Integer (TypeError)

      @info_object = @root_object[:Info] ? (@root_object[:Info][:referenced_object] || @root_object[:Info]) : false
                                                                ^^^^^^^^^^^^^^^^^^

Looks like this is the line of code:

@info_object = @root_object[:Info] ? (@root_object[:Info][:referenced_object] || @root_object[:Info]) : false

I gather that @root_object[:Info] is expected to be a hash, but it's not in this case.

I found that re-saving the document as a new PDF (in Preview on OSX) gets by this problem. I don't know if the original PDF is valid or not, i.e. if the issue is with the PDF or with the gem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant