Module: Kramdown::Converter::Pdf::PrawnDocumentExtension::CustomBox

Defined in:
lib/kramdown/converter/pdf.rb

Overview

Extension for the formatted box class to recognize images and move text around them.

Instance Method Summary collapse

Instance Method Details

#available_widthObject



458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/kramdown/converter/pdf.rb', line 458

def available_width
  return super unless @document.respond_to?(:converter) && @document.converter

  @document.image_floats.each do |pn, x, y, w, h|
    next if @document.page_number != pn
    if @at[1] + @baseline_y <= y - @document.bounds.absolute_bottom &&
        (@at[1] + @baseline_y + @arranger.max_line_height + @leading >= y - h - @document.bounds.absolute_bottom)
      return @width - w
    end
  end

  return super
end