我在我的rails项目中有这段代码,用来生成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 },但这只给出了一行。同样,我不能使用矩形,因为内容是不固定的。我该怎么做呢?
发布于 2018-10-08 19:47:31
试试这个:
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这对我很管用。我希望它对你也有帮助。:)
https://stackoverflow.com/questions/23512074
复制相似问题