Closed iggant closed 8 years ago
Hi Anton,
Thank you very much for opening this issue.
I would like to check this a bit further before I implement a patch to the library. Could you send me an example PDF?
Thanks! Bo.
Hi Anton,
Again I wanted to thank you for posting this issue. I was wondering if you had an example for me, as I couldn't reproduce the issue.
This also helps with testing, as I have a bank of examples I test against. All these examples have known issues (or cause known issues) that were resolved. Testing against these examples helps me ensure that future updates don't break existing patches. This is why having an example is important to me.
Thank you for your help.
@boazsegev
I'm very sorry, but for now I can't provide you with pdf file, because this file clients upload us, and this is not supposed to share.
Every file which I generate to test pass this without error. I'll try some different approch, and I'll back if success
Hi @boazsegev
I have a similar issue.
[15] pry(#[]' for nil:NilClass from /Users/chrisward/.rvm/gems/ruby-1.9.3-p551@esign/gems/combine_pdf-0.2.17/lib/combine_pdf/page_methods.rb:876:in
block (2 levels) in should_secure?'
textpdf = CombinePDF.load text_path contentpdf = CombinePDF.load pdf_path contentpdf.pages.each_with_index do |page, index| unless textpdf.pages[index].nil? <!!!--- issue is caused by the line below --> page << textpdf.pages[index] end end contentpdf.save pdf_path
I can email you the file if needed.
Hi Chris (@cw6365 ),
Thanks for letting me know. I'd be happy to get a copy of the file so I can reproduce the issue and implement a patch.
Thanks!
Bo.
@cw6365 , @iggant ,
I uploaded a patch to the page_methods.rb
file.
Since I can't reproduce the issue, I have no idea if it's any better.
Can you test this?
Thanks @boazsegev i'll test in the morning. I'm not positive but i think the problem may be with the line
contentpdf.pages.each_with_index do |page, index|
I think it 99% of cases page
is normally another array, hence page << textpdf.pages[index]
but this time it's just an object. I'm not sure why in this case though as it's been live on production and working well in most instances.
I've also re-tested the file and it works on a different account. Strange one.
I've also sent the doc too.
page should always be an object (a Hash, to be specific). The <<
is a PDF Page object, not an Array push
.
Page Hash objects are extended using the Page_Methods module.
Hi @cw6365 ,
Thanks for the document!
I still can't seem to reproduce, but maybe the patch works.
The patch worked thanks!
Thanks for letting me know, I'll release the update soon. :-)
@boazsegev
thank you, I can also confirm that all work fine
@iggant , Thanks for letting me know :)
with some pdfs I have strange error:
I have digg into that code and debug that v variable has this value:
while k is equal to :Font
so as a work arround add additional check actual_value(v[k]) to this string: