def rounded_text_box(text)
opts = OpenStruct.new
yield(opts)
resize_text_to_box(text, opts)
pdf_writer.save_state
draw_box(opts.x, opts.y, opts.width, opts.height, opts.radius,
opts.fill_color, opts.stroke_color)
add_text_with_bottom_border(opts.heading, opts.x, opts.y,
opts.width, opts.font_size) if opts.heading
pdf_writer.restore_state
start_position = opts.heading ? opts.y - 20 : opts.y
draw_text(text, :y => start_position,
:left => opts.x,
:right => opts.x + opts.width,
:justification => opts.justification || :center,
:font_size => opts.font_size)
move_cursor_to(opts.y - opts.height)
end