prawn icon indicating copy to clipboard operation
prawn copied to clipboard

start_new_page within bounding_box block moves the bounding_box on the next page...

Open zinkkrysty opened this issue 14 years ago • 3 comments

... but the content stays on the first page as it should

I have a bounding_box which behaves like a table (I'm not using Table because I need to create graphics inside some cells)

bounding_box [0, cursor], width: bounds.width do
      cars.each_with_index do |car, i|
        cars_table_row car, i+1
      end
      stroke_bounds
end

Inside the cars_table_row method I have this:

start_new_page if index % 13 == 0

That makes the bounding box jump on the next page and the stroke_bounds only strokes the last page. I don't grasp how the content is shown on the front page if the bounding_box is stroked only on the second page.

If this is not a bug, is there a better way to start new pages inside a bounding_box? Or to divide a bounding box that doesn't necessarily contain text into multiple pages?

Here's a screenshot of my issue: http://cl.ly/image/1W1M3h413L2p

zinkkrysty avatar Oct 10 '12 11:10 zinkkrysty

Same issue here, with text-only content.

jasontduncan avatar Oct 16 '12 16:10 jasontduncan

You might try this:

stroke_bounds && start_new_page if index % 13 == 0

I would be curious to know if that gets you anywhere.

jonsgreen avatar Oct 27 '12 05:10 jonsgreen

Yes that works. Thanks!

zinkkrysty avatar Nov 13 '12 16:11 zinkkrysty