> Currently I have several consecutive bounding_box's, and if I simply
> do not specify a :height for the bounding_box call the content
> displays fine, but the next bounding_box's content overlap the first
> bounding_box, rather than starting after it. I've tried using
> pdf.cursor and pdf.y for the coordinates of the second bounding_box
> call, but with the same results.
>
> Any guidance would be much appreciated.
I'd be happy to help you take a look at this problem, but to do that,
it'd be much better to work against some code samples rather than try
to describe the problem / solution in words. Can you code me up an
example of your problem?
-greg
--
Technical Blaag at: http://blog.majesticseacreature.com
Non-tech stuff at: http://metametta.blogspot.com
"Ruby Best Practices" Book now in O'Reilly Roughcuts:
http://rubybestpractices.com
That's right. It seems like this example reflects the desired behavior.
==================
Prawn::Document.generate("foo.pdf") do
bounding_box bounds.top_left, :width => 400 do
bounding_box [0, cursor], :width => 200 do
text "La la la " * 50
end
bounding_box [50, cursor], :width => 250 do
text "La la la " * 50
end
bounding_box [100, cursor], :width => 100 do
text "la la la " * 50
end
text "la la la" * 50
end
end
`open foo.pdf`
==================
Does that clear anything up, Sam?
Wait a second. You never set the height of Outer Box 1.
So since Inner Box 2 is the bottom box in there, wouldn't you expect
the bottom of Outer Box 1 to equal the bottom of Inner Box 2?
Or are you expecting the cursor to be at the bottom of Inner Box1
because that takes you deeper into the box? That's not how
bounding_box works without a height.
A cheap trick would be to swap your boxes so the longest one is the
last to be rendered.
That having been said, It looks like your master box, and all of your
outer bounding boxes are not needed.
Maybe try this without nesting first, because all three of those are
equivalent to the margin box.
-greg
I think the biggest problem is that this is not how bounding_box works
currently. But I don't see anything wrong with changing it.
This would fix your problem, I imagine.
Please file a ticket for this in Lighthouse to remind me.