Could not draw bounding box border in prawn

1.7k views Asked by At

How do i draw a border around bounding box with specific setting

bounding_box([175, starting_y - 190], :width => 30.mm, :height => 17.mm) do
  stroke_color 'FFFF00'
  dash 10, space: 4
  stroke_bounds
end

I would like to have border dotted for bottom alone, How will i have this?

I tried searching in stroke, stroke_bounds, bounding_box of prawn document, i could not find anything

1

There are 1 answers

0
Eric Duminil On

You could draw the lines separately :

require "prawn"

Prawn::Document.generate("bbox.pdf") do
  x = 175
  y = 200
  width = 100
  height = 50
  color = 'FFFF00'

  stroke do
    stroke_color color
    vertical_line   y, y+height, :at => x
    vertical_line   y, y+height, :at => x+width
    horizontal_line x, x+width,  :at => y+height
  end

  stroke do
    stroke_color color
    dash 10, space: 4
    horizontal_line x, x+width, :at => y
  end
end

It outputs

enter image description here