Several bounding boxes of varying height

17 views
Skip to first unread message

aj_dholt

unread,
Sep 8, 2008, 1:38:08 AM9/8/08
to Prawn
I'm generating a report that will need to closely match a page with
several sections of text (different sections of a SWOT analysis on top
of each other). Each of these sections, which was going to consist of
a bounding box for the text, will be of varying size. To position each
subsequent bounding box, I'm guessing I need either the current y
position on a page, or I need to do a set of nested boxes, so I can
distance each one from the bottom of the previous one (of a dynamic
height).

Getting the current cursor position would be easiest, but I can't find
anything in the docs or here that mentions how to do that.

I suppose this could also be done with a table, but the formatting
requirements might make that impossible.

Thanks!

Gregory Brown

unread,
Sep 8, 2008, 8:41:19 AM9/8/08
to prawn...@googlegroups.com
On Mon, Sep 8, 2008 at 1:38 AM, aj_dholt <and...@gmail.com> wrote:
>
> I'm generating a report that will need to closely match a page with
> several sections of text (different sections of a SWOT analysis on top
> of each other). Each of these sections, which was going to consist of
> a bounding box for the text, will be of varying size. To position each
> subsequent bounding box, I'm guessing I need either the current y
> position on a page, or I need to do a set of nested boxes, so I can
> distance each one from the bottom of the previous one (of a dynamic
> height).
>
> Getting the current cursor position would be easiest, but I can't find
> anything in the docs or here that mentions how to do that.

The current position (relative to the margins or the enclosing bounding box is)

pdf.y - pdf.bounds.absolute_bottom

I've yet to think of a good name for that calculation, otherwise I'd
simplify this.

Since bounding boxes move you directly below them even with dynamic
heights, it seems like this approach may work for you.

-greg

--
Technical Blaag at: http://blog.majesticseacreature.com | Non-tech
stuff at: http://metametta.blogspot.com

aj_dholt

unread,
Sep 8, 2008, 2:06:08 PM9/8/08
to Prawn
Perfect, works great. Thanks!!

On Sep 8, 5:41 am, "Gregory Brown" <gregory.t.br...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages