Shrimp: Is there a way to vertically align all the contents in a box?

I am trying to place content vertically centered in bounding_box. With one text this is not a problem:

bounding_box([0, bounds.top], :width => pdf.bounds.right, :height => pdf.bounds.top) do text "vertically aligned in the surrounding box", :valign => :center end 

But what can I do if I have several elements in my 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 text "vertically aligned in the surrounding box", :valign => :center end 

This will not work, the text will be overlaid when you try this ...

I am looking for a way to group all bounding_box content and then align this group vertically. Is there any way to do this with shrimp ??

Many thanks for your help! Chris

+7
source share
1 answer

If you only have text strings, you can use formatted_text with \n in the text:

 formatted_text [ { text: "#{line1}\n" }, { text: "#{line2}" } ], valign: :center, leading: 6 

I'm still trying to figure out how to handle a group of images / legends since even tables don't seem to do the trick.

+4
source

All Articles