Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple tables on one page with prawn

I'm using prawn for pdf generation and everything works quite well, but now I'm having a bit of a problem. When I put multiple tables on one page, they just get put over each other and not under each other. Is this normal behaviour and what can I do about it?

I add the tables on the most normal behaviour btw :)

Thanks!

like image 468
Ignace Avatar asked Dec 20 '25 00:12

Ignace


1 Answers

What is the code you're using to create the PDF document with Prawn?

Without that, I'm guessing that you need to use 'bounding boxes' to seperate the different sections / tables in your document. Each bounding box is an area for content rendering, and new bounding boxes or text is rendered below that. See bounding_box() documentation or the example below:

> pdf.bounding_box([100,500], :width => 100, :height => 300) do
>   pdf.text "This text will flow in a very narrow box starting" +
>     "from [100,500]. The pointer will then be moved to [100,200]" +
>     "and return to the margin_box"
> end
like image 60
Jochem Schulenklopper Avatar answered Dec 22 '25 16:12

Jochem Schulenklopper