yob/pdf-preflight — Issue #5: MalformedPDFError with the NoFilespecs rule
Author: tomtaylor
Created: 2012-01-26 12:19:36+00:00
State: open

[This PDF](http://files.newspaperclub.com.s3.amazonaws.com/tmp/11568.pdf), which doesn't have any external filespecs, throws the following exception when running the NoFilespecs rule against it.

MalformedPDFError: PDF malformed, expected 2 but found 4 instead

The backtrace looks something like this:

[GEM_ROOT]/gems/pdf-reader-1.0.0/lib/pdf/reader/error.rb:44:in `assert_equal'
[GEM_ROOT]/gems/pdf-reader-1.0.0/lib/pdf/reader/parser.rb:97:in `object'
[GEM_ROOT]/gems/pdf-reader-1.0.0/lib/pdf/reader/object_hash.rb:83:in `[]'
[GEM_ROOT]/gems/pdf-reader-1.0.0/lib/pdf/reader/object_hash.rb:149:in `each'
[GEM_ROOT]/gems/pdf-reader-1.0.0/lib/pdf/reader/xref.rb:80:in `each'
[GEM_ROOT]/gems/pdf-reader-1.0.0/lib/pdf/reader/xref.rb:78:in `each'
[GEM_ROOT]/gems/pdf-reader-1.0.0/lib/pdf/reader/object_hash.rb:148:in `each'
[GEM_ROOT]/bundler/gems/pdf-preflight-51f5d7370362/lib/preflight/rules/no_filespecs.rb:32:in `select'
[GEM_ROOT]/bundler/gems/pdf-preflight-51f5d7370362/lib/preflight/rules/no_filespecs.rb:32:in `count_filespec_dicts'
[GEM_ROOT]/bundler/gems/pdf-preflight-51f5d7370362/lib/preflight/rules/no_filespecs.rb:21:in `check_hash'
[GEM_ROOT]/bundler/gems/pdf-preflight-51f5d7370362/lib/preflight/profile.rb:79:in `check_hash'
[GEM_ROOT]/bundler/gems/pdf-preflight-51f5d7370362/lib/preflight/profile.rb:78:in `map'
[GEM_ROOT]/bundler/gems/pdf-preflight-51f5d7370362/lib/preflight/profile.rb:78:in `check_hash'
[GEM_ROOT]/bundler/gems/pdf-preflight-51f5d7370362/lib/preflight/profile.rb:63:in `check_io'
[GEM_ROOT]/gems/pdf-reader-1.0.0/lib/pdf/reader.rb:159:in `open'
[GEM_ROOT]/bundler/gems/pdf-preflight-51f5d7370362/lib/preflight/profile.rb:61:in `check_io'
[GEM_ROOT]/bundler/gems/pdf-preflight-51f5d7370362/lib/preflight/profile.rb:56:in `check_filename'
[GEM_ROOT]/bundler/gems/pdf-preflight-51f5d7370362/lib/preflight/profile.rb:55:in `open'
[GEM_ROOT]/bundler/gems/pdf-preflight-51f5d7370362/lib/preflight/profile.rb:55:in `check_filename'
[GEM_ROOT]/bundler/gems/pdf-preflight-51f5d7370362/lib/preflight/profile.rb:40:in `check'