Ruby on rails 新页面中的对虾划伤界限

Ruby on rails 新页面中的对虾划伤界限,ruby-on-rails,prawn,Ruby On Rails,Prawn,我在rails项目中使用prawn生成pdf的代码 bounding_box([(bounds.left + 5), bounds.top - 130], width: 750) do font_size(10) text "#{@post.description}", inline_format: :true, :overflow => :expand end 文本内容可能为2-3页。我想在文本周围创建一个边框。我该怎么做

我在rails项目中使用prawn生成pdf的代码

bounding_box([(bounds.left + 5), bounds.top - 130], width: 750) do    
        font_size(10)
        text "#{@post.description}", inline_format: :true, :overflow => :expand      
      end
文本内容可能为2-3页。我想在文本周围创建一个边框。我该怎么做

我尝试了
transparent(0.5){stroke_bounds}
,但这只给出了一行。同样,我不能使用矩形,因为内容是不固定的。我该怎么做?

试试这个:

bounding_box([(bounds.left + 5), bounds.top - 130], width: 750) do |t|   
  t.before_rendering_page do |page|
    stroke_bounds
  end
  font_size(10)
  text "#{@post.description}", inline_format: :true, :overflow => :expand      
end

它对我有用。我希望它对你也有用。:)

这仅适用于表,而不适用于边界框