Hi!
You no need to use canvas(), just use bounding_box.
Follow an example:
------- BEGIN CODE --------------
Prawn::Document.new(:page_size => "LETTER", :page_layout => :portrait)
do
#THE HEADER
header margin_box.top_left do
text "Here's My Fancy Header", :size => 25, :align => :center
stroke_horizontal_rule
end
#THE FOOTER
footer [margin_box.left, margin_box.bottom + 10] do
stroke_horizontal_rule
move_down 3
text "And here's a sexy footer - #{page_count}", :size => 16
end
#THE DOCUMENT BODY -> MULTI-PAGES TABLE
bounding_box([margin_box.left, margin_box.top - 50],
:width => margin_box.width,
:height => margin_box.height - 60) do
table @huge_data, # BIG ARRAY WITH DATA FROM ACTIVERECORD
:position => :center,
:headers => ["Col 1","Col 2","Col 3"],
:row_colors => :pdf_writer,
:vertical_padding => 2,
:horizontal_padding => 5,
:header_color => "00ffff"
end #END TABLE
end #END BOUNDING_BOX
end.render #END
DOCUMENT.NEW
----- END CODE ------------------------
Best Regards.
Gleidisdon F. Duarte.
On Aug 24, 1:47 pm, wesgarrison <
wes.garri...@gmail.com> wrote:
> I came searching for the same thing.
>
> Searching the group for 'header' gives 5 results and this is the only
> pertinent one.
> Maybe I don't know the terms to search for, though.
>
> I ended up figuring it out after I found this post, so here's what I
> did:
>
> Create aheader.
> Call canvas() with a bounding box.
> Move page margins down to accommodate.
>
> (I'm in landscape mode, fyi:)
>
> @pdf.h...@pdf.margin_box.top_left do