Class: Preflight::Rules::MediaboxAtOrigin

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

Overview

Checks the MediaBox for every page is at 0,0. This isn’t required by any standards but is good practice to ensure correct rendering with some applications.

Arguments: none

Usage:

class MyPreflight
  include Preflight::Profile

  rule Preflight::Rules::MediaboxAtOrigin
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#issuesObject (readonly)

Returns the value of attribute issues.



24
25
26
# File 'lib/preflight/rules/mediabox_at_origin.rb', line 24

def issues
  @issues
end

Instance Method Details

#page=(page) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/preflight/rules/mediabox_at_origin.rb', line 26

def page=(page)
  @issues = []
  dict = page.attributes

  if round_off(dict[:MediaBox][0,2]) != [0,0]
    @issues << Issue.new("MediaBox must begin at 0,0", self, :page => page.number)
  end
end