Class: Preflight::Rules::PrintBoxes

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

Overview

For PDFX/1a, every page must have MediaBox, plus either ArtBox or TrimBox

Arguments: none

Usage:

class MyPreflight
  include Preflight::Profile

  rule Preflight::Rules::PrintBoxes
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#issuesObject (readonly)

Returns the value of attribute issues.



21
22
23
# File 'lib/preflight/rules/print_boxes.rb', line 21

def issues
  @issues
end

Instance Method Details

#page=(page) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/preflight/rules/print_boxes.rb', line 23

def page=(page)
  dict = page.attributes

  if dict[:MediaBox].nil?
    @issues = [Issue.new("every page must have a MediaBox", self, :page => page.number)]
  elsif dict[:ArtBox].nil? && dict[:TrimBox].nil?
    @issues = [Issue.new("every page must have either an ArtBox or a TrimBox", self, :page => page.number)]
  elsif dict[:ArtBox] && dict[:TrimBox]
    @issues = [Issue.new("no page can have both ArtBox and TrimBox - TrimBox is preferred", self, :page => page.number)]
  else
    @issues = []
  end
end