Class: Preflight::Rules::PrintBoxes
- Inherits:
-
Object
- Object
- Preflight::Rules::PrintBoxes
- Defined in:
- lib/preflight/rules/print_boxes.rb
Overview
For PDFX/1a, every page must have MediaBox, plus either ArtBox or TrimBox
Instance Attribute Summary collapse
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
Instance Method Summary collapse
- #begin_page(hash = {}) ⇒ Object
- #begin_page_container(hash = {}) ⇒ Object
-
#initialize ⇒ PrintBoxes
constructor
A new instance of PrintBoxes.
Constructor Details
#initialize ⇒ PrintBoxes
Returns a new instance of PrintBoxes.
12 13 14 15 16 |
# File 'lib/preflight/rules/print_boxes.rb', line 12 def initialize @messages = [] @page_num = 0 @parent = {} end |
Instance Attribute Details
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
10 11 12 |
# File 'lib/preflight/rules/print_boxes.rb', line 10 def @messages end |
Instance Method Details
#begin_page(hash = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/preflight/rules/print_boxes.rb', line 22 def begin_page(hash = {}) @page_num += 1 hash = @parent.merge(hash) if hash[:MediaBox].nil? @messages << "every page must have a MediaBox (page #{@page_num})" elsif hash[:ArtBox].nil? && hash[:TrimBox].nil? @messages << "every page must have either an ArtBox or a TrimBox (page #{@page_num})" elsif hash[:ArtBox] && hash[:TrimBox] @messages << "no page can have both ArtBox and TrimBox - TrimBox is preferred (page #{@page_num})" end end |
#begin_page_container(hash = {}) ⇒ Object
18 19 20 |
# File 'lib/preflight/rules/print_boxes.rb', line 18 def begin_page_container(hash = {}) @parent.merge!(hash) end |