Class: PdfCombinator::PdfPage

Inherits:
Object
  • Object
show all
Defined in:
lib/pdf_combinator.rb

Overview

Decorator to mimic CombinedPdf syntax

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pdf_page) ⇒ PdfPage

Returns a new instance of PdfPage.



107
108
109
# File 'lib/pdf_combinator.rb', line 107

def initialize(pdf_page)
  @page = pdf_page
end

Instance Attribute Details

#pageObject (readonly)

Returns the value of attribute page.



105
106
107
# File 'lib/pdf_combinator.rb', line 105

def page
  @page
end

Instance Method Details

#orientation(new_orientation = nil) ⇒ Symbol

Returns the page's current orientation (rotates first when an argument is given).

Returns:

  • (Symbol)

    the page's current orientation (rotates first when an argument is given)



112
113
114
115
# File 'lib/pdf_combinator.rb', line 112

def orientation(new_orientation = nil)
  page.rotate(-90) if new_orientation && page.orientation != new_orientation
  page.orientation
end

#orientation=(new_orientation) ⇒ void

This method returns an undefined value.

Returns rotates the page to the new orientation.



118
119
120
121
122
# File 'lib/pdf_combinator.rb', line 118

def orientation=(new_orientation)
  return unless page.orientation != new_orientation

  page.rotate(-90)
end