Reputation: 505
I am using a column_box in Prawn. It works well, but overlaps a bounding_box I'm using at the bottom for a footer.
How do I keep it from overlapping, but not adjust the height of the bounding box?
I can explain more about why I don't want to adjust the height, but I don't think its relevant to this question. Here is my code:
def test_section
column_box([0,cursor], :columns => 2, :width => 396) do
text ("This is text" * 10 + "This is too\n") * 25
stroke_color (50,0,50,0)
stroke_bounds
end
bounding_box [margin_box.left, margin_box.bottom + 72], :width => bounds.width, :height => 72 do
font "Helvetica" do
stroke_color (0,0,100,0)
stroke_bounds
text "And here's a sexy footer", :size => 16
end
end
end
Thank you, Anthony
Upvotes: 4
Views: 2661
Reputation: 211
I also had this problem and have found a solution. if you give your column_box a max height, it will stop it flowing into the footer. Not sure how to restrict it to just the last page though, but I have the footer on every page (done with the "repeat :all" around the bounding_box).
column_box([0,cursor], :columns => 2, :width => 396, :height => bounds.height - 80) do
text ("This is text" * 10 + "This is too\n") * 25
stroke_bounds
end
repeat :all do
bounding_box [margin_box.left, margin_box.bottom + 72], :width => bounds.width, :height => 72 do
font "Helvetica" do
stroke_bounds
text "And here's a sexy footer", :size => 16
end
end
end
If you're not using a column_box, put your page content in a bounding_box with a height restriction.
bounding_box([bounds.left, bounds.top], :width => bounds.width, :height => bounds.height - 80) do
#page content
end
Cheers, Dave
Upvotes: 4