From 82ce567981271c892ac34dcf983ed5102e292464 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Sat, 23 Apr 2016 16:24:39 -0600 Subject: [PATCH] resolves #421 restore cursor position after placing image in running content --- lib/asciidoctor-pdf/converter.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/asciidoctor-pdf/converter.rb b/lib/asciidoctor-pdf/converter.rb index b2e02770b..0e654d19e 100644 --- a/lib/asciidoctor-pdf/converter.rb +++ b/lib/asciidoctor-pdf/converter.rb @@ -1999,10 +1999,10 @@ def layout_running_content position, doc, opts = {} when ::Hash # NOTE image placement respects padding; use negative image_vertical_align value to revert trim_v_padding = trim_padding[0] + trim_padding[2] - # NOTE bounding_box is redundant if trim_v_padding is 0 - bounding_box [0, cursor - trim_padding[0]], width: bounds.width, height: (bounds.height - trim_v_padding) do - # NOTE float ensures cursor position is restored and returns us to current page if we overrun - float do + # NOTE float ensures cursor position is restored and returns us to current page if we overrun + float do + # NOTE bounding_box is redundant if trim_v_padding is 0 + bounding_box [0, cursor - trim_padding[0]], width: bounds.width, height: (bounds.height - trim_v_padding) do #image content[:path], vposition: trim_img_valign, position: align, width: content[:width] # NOTE use :fit to prevent image from overflowing page (at the cost of scaling it) image content[:path], vposition: trim_img_valign, position: align, fit: [content[:width], bounds.height]