Method: PrawnHtml::PdfWrapper#draw_rectangle

Defined in:
lib/prawn_html/pdf_wrapper.rb

#draw_rectangle(x:, y:, width:, height:, color:) ⇒ Object

Draw a rectangle

Parameters:

  • x (Float)

    left position of the rectangle

  • y (Float)

    top position of the rectangle

  • width (Float)

    width of the rectangle

  • height (Float)

    height of the rectangle

  • color (String)

    fill color



74
75
76
77
78
79
# File 'lib/prawn_html/pdf_wrapper.rb', line 74

def draw_rectangle(x:, y:, width:, height:, color:)
  current_fill_color = pdf.fill_color
  pdf.fill_color = color
  pdf.fill_rectangle([y, x], width, height)
  pdf.fill_color = current_fill_color
end