Closed adam-e-trepanier closed 3 years ago
This arose for me when I use wkhtmltopdf to turn EML(email) files into pdf after doing a little HTML manipulation. The way the code looks seems to me that the conditional branch has not used until now; otherwise, this error (I think) would have shown itself. I looked at the tests and am not sure how I would go about exercising this case. I am happy to share an example test file if needed for the bug to raise itself.
Same issue with me. Please merge this.
Upvote! All my PDF combinations get this error. I have edited my local gem to add a conditional check on line 582 of lib/combine_pdf/parser.rb, but that is a hack. I think this PR is the correct solution.
Hi @adam-e-trepanier ,
Thanks for the PR!
P.S.
Sorry for the belated merge... I don't really use CombinePDF anymore and I still hadn't found a maintainer for the gem. People use it, so it's still alive, but my memory of the PDF standard and this code-base is becoming hazier every day.
Anyway, thanks again!.
B.
Thank you! We use your gem in several places, and in one of them this problem was causing exceptions 100% of the time.
Hi @adam-e-trepanier ,
Thanks for the PR!
P.S.
Sorry for the belated merge... I don't really use CombinePDF anymore and I still hadn't found a maintainer for the gem. People use it, so it's still alive, but my memory of the PDF standard and this code-base is becoming hazier every day.
Anyway, thanks again!.
B.
No worries @boazsegev, THANK YOU for your contribution to combine_pdf.
In the instance where the catalogs variable does not have a :ProcSet key, the code generates a new hash and assigns it to that key. It then tries to dup the value in that new hash for a key that does not exist. Other code above uses the inheritance_hash to dup when the data does not exists, and this follows that same flow.
EDIT: On further processing, when trying to create pages from a pdf loaded using inheritance_hash, it will raise an error. Simply using an empty array gets past the error and allows you to save individual pages.