boazsegev / combine_pdf

A Pure ruby library to merge PDF files, number pages and maybe more...
MIT License
734 stars 156 forks source link

NoMethodError: undefined method `[]' for nil:NilClass #54

Closed iggant closed 8 years ago

iggant commented 8 years ago

with some pdfs I have strange error:

NoMethodError: undefined method `[]' for nil:NilClass
    from /path_to_gem/ruby/2.2.0/gems/combine_pdf-0.2.17/lib/combine_pdf/page_methods.rb:876:in `block (2 levels) in should_secure?'

I have digg into that code and debug that v variable has this value:

{:F6=>{:is_reference_only=>true, :referenced_object=>{:Type=>:Font, :Subtype=>:TrueType, :BaseFont=>:"Arial-BoldMT", :FirstChar=>30, :LastChar=>255, :Encoding=>:WinAnsiEncoding, :Widths=>[750, 750, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 750, 556, 750, 278, 556, 500, 1000, 556, 556, 333, 1000, 667, 333, 1000, 750, 611, 750, 750, 278, 278, 500, 500, 350, 556, 1000, 333, 1000, 556, 333, 944, 750, 500, 667, 278, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 333, 737, 552, 400, 549, 333, 333, 333, 576, 556, 333, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556], :FontDescriptor=>{:is_reference_only=>true, :referenced_object=>{:Type=>:FontDescriptor, :Ascent=>728, :CapHeight=>0, :Descent=>-210, :Flags=>42, :FontBBox=>[-628, -376, 2000, 1018], :FontName=>:Arial_Bold, :ItalicAngle=>0, :StemV=>0}}}}, :F7=>{:is_reference_only=>true, :referenced_object=>{:Type=>:Font, :Subtype=>:TrueType, :BaseFont=>:ArialMT, :FirstChar=>30, :LastChar=>255, :Encoding=>:WinAnsiEncoding, :Widths=>[750, 750, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 750, 556, 750, 222, 556, 333, 1000, 556, 556, 333, 1000, 667, 333, 1000, 750, 611, 750, 750, 222, 222, 333, 333, 350, 556, 1000, 333, 1000, 500, 333, 944, 750, 500, 667, 278, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 333, 737, 552, 400, 549, 333, 333, 333, 576, 537, 333, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500], :FontDescriptor=>{:is_reference_only=>true, :referenced_object=>{:Type=>:FontDescriptor, :Ascent=>728, :CapHeight=>0, :Descent=>-210, :Flags=>42, :FontBBox=>[-665, -325, 2000, 1006], :FontName=>:Arial, :ItalicAngle=>0, :StemV=>0}}}}, :F21=>{:is_reference_only=>true, :referenced_object=>{:Type=>:Font, :Subtype=>:TrueType, :BaseFont=>:"Arial-ItalicMT", :FirstChar=>30, :LastChar=>255, :Encoding=>:WinAnsiEncoding, :Widths=>[750, 750, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 750, 556, 750, 222, 556, 333, 1000, 556, 556, 333, 1000, 667, 333, 1000, 750, 611, 750, 750, 222, 222, 333, 333, 350, 556, 1000, 333, 1000, 500, 333, 944, 750, 500, 667, 278, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 333, 737, 552, 400, 549, 333, 333, 333, 576, 537, 333, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500], :FontDescriptor=>{:is_reference_only=>true, :referenced_object=>{:Type=>:FontDescriptor, :Ascent=>728, :CapHeight=>0, :Descent=>-208, :Flags=>106, :FontBBox=>[-517, -325, 1359, 998], :FontName=>:Arial_Italic, :ItalicAngle=>-12, :StemV=>0}}}}, :F37=>{:is_reference_only=>true, :referenced_object=>{:Type=>:Font, :Subtype=>:TrueType, :BaseFont=>:"Arial-BoldItalicMT", :FirstChar=>30, :LastChar=>255, :Encoding=>:WinAnsiEncoding, :Widths=>[750, 750, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 750, 556, 750, 278, 556, 500, 1000, 556, 556, 333, 1000, 667, 333, 1000, 750, 611, 750, 750, 278, 278, 500, 500, 350, 556, 1000, 333, 1000, 556, 333, 944, 750, 500, 667, 278, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 333, 737, 552, 400, 549, 333, 333, 333, 576, 556, 333, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556], :FontDescriptor=>{:is_reference_only=>true, :referenced_object=>{:Type=>:FontDescriptor, :Ascent=>728, :CapHeight=>0, :Descent=>-210, :Flags=>106, :FontBBox=>[-560, -376, 1390, 1018], :FontName=>:Arial_Bold_Italic, :ItalicAngle=>-12, :StemV=>0}}}}, :F63=>{:is_reference_only=>true, :referenced_object=>{:Type=>:Font, :Subtype=>:TrueType, :BaseFont=>:"TimesNewRomanPS-BoldMT", :FirstChar=>30, :LastChar=>255, :Encoding=>:WinAnsiEncoding, :Widths=>[778, 778, 250, 333, 555, 500, 500, 1000, 833, 278, 333, 333, 500, 570, 250, 333, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 570, 570, 570, 500, 930, 722, 667, 722, 722, 667, 611, 778, 778, 389, 500, 778, 667, 944, 722, 778, 611, 778, 722, 556, 667, 722, 722, 1000, 722, 722, 667, 333, 278, 333, 581, 500, 333, 500, 556, 444, 556, 444, 333, 500, 556, 278, 333, 556, 278, 833, 556, 500, 556, 556, 444, 389, 333, 556, 500, 722, 500, 500, 444, 394, 220, 394, 520, 778, 500, 778, 333, 500, 500, 1000, 500, 500, 333, 1000, 556, 333, 1000, 778, 667, 778, 778, 333, 333, 500, 500, 350, 500, 1000, 333, 1000, 389, 333, 722, 778, 444, 722, 250, 333, 500, 500, 500, 500, 220, 500, 333, 747, 300, 500, 570, 333, 747, 500, 400, 549, 300, 300, 333, 576, 540, 333, 333, 300, 330, 500, 750, 750, 750, 500, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 389, 389, 389, 389, 722, 722, 778, 778, 778, 778, 778, 570, 778, 722, 722, 722, 722, 722, 611, 556, 500, 500, 500, 500, 500, 500, 722, 444, 444, 444, 444, 444, 278, 278, 278, 278, 500, 556, 500, 500, 500, 500, 500, 549, 500, 556, 556, 556, 556, 500, 556, 500], :FontDescriptor=>{:is_reference_only=>true, :referenced_object=>{:Type=>:FontDescriptor, :Ascent=>677, :CapHeight=>0, :Descent=>-216, :Flags=>42, :FontBBox=>[-558, -307, 2000, 1026], :FontName=>:Times_New_Roman_Bold, :ItalicAngle=>0, :StemV=>0}}}}, :F65=>{:is_reference_only=>true, :referenced_object=>{:Type=>:Font, :Subtype=>:TrueType, :BaseFont=>:"TimesNewRomanPS-ItalicMT", :FirstChar=>30, :LastChar=>255, :Encoding=>:WinAnsiEncoding, :Widths=>[778, 778, 250, 333, 420, 500, 500, 833, 778, 214, 333, 333, 500, 675, 250, 333, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 333, 333, 675, 675, 675, 500, 920, 611, 611, 667, 722, 611, 611, 722, 722, 333, 444, 667, 556, 833, 667, 722, 611, 722, 611, 500, 556, 722, 611, 833, 611, 556, 556, 389, 278, 389, 422, 500, 333, 500, 500, 444, 500, 444, 278, 500, 500, 278, 278, 444, 278, 722, 500, 500, 500, 500, 389, 389, 278, 500, 444, 667, 444, 444, 389, 400, 275, 400, 541, 778, 500, 778, 333, 500, 556, 889, 500, 500, 333, 1000, 500, 333, 944, 778, 556, 778, 778, 333, 333, 556, 556, 350, 500, 889, 333, 980, 389, 333, 667, 778, 389, 556, 250, 389, 500, 500, 500, 500, 275, 500, 333, 760, 276, 500, 675, 333, 760, 500, 400, 549, 300, 300, 333, 576, 523, 250, 333, 300, 310, 500, 750, 750, 750, 500, 611, 611, 611, 611, 611, 611, 889, 667, 611, 611, 611, 611, 333, 333, 333, 333, 722, 667, 722, 722, 722, 722, 722, 675, 722, 722, 722, 722, 722, 556, 611, 500, 500, 500, 500, 500, 500, 500, 667, 444, 444, 444, 444, 444, 278, 278, 278, 278, 500, 500, 500, 500, 500, 500, 500, 549, 500, 500, 500, 500, 500, 444, 500, 444], :FontDescriptor=>{:is_reference_only=>true, :referenced_object=>{:Type=>:FontDescriptor, :Ascent=>694, :CapHeight=>0, :Descent=>-216, :Flags=>106, :FontBBox=>[-498, -307, 1333, 1023], :FontName=>:Times_New_Roman_Italic, :ItalicAngle=>-16, :StemV=>0}}}}, :F68=>{:is_reference_only=>true, :referenced_object=>{:Type=>:Font, :Subtype=>:TrueType, :BaseFont=>:TimesNewRomanPSMT, :FirstChar=>30, :LastChar=>255, :Encoding=>:WinAnsiEncoding, :Widths=>[778, 778, 250, 333, 408, 500, 500, 833, 778, 180, 333, 333, 500, 564, 250, 333, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278, 564, 564, 564, 444, 921, 722, 667, 667, 722, 611, 556, 722, 722, 333, 389, 722, 611, 889, 722, 722, 556, 722, 667, 556, 611, 722, 722, 944, 722, 722, 611, 333, 278, 333, 469, 500, 333, 444, 500, 444, 500, 444, 333, 500, 500, 278, 278, 500, 278, 778, 500, 500, 500, 500, 333, 389, 278, 500, 500, 722, 500, 500, 444, 480, 200, 480, 541, 778, 500, 778, 333, 500, 444, 1000, 500, 500, 333, 1000, 556, 333, 889, 778, 611, 778, 778, 333, 333, 444, 444, 350, 500, 1000, 333, 980, 389, 333, 722, 778, 444, 722, 250, 333, 500, 500, 500, 500, 200, 500, 333, 760, 276, 500, 564, 333, 760, 500, 400, 549, 300, 300, 333, 576, 453, 333, 333, 300, 310, 500, 750, 750, 750, 444, 722, 722, 722, 722, 722, 722, 889, 667, 611, 611, 611, 611, 333, 333, 333, 333, 722, 722, 722, 722, 722, 722, 722, 564, 722, 722, 722, 722, 722, 722, 556, 500, 444, 444, 444, 444, 444, 444, 667, 444, 444, 444, 444, 444, 278, 278, 278, 278, 500, 500, 500, 500, 500, 500, 500, 549, 500, 500, 500, 500, 500, 500, 500, 500], :FontDescriptor=>{:is_reference_only=>true, :referenced_object=>{:Type=>:FontDescriptor, :Ascent=>693, :CapHeight=>0, :Descent=>-216, :Flags=>42, :FontBBox=>[-568, -307, 2000, 1007], :FontName=>:Times_New_Roman, :ItalicAngle=>0, :StemV=>0}}}}, :R8=>{:is_reference_only=>true, :referenced_object=>{:BaseFont=>:"OKDLIF+Helvetica,Bold", :FontDescriptor=>{:is_reference_only=>true, :referenced_object=>{:Type=>:FontDescriptor, :FontName=>:"OKDLIF+Helvetica,Bold", :FontBBox=>[-22, -218, 703, 729], :Flags=>32, :Ascent=>729, :CapHeight=>729, :Descent=>-218, :ItalicAngle=>0, :StemV=>105, :MissingWidth=>500, :XHeight=>549, :CharSet=>"/A/D/T/d/f/five/nine/one/p/two/underscore/zero", :FontFile3=>{:is_reference_only=>true, :referenced_object=>{:Filter=>:FlateDecode, :Subtype=>:Type1C, :Length=>1132, :raw_stream_content=>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, 0, 0, 0, 0, 0, 0, 0, 722, 0, 0, 722, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 611, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 556, 0, 0, 0, 0, 611, 0, 333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 611], :Encoding=>:WinAnsiEncoding, :Subtype=>:Type1}}}

while k is equal to :Font

so as a work arround add additional check actual_value(v[k]) to this string:

v.keys.each do |name| return true if actual_value(foreign_res[k]) && actual_value(foreign_res[k])[name] && actual_value(v[k]) && actual_value(foreign_res[k])[name] != actual_value(v[k])[name]
code
boazsegev commented 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.

boazsegev commented 8 years ago

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.

iggant commented 8 years ago

@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

cw6365 commented 8 years ago

Hi @boazsegev

I have a similar issue.

[15] pry(#)> page << textpdf.pages[index] NoMethodError: undefined method []' 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:inblock (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.

boazsegev commented 8 years ago

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.

boazsegev commented 8 years ago

@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?

cw6365 commented 8 years ago

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.

cw6365 commented 8 years ago

I've also sent the doc too.

boazsegev commented 8 years ago

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.

boazsegev commented 8 years ago

Hi @cw6365 ,

Thanks for the document!

I still can't seem to reproduce, but maybe the patch works.

cw6365 commented 8 years ago

The patch worked thanks!

boazsegev commented 8 years ago

Thanks for letting me know, I'll release the update soon. :-)

iggant commented 8 years ago

@boazsegev

thank you, I can also confirm that all work fine

boazsegev commented 8 years ago

@iggant , Thanks for letting me know :)