two-column layout issue

19 views
Skip to first unread message

macsig

unread,
Nov 20, 2009, 5:07:42 PM11/20/09
to Prawn
Hello guys I'm trying to create a two-column layout (in Prawn 0.4.1; I
plan to update to 0.6.3 soon but now I have to make this works) but I
have some issues with it.

Here my code:

#left colum
bounding_box([0,470], :width => 360, :height => 450) do
data = [ ...]
table data, ...
end

#right column
bounding_box([370,470], :width => 360, :height => 450) do
data2 = [ ...]
table data2, ...
end

and here the issue:

Let us say I display 10 rows per table and both data and data2 contain
30 element (60 elements total) with 20 elements per page I need 3
pages.
Actually the PDF has 5 pages: page 1 and 2 with only left column, page
3 with both columns and I have page 4 and 5 with only right column.

Am I missing something? Why does it create both column only in the
last required page?

Thanks and have a nice weekend.


Sig

Gregory Brown

unread,
Nov 20, 2009, 8:09:24 PM11/20/09
to prawn...@googlegroups.com
On Fri, Nov 20, 2009 at 5:07 PM, macsig <sigb...@gmail.com> wrote:

> Hello guys I'm trying to create a two-column layout (in Prawn 0.4.1; I
> plan to update to 0.6.3 soon but now I have to make this works) but I
> have some issues with it.

Okay, but keep in mind 0.4 is not supported at all, and hasn't been
for well over a month.

> Am I missing something? Why does it create both column only in the
> last required page?

Because when you hit the end of a bounding box, it starts at the
top-left corner of the bounding box on the next page.
This is what the documentation says, and how bounding boxes have
worked since "The Beginning of Time".

In Prawn 0.6 you might be able to render your table in the first
bounding box, then do a go_to_page() back to the page you started on,
and render the second table.
That'd be what I'd try given this task.

Alternatively you can paginate your data set and render tables that do
not cause page breaks and manually control flow from page to page.

-greg

macsig

unread,
Nov 20, 2009, 10:01:44 PM11/20/09
to Prawn
thanks for your reply

Sig

On Nov 20, 5:09 pm, Gregory Brown <gregory.t.br...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages