From 6c9334444e1db56deed8708f54abbae0a213f6f6 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Thu, 25 Jul 2019 02:32:57 -0600 Subject: [PATCH] resolves #1121 read padding from correct box when creating new page --- lib/prawn/document.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/prawn/document.rb b/lib/prawn/document.rb index eb2247550..7cb4df38a 100644 --- a/lib/prawn/document.rb +++ b/lib/prawn/document.rb @@ -720,15 +720,17 @@ def generate_margin_box (page.margins[:top] + page.margins[:bottom]) ) - # This check maintains indentation settings across page breaks + # update bounding box if not flowing from the previous page + unless @bounding_box && @bounding_box.parent + old_margin_box = @bounding_box + @bounding_box = @margin_box + end + + # maintains indentation settings across page breaks if old_margin_box @margin_box.add_left_padding(old_margin_box.total_left_padding) @margin_box.add_right_padding(old_margin_box.total_right_padding) end - - # we must update bounding box if not flowing from the previous page - # - @bounding_box = @margin_box unless @bounding_box&.parent end def apply_margin_options(options)