module Kramdown::Converter::Pdf::PrawnDocumentExtension::CustomBox

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

Public Instance Methods

available_width() click to toggle source
Calls superclass method
# File lib/kramdown/converter/pdf.rb, line 457
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