Hello,
I appreciate all that is being done with Prawn, definitely the best
tool for manipulating PDFs in Ruby by far. Unfortunately, I have run
into a problem with a bounding_box overflowing to the next page.
You can find a simplified example at (inlined at the bottom of this
message also):
http://pastie.org/610979
If you run the example, after the first page, all successive pages
just have a line or two, and those lines are aligned towards the
bottom of the page. Are there any best practices on what I am doing
wrong, or does this look like a bug (I've looked through all the doc's
and postings I can find)?
Environment: Vista, ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-
mswin32], prawn 0.5.0.1
Appreciate any and all help,
Thanks,
-Chris
Inlined Code Sample
-------------------------------------------------
# encoding: utf-8
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..',
'lib'))
require 'prawn/core'
Prawn::Document.generate("problem.pdf") do
font 'Helvetica'
text 'Basic Time Card version # 1'
text 'Submitted by Chris (Test) at 09/08/2009 21:47 UTC'
stroke{line([0,cursor], [540,cursor])}
move_down 6
move_down 3
text 'HEADING'
stroke{line([0,cursor], [540-(1-1*15)+(1*-16),cursor])}
move_down 6
bounding_box [(1*15),cursor], :width => (540-(1*15)) do
text 'Chris'
text '23432'
text '09/08/09'
end
stroke{line([0,cursor], [540-(1-1*15)+(1*-16),cursor])}
move_down 3
move_down 3
text 'DATE LIST'
stroke{line([0,cursor], [540-(1-1*15)+(1*-16),cursor])}
move_down 6
bounding_box [(1*15),cursor], :width => (540-(1*15)) do
text '09/08/09'
move_down 3
text 'TIME LIST'
stroke{line([0,cursor], [540-(2-1*15)+(2*-16),cursor])}
move_down 6
bounding_box [(2*15),cursor], :width => (540-(2*15)) do
text '17:46'
move_down 3
text 'TIME LIST DETAIL'
stroke{line([0,cursor], [540-(3-1*15)+(3*-16),cursor])}
move_down 6
bounding_box [(3*15),cursor], :width => (540-(3*15)) do
text 'fda'
text 'fdsafda'
text '0.00'
text '0.00'
text '6.55'
end
stroke{line([0,cursor], [540-(3-1*15)+(3*-16),cursor])}
move_down 3
move_down 5
text '18:46'
move_down 3
text 'TIME LIST DETAIL'
stroke{line([0,cursor], [540-(3-1*15)+(3*-16),cursor])}
move_down 6
bounding_box [(3*15),cursor], :width => (540-(3*15)) do
text 'fdafdfda'
text 'afdasfdas'
text '0.00'
text '0.00'
text '6.55'
end
stroke{line([0,cursor], [540-(3-1*15)+(3*-16),cursor])}
move_down 3
move_down 5
text '20:46'
move_down 3
text 'TIME LIST DETAIL'
stroke{line([0,cursor], [540-(3-1*15)+(3*-16),cursor])}
move_down 6
bounding_box [(3*15),cursor], :width => (540-(3*15)) do
text 'adfas'
text 'fdasfdas'
text '0.00'
text '0.00'
text '6.55'
end
stroke{line([0,cursor], [540-(3-1*15)+(3*-16),cursor])}
move_down 3
move_down 5
text '23:46'
move_down 3
text 'TIME LIST DETAIL'
stroke{line([0,cursor], [540-(3-1*15)+(3*-16),cursor])}
move_down 6
bounding_box [(3*15),cursor], :width => (540-(3*15)) do
text 'fdafdas'
text 'fdasfdas'
text '0.00'
text '0.00'
text '6.55'
end
stroke{line([0,cursor], [540-(3-1*15)+(3*-16),cursor])}
move_down 3
move_down 5
end
stroke{line([0,cursor], [540-(2-1*15)+(2*-16),cursor])}
move_down 3
move_down 5
text '09/09/09'
move_down 3
text 'TIME LIST'
stroke{line([0,cursor], [540-(2-1*15)+(2*-16),cursor])}
move_down 6
bounding_box [(2*15),cursor], :width => (540-(2*15)) do
text '17:46'
move_down 3
text 'TIME LIST DETAIL'
stroke{line([0,cursor], [540-(3-1*15)+(3*-16),cursor])}
move_down 6
bounding_box [(3*15),cursor], :width => (540-(3*15)) do
text 'fdafda'
text 'dafdas'
text '0.00'
text '0.00'
text '6.55'
end
stroke{line([0,cursor], [540-(3-1*15)+(3*-16),cursor])}
move_down 3
move_down 5
text '19:46'
move_down 3
text 'TIME LIST DETAIL'
stroke{line([0,cursor], [540-(3-1*15)+(3*-16),cursor])}
move_down 6
bounding_box [(3*15),cursor], :width => (540-(3*15)) do
text 'fdafd'
text 'dafdas'
text '0.00'
text '0.00'
text '6.55'
end
stroke{line([0,cursor], [540-(3-1*15)+(3*-16),cursor])}
move_down 3
move_down 5
end
stroke{line([0,cursor], [540-(2-1*15)+(2*-16),cursor])}
move_down 3
move_down 5
end
stroke{line([0,cursor], [540-(1-1*15)+(1*-16),cursor])}
move_down 3
move_down 3
text 'SUMMARY'
stroke{line([0,cursor], [540-(1-1*15)+(1*-16),cursor])}
move_down 6
bounding_box [(1*15),cursor], :width => (540-(1*15)) do
text '5'
text '6'
text '7'
text ''
end
stroke{line([0,cursor], [540-(1-1*15)+(1*-16),cursor])}
move_down 3
move_down 3
text 'SIGNATURE'
stroke{line([0,cursor], [540-(1-1*15)+(1*-16),cursor])}
move_down 6
bounding_box [(1*15),cursor], :width => (540-(1*15)) do
text ''
end
stroke{line([0,cursor], [540-(1-1*15)+(1*-16),cursor])}
move_down 3
text ' '
end
------------------------------