Hi all,
Our existing bank statement process had become a bit cumbersome, and we decided we were going to transition it to Ruby. It's been an utter joy to use Prawn, but I've run into a bit of a snag.
On the first page of our statements, we have a number of statistics about past payments, current balance, etc. as well as the start of a list of transactions. This list of transactions has room for four lines, and then needs to continue onto the next page. Unfortunately, it's currently in the middle of the document like so:
My understanding is that you can wrap a table in a bounding box to accomplish the first page's worth of transactions. I've tried the following, and can get the transaction list to fit just where I want on page one. Unfortunately, it repeats in the same location on all pages, when I'd rather reset the bounding box dimensions for anything page two and beyond.
Prawn::Document.generate(filename="example.pdf") do |pdf|
data = [["Column 1", "Column 2", "Column 3", "Column 4"]]
100.times {|i| data << ["Row #{i}", "Row #{i}", "Row #{i}", "Row #{i}"]}
x = 100
y = 600
width = 500
height = 400
box = pdf.bounding_box([x, y], :width => width, :height => 400) do
pdf.table(data, {:header => true}) do |t|
# Set up formatting for the header row
t.row(0).style :font_style => :bold,
:background_color => "000000",
:text_color => "FFFFFF"
end
end
end
Is there a way to change the size of the bounding box for the second page? Is there a better way of doing this other than simply making two tables and splitting the array into what will fit onto page one?
Thanks,
Adam