Sha256: 61195605615e692392e9c644366a50f4ba4295a96048c4716831a3f999734b81

Contents?: true

Size: 1020 Bytes

Versions: 3

Compression:

Stored size: 1020 Bytes

Contents

# frozen_string_literal: true

require 'open-uri'

example :dynamic_image, 'Show images dynamically' do
  image50x50 = resource('img50x50.png')
  image200x100 = resource('img200x100.png')

  Thinreports::Report.generate filename: output_filename do |r|
    r.use_layout(layout_filename)

    r.start_new_page

    r.page.values(pos_top_left:        image50x50,
                  pos_top_center:      image50x50,
                  pos_top_right:       image50x50,
                  pos_center_left:     image50x50,
                  pos_center_center:   image50x50,
                  pos_center_right:    image50x50,
                  pos_bottom_left:     image50x50,
                  pos_bottom_center:   image50x50,
                  pos_bottom_right:    image50x50)

    r.page.item(:overflow).src = image200x100
    r.page[:thinreports_logo] = open('http://www.thinreports.org/assets/logos/thinreports-logo.png')

    r.page.list(:list) do |list|
      3.times { list.add_row in_list: image50x50 }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thinreports-0.10.2 examples/dynamic_image/dynamic_image.rb
thinreports-0.10.1 examples/dynamic_image/dynamic_image.rb
thinreports-0.10.0 examples/dynamic_image/dynamic_image.rb