Chr*_*own 8 ruby alignment prawn bounding-box valign
我试图将一些内容垂直居中放置在bounding_box中.使用单个文本,这没有问题:
bounding_box([0, bounds.top], :width => pdf.bounds.right, :height => pdf.bounds.top) do
text "vertically aligned in the surrounding box", :valign => :center
end
Run Code Online (Sandbox Code Playgroud)
但是如果我的边界框中有多个元素,我该怎么办:
bounding_box([0, bounds.top], :width => pdf.bounds.right, :height => pdf.bounds.top) do
text "vertically aligned in the surrounding box", :valign => :center
text "vertically aligned in the surrounding box", :valign => :center
end
Run Code Online (Sandbox Code Playgroud)
这不起作用,当你尝试这个时,文本被重叠......
我正在寻找一种方法来分组bounding_box的整个内容,然后垂直对齐整个组.有没有办法用大虾做这个?
非常感谢你的帮助!克里斯
如果你只有文本行,你仍然可以使用formatted_text与\n您的文字:
formatted_text [
{ text: "#{line1}\n" },
{ text: "#{line2}" }
],
valign: :center,
leading: 6
Run Code Online (Sandbox Code Playgroud)
我还在试图弄清楚如何处理一个图片/图例组,因为即使是桌子也似乎没有办法.
| 归档时间: |
|
| 查看次数: |
3393 次 |
| 最近记录: |