首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >新页面中的对虾stroke_bounds

新页面中的对虾stroke_bounds
EN

Stack Overflow用户
提问于 2014-05-07 16:00:17
回答 1查看 266关注 0票数 1

我在我的rails项目中有这段代码,用来生成pdf文件。

代码语言:javascript
复制
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 },但这只给出了一行。同样,我不能使用矩形,因为内容是不固定的。我该怎么做呢?

EN

回答 1

Stack Overflow用户

发布于 2018-10-08 19:47:31

试试这个:

代码语言:javascript
复制
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

这对我很管用。我希望它对你也有帮助。:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23512074

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档