module MapPrint::PdfHandlers::Images
Public Instance Methods
image_options(image, bounds_top)
click to toggle source
# File lib/map_print/pdf_handlers/images.rb, line 16 def image_options(image, bounds_top) position = {} if image[:position] position[:at] = image[:position].values position[:at][1] = bounds_top - position[:at][1] end if image[:options][:fit] position[:fit] = [image[:options][:fit][:width], image[:options][:fit][:height]] end image[:options].merge position end
print_images(images, pdf)
click to toggle source
# File lib/map_print/pdf_handlers/images.rb, line 4 def print_images(images, pdf) (images || []).each do |image| if image[:path] =~ /https?:\/\// image_file = open(image[:path]) else image_file = image[:path] end pdf.image image_file, image_options(image, pdf.bounds.top) end end