I want a PDF document with a table followed by a footer of sorts. The
table may span several pages, and on the last page, there should be a
footer (a "sign on the dotted line" type thing) at the page bottom
(not out in the margins).
The footer may be on a page of its own if there's no room for it at
the bottom of the last page of the table.
If I just do pdf.table followed by a bounding_box positioned at
bottom, then the table and footer may overlap. See the example at the
end of the mail (Pastie:
http://pastie.textmate.org/private/k0643puqyludym04fzmpqw).
Currently using Prawn 0.5.1 but can probably use edge if necessary.
I suppose I could compare the top coordinate of the footer with the
bottom coordinate of the table and insert a page break if they
overlap, but I'm sure there is a better way.
I'm guessing I shouldn't be using a bounding_box, but I'm not sure
what I should be using. The example below is, of course, simplified.
The real footer contains several text bits and dotted lines.
The code example:
LINE_COUNT = 30
require 'rubygems'
require 'prawn'
require "prawn/layout"
pdf = Prawn::Document.new(:page_size => "A4")
pdf.table [["Foo", "Bar"]] * LINE_COUNT
pdf.bounding_box([0, 100], :width => pdf.bounds.width, :height => 100)
do
pdf.stroke_bounds
pdf.text "Sign here:"
end
pdf.render_file('prawn.pdf')
# OS X
`open prawn.pdf`