module Kramdown::Converter::Pdf::PrawnDocumentExtension
def embed_image(pdf_obj, info, options)
def embed_image(pdf_obj, info, options) # find where the image will be placed and how big it will be w,h = info.calc_image_dimensions(options) if options[:at] x,y = map_to_absolute(options[:at]) else x,y = image_position(w,h,options) move_text_position h end #--> This part is new if options[:position] == :right image_floats << [page_number, x - 15, y, w + 15, h + 15] end # add a reference to the image object to the current page # resource list and give it a label label = "I#{next_image_id}" state.page.xobjects.merge!(label => pdf_obj) # add the image to the current page instruct = "\nq\n%.3f 0 0 %.3f %.3f %.3f cm\n/%s Do\nQ" add_content instruct % [ w, h, x, y - h, label ] end
def image_floats
def image_floats @image_floats ||= [] end