Class: Preflight::Rules::InfoSpecifiesTrapping

Inherits:
Object
  • Object
show all
Defined in:
lib/preflight/rules/info_specifies_trapping.rb

Overview

Every PDF has an optional ‘Info’ dictionary. Check that the dictionary has a ‘Trapped’ entry that is set to True or False

Arguments: none

Usage:

class MyPreflight
  include Preflight::Profile

  rule Preflight::Rules::InfoSpecifiesTrapping
end

Instance Method Summary collapse

Instance Method Details

#check_hash(ohash) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/preflight/rules/info_specifies_trapping.rb', line 20

def check_hash(ohash)
  info = ohash.object(ohash.trailer[:Info])

  if !info.has_key?(:Trapped)
    [ Issue.new("Info dict does not specify Trapped", self) ]
  elsif info[:Trapped] != :True && info[:Trapped] != :False
    [ Issue.new("Trapped value of Info dict must be True or False", self) ]
  else
    []
  end
end