Class: EideticPDF::PageStyle

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

Overview

:nodoc:

Constant Summary collapse

PORTRAIT =
0
LANDSCAPE =
270
SIZES =
{
  :letter => [612, 792].freeze,
  :legal => [612, 1008].freeze,
  :A4 => [595, 842].freeze,
  :B5 => [499, 708].freeze,
  :C5 => [459, 649].freeze
}
ROTATIONS =
{ :portrait => PORTRAIT, :landscape => LANDSCAPE }.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PageStyle

Returns a new instance of PageStyle.



34
35
36
37
38
39
40
41
42
# File 'lib/epdfpw.rb', line 34

def initialize(options={})
  page_size = options[:page_size] || :letter
  crop_size = options[:crop_size] || page_size
  @orientation = options[:orientation] || :portrait
  @page_size = make_size_rectangle(page_size, @orientation)
  @crop_size = make_size_rectangle(crop_size, @orientation)
  @landscape = (@orientation == :landscape)
  @rotate = ROTATIONS[options[:rotate] || :portrait]
end

Instance Attribute Details

#crop_sizeObject (readonly)

Returns the value of attribute crop_size.



29
30
31
# File 'lib/epdfpw.rb', line 29

def crop_size
  @crop_size
end

#landscapeObject (readonly)

Returns the value of attribute landscape.



29
30
31
# File 'lib/epdfpw.rb', line 29

def landscape
  @landscape
end

#orientationObject (readonly)

Returns the value of attribute orientation.



29
30
31
# File 'lib/epdfpw.rb', line 29

def orientation
  @orientation
end

#page_sizeObject (readonly)

Returns the value of attribute page_size.



29
30
31
# File 'lib/epdfpw.rb', line 29

def page_size
  @page_size
end

#rotateObject (readonly)

Returns the value of attribute rotate.



29
30
31
# File 'lib/epdfpw.rb', line 29

def rotate
  @rotate
end