Class | Prawn::Document::BoundingBox
In: | lib/prawn/document/bounding_box.rb
Parent: | Object

### Methods

absolute_bottom absolute_bottom_left absolute_bottom_right absolute_left absolute_right absolute_top absolute_top_left absolute_top_right anchor bottom bottom_left bottom_right height left left_side move_past_bottom right right_side stretchy? top top_left top_right width

### Public Instance methods

absolute_bottom()

Absolute bottom y-coordinate of the bottom box

absolute_bottom_left()

Absolute bottom-left point of the bounding box

absolute_bottom_right()

Absolute bottom-left point of the bounding box

absolute_left()

Absolute left x-coordinate of the bounding box

absolute_right()

Absolute right x-coordinate of the bounding box

absolute_top()

Absolute top y-coordinate of the bounding box

absolute_top_left()

Absolute top-left point of the bounding box

absolute_top_right()

Absolute top-right point of the bounding box

anchor()

The translated origin (x,y-height) which describes the location of the bottom left corner of the bounding box

bottom()

Relative bottom y-coordinate of the bounding box (Always 0)

Example, position some text 3 pts from the bottom of the containing box:

     text('hello', :at => [0, (bounds.bottom + 3)])

bottom_left()

Relative bottom-left point of the bounding box

Example, draw a line along the left hand side of the page:

     stroke do
       line(bounds.bottom_left, bounds.top_left)
     end

bottom_right()

Relative bottom-right point of the bounding box

Example, draw a line along the right hand side of the page:

     stroke do
       line(bounds.bottom_right, bounds.top_right)
     end

height()

Height of the bounding box. If the box is ‘stretchy’ (unspecified height attribute), height is calculated as the distance from the top of the box to the current drawing position.

left()

Relative left x-coordinate of the bounding box. (Always 0)

Example, position some text 3 pts from the left of the containing box:

     text('hello', :at => [(bounds.left + 3), 0])

left_side()
move_past_bottom()
right()

Relative right x-coordinate of the bounding box. (Equal to the box width)

Example, position some text 3 pts from the right of the containing box:

     text('hello', :at => [(bounds.right - 3), 0])

right_side()
stretchy?()

Returns `false` when the box has a defined height, `true` when the height is being calculated on the fly based on the current vertical position.

top()

Relative top y-coordinate of the bounding box. (Equal to the box height)

Example, position some text 3 pts from the top of the containing box:

     text('hello', :at => [0, (bounds.top - 3)])

top_left()

Relative top-left point of the bounding_box

Example, draw a line from the top left of the box diagonally to the bottom right:

     stroke do
       line(bounds., bounds.bottom_right)
     end

top_right()

Relative top-right point of the bounding box

Example, draw a line from the top_right of the box diagonally to the bottom left:

     stroke do
       line(bounds.top_right, bounds.bottom_left)
     end

width()

Width of the bounding box

[Validate]