无法在对虾中绘制边界框边框

时间:2016-12-26 10:21:04

标签: ruby-on-rails ruby prawn

如何使用特定设置在边界框周围绘制边框

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

我想单独为底部点缀边框,我将如何拥有它?

我试着在笔画,stroke_bounds,prawn文件的bounding_box中搜索,我找不到任何东西

1 个答案:

答案 0 :(得分:1)

您可以单独画线:

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

输出

enter image description here