Class: PrawnHtml::Callbacks::Background
- Inherits:
-
Object
- Object
- PrawnHtml::Callbacks::Background
- Defined in:
- lib/prawn_html/callbacks/background.rb
Constant Summary collapse
- DEF_HIGHLIGHT =
'ffff00'
Instance Method Summary collapse
-
#initialize(pdf, color = nil) ⇒ Background
constructor
A new instance of Background.
- #render_behind(fragment) ⇒ Object
Constructor Details
#initialize(pdf, color = nil) ⇒ Background
Returns a new instance of Background.
8 9 10 11 |
# File 'lib/prawn_html/callbacks/background.rb', line 8 def initialize(pdf, color = nil) @pdf = pdf @color = color || DEF_HIGHLIGHT end |
Instance Method Details
#render_behind(fragment) ⇒ Object
13 14 15 16 |
# File 'lib/prawn_html/callbacks/background.rb', line 13 def render_behind(fragment) top, left = fragment.top_left @pdf.draw_rectangle(x: left, y: top, width: fragment.width, height: fragment.height, color: @color) end |