Sha256: 6f922dc1fbd3e702d28f659c5556ae7760b424f130a53ad162bc2f5b6581c3e2

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

# coding: utf-8

require 'open-uri'

CaseRunner.current :dynamic_image

image50x50    = CaseRunner.case_resource('img50x50.png')
image200x100  = CaseRunner.case_resource('img200x100.png')
matsukei_logo = open('http://www.matsukei.co.jp/common/image/logo.jpg')

ThinReports::Report.generate_file(:pdf, CaseRunner.output_file) do |r|
  r.use_layout(CaseRunner.layout_file)
  
  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)
  
  # It cannot do as follows:
  # 
  #   r.page.item(:logo1).src(matsukei_logo)
  #   r.page.item(:logo2).value(matsukei_logo)
  #   
  r.page.item(:logo1).src(matsukei_logo.path)
  r.page.item(:logo2).value(matsukei_logo.path)
  
  r.page.item(:thinreports_logo).src(open('http://www.thinreports.org/media/i/logo.png'))
  
  r.page.list(:list) do |list|
    3.times { list.add_row :in_list => image50x50 }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thinreports-0.7.6 test/case/dynamic_image/dynamic_image.rb
thinreports-0.7.5 test/case/dynamic_image/dynamic_image.rb
thinreports-0.7.0 test/case/dynamic_image/dynamic_image.rb