thinreports 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +22 -6
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/README.md +5 -6
- data/Rakefile +11 -25
- data/lib/thinreports/generator/pdf/document/draw_shape.rb +1 -1
- data/lib/thinreports/generator/pdf/document/draw_template_items.rb +1 -1
- data/lib/thinreports/layout/legacy_schema.rb +1 -0
- data/lib/thinreports/version.rb +1 -1
- data/test/features/dynamic_style/expect.pdf +3714 -0
- data/{examples → test/features}/dynamic_style/image.png +0 -0
- data/{examples/dynamic_style/dynamic_style.tlf → test/features/dynamic_style/templates/styles.tlf} +0 -0
- data/{examples/dynamic_style/dynamic_style_in_list.tlf → test/features/dynamic_style/templates/styles_in_list.tlf} +0 -0
- data/test/features/dynamic_style/test_dynamic_style.rb +152 -0
- data/{examples → test/features}/eudc/eudc.ttf +0 -0
- data/test/features/eudc/expect.pdf +0 -0
- data/{examples/eudc/eudc.tlf → test/features/eudc/template.tlf} +0 -0
- data/test/features/eudc/test_eudc.rb +27 -0
- data/test/features/feature_test.rb +58 -0
- data/test/features/graphics/expect.pdf +475 -0
- data/test/features/graphics/template.tlf +309 -0
- data/test/features/graphics/test_graphics.rb +12 -0
- data/test/features/hidden_item/expect.pdf +0 -0
- data/{examples/hidden_shapes/hidden_shapes.tlf → test/features/hidden_item/template.tlf} +0 -0
- data/test/features/hidden_item/test_hidden_item.rb +12 -0
- data/test/features/image_block/expect.pdf +0 -0
- data/{examples/dynamic_image → test/features/image_block}/img200x100.png +0 -0
- data/{examples/dynamic_image → test/features/image_block}/img50x50.png +0 -0
- data/{examples/dynamic_image/dynamic_image.tlf → test/features/image_block/template.tlf} +0 -0
- data/test/features/image_block/test_image_block.rb +35 -0
- data/test/features/list_events/expect.pdf +659 -0
- data/{examples/list_events/list_events.tlf → test/features/list_events/template.tlf} +0 -0
- data/{examples/list_events/list_events.rb → test/features/list_events/test_list_events.rb} +7 -3
- data/test/features/list_manually/expect.pdf +599 -0
- data/{examples/list_manual_generation/list_manual_generation.tlf → test/features/list_manually/template.tlf} +0 -0
- data/test/features/list_manually/test_list_manually.rb +25 -0
- data/test/features/page_number/expect.pdf +400 -0
- data/{examples/page_number/page_number.tlf → test/features/page_number/template.tlf} +0 -0
- data/test/features/page_number/test_page_number.rb +24 -0
- data/test/features/page_number_with_list/expect.pdf +721 -0
- data/{examples/list_page_number/list_page_number.tlf → test/features/page_number_with_list/template.tlf} +0 -0
- data/test/features/page_number_with_list/test_page_number_with_list.rb +21 -0
- data/test/features/palleted_png/expect.pdf +0 -0
- data/{examples → test/features}/palleted_png/palleted_png.png +0 -0
- data/{examples/palleted_png/palleted_png.tlf → test/features/palleted_png/template.tlf} +0 -0
- data/test/features/palleted_png/test_palleted_png.rb +14 -0
- data/test/features/report_callbacks/expect.pdf +169 -0
- data/{examples/report_callbacks/report_callbacks.tlf → test/features/report_callbacks/template.tlf} +0 -0
- data/test/features/report_callbacks/test_report_callbacks.rb +18 -0
- data/test/features/text_align/expect.pdf +0 -0
- data/{examples/text_align/text_align.tlf → test/features/text_align/template.tlf} +0 -0
- data/test/features/text_align/test_text_align.rb +12 -0
- data/test/features/text_block_overflow/expect.pdf +0 -0
- data/{examples/tblock_overflow/tblock_overflow.tlf → test/features/text_block_overflow/template.tlf} +0 -0
- data/test/features/text_block_overflow/test_text_block_overflow.rb +25 -0
- data/test/features/text_block_singleline/expect.pdf +0 -0
- data/{examples/single_line_tblock/single_line_tblock.tlf → test/features/text_block_singleline/template.tlf} +0 -0
- data/test/features/text_block_singleline/test_text_block_singleline.rb +15 -0
- data/test/features/text_block_style/expect.pdf +1390 -1
- data/{examples/tblock_styles/tblock_styles.tlf → test/features/text_block_style/templates/basic_styles.tlf} +0 -0
- data/{examples/tblock_styles → test/features/text_block_style/templates}/font_size.tlf +0 -0
- data/{examples/tblock_styles/tblock_styles.rb → test/features/text_block_style/test_text_block_style.rb} +9 -5
- data/test/features/text_character_spacing/expect.pdf +0 -0
- data/{examples/character_spacing/character_spacing.tlf → test/features/text_character_spacing/template.tlf} +0 -0
- data/test/features/text_character_spacing/test_text_character_spacing.rb +12 -0
- data/test/features/text_word_wrap/expect.pdf +0 -0
- data/{examples/word_wrap/word_wrap.tlf → test/features/text_word_wrap/template.tlf} +0 -0
- data/test/features/text_word_wrap/test_text_word_wrap.rb +30 -0
- data/test/test_helper.rb +1 -10
- data/test/{unit → units}/core/format/test_base.rb +0 -0
- data/test/{unit → units}/core/shape/base/test_internal.rb +0 -0
- data/test/{unit → units}/core/shape/basic/test_block_format.rb +0 -0
- data/test/{unit → units}/core/shape/basic/test_block_interface.rb +0 -0
- data/test/{unit → units}/core/shape/basic/test_block_internal.rb +0 -0
- data/test/{unit → units}/core/shape/basic/test_format.rb +0 -0
- data/test/{unit → units}/core/shape/basic/test_interface.rb +0 -0
- data/test/{unit → units}/core/shape/basic/test_internal.rb +0 -0
- data/test/{unit → units}/core/shape/image_block/test_interface.rb +0 -0
- data/test/{unit → units}/core/shape/image_block/test_internal.rb +0 -0
- data/test/{unit → units}/core/shape/list/test_format.rb +0 -0
- data/test/{unit → units}/core/shape/list/test_manager.rb +0 -0
- data/test/{unit → units}/core/shape/list/test_page.rb +0 -0
- data/test/{unit → units}/core/shape/list/test_page_state.rb +0 -0
- data/test/{unit → units}/core/shape/list/test_section_format.rb +0 -0
- data/test/{unit → units}/core/shape/list/test_section_interface.rb +0 -0
- data/test/{unit → units}/core/shape/list/test_section_internal.rb +0 -0
- data/test/{unit → units}/core/shape/manager/test_format.rb +0 -0
- data/test/{unit → units}/core/shape/manager/test_internal.rb +0 -0
- data/test/{unit → units}/core/shape/manager/test_target.rb +0 -0
- data/test/{unit → units}/core/shape/page_number/test_format.rb +0 -0
- data/test/{unit → units}/core/shape/page_number/test_interface.rb +0 -0
- data/test/{unit → units}/core/shape/page_number/test_internal.rb +0 -0
- data/test/{unit → units}/core/shape/styles/test_base.rb +0 -0
- data/test/{unit → units}/core/shape/styles/test_basic.rb +0 -0
- data/test/{unit → units}/core/shape/styles/test_graphic.rb +0 -0
- data/test/{unit → units}/core/shape/styles/test_text.rb +0 -0
- data/test/{unit → units}/core/shape/text/test_format.rb +0 -0
- data/test/{unit → units}/core/shape/text/test_internal.rb +0 -0
- data/test/{unit → units}/core/shape/text_block/formatter/test_basic.rb +0 -0
- data/test/{unit → units}/core/shape/text_block/formatter/test_datetime.rb +0 -0
- data/test/{unit → units}/core/shape/text_block/formatter/test_number.rb +0 -0
- data/test/{unit → units}/core/shape/text_block/formatter/test_padding.rb +0 -0
- data/test/{unit → units}/core/shape/text_block/test_format.rb +0 -0
- data/test/{unit → units}/core/shape/text_block/test_formatter.rb +0 -0
- data/test/{unit → units}/core/shape/text_block/test_interface.rb +0 -0
- data/test/{unit → units}/core/shape/text_block/test_internal.rb +0 -0
- data/test/{unit → units}/core/test_shape.rb +0 -0
- data/test/{unit → units}/core/test_utils.rb +0 -0
- data/test/{unit → units}/generator/pdf/document/graphics/test_attributes.rb +0 -0
- data/test/{unit → units}/generator/pdf/document/graphics/test_basic.rb +0 -0
- data/test/{unit → units}/generator/pdf/document/graphics/test_image.rb +0 -0
- data/test/{unit → units}/generator/pdf/document/graphics/test_text.rb +0 -0
- data/test/{unit → units}/generator/pdf/document/test_font.rb +0 -0
- data/test/{unit → units}/generator/pdf/document/test_graphics.rb +0 -0
- data/test/{unit → units}/generator/pdf/document/test_page.rb +0 -0
- data/test/{unit → units}/generator/pdf/document/test_parse_color.rb +0 -0
- data/test/{unit → units}/generator/pdf/prawn_ext/test_calc_image_dimensions.rb +0 -0
- data/test/{unit → units}/generator/pdf/prawn_ext/test_width_of.rb +0 -0
- data/test/{unit → units}/generator/pdf/test_document.rb +0 -0
- data/test/{unit → units}/generator/test_pdf.rb +0 -0
- data/test/{unit → units}/layout/test_base.rb +0 -0
- data/test/{unit → units}/layout/test_format.rb +0 -0
- data/test/{unit → units}/layout/test_legacy_schema.rb +3 -1
- data/test/{unit → units}/layout/test_version.rb +0 -0
- data/test/{unit → units}/report/test_base.rb +0 -0
- data/test/{unit → units}/report/test_internal.rb +0 -0
- data/test/{unit → units}/test_config.rb +0 -0
- data/test/{unit → units}/test_layout.rb +0 -0
- data/test/{unit → units}/test_report.rb +0 -0
- data/thinreports.gemspec +0 -1
- metadata +122 -123
- data/examples/character_spacing/character_spacing.rb +0 -8
- data/examples/dynamic_image/dynamic_image.rb +0 -31
- data/examples/dynamic_style/dynamic_style.rb +0 -150
- data/examples/eudc/eudc.rb +0 -20
- data/examples/helper.rb +0 -50
- data/examples/hidden_shapes/hidden_shapes.rb +0 -9
- data/examples/list_manual_generation/list_manual_generation.rb +0 -22
- data/examples/list_page_number/list_page_number.rb +0 -17
- data/examples/page_number/page_number.rb +0 -33
- data/examples/palleted_png/palleted_png.rb +0 -9
- data/examples/password_setting/password_setting.rb +0 -10
- data/examples/password_setting/password_setting.tlf +0 -45
- data/examples/report_callbacks/report_callbacks.rb +0 -14
- data/examples/single_line_tblock/single_line_tblock.rb +0 -13
- data/examples/tblock_overflow/tblock_overflow.rb +0 -20
- data/examples/text_align/text_align.rb +0 -8
- data/examples/typeB_page_size/B4_ISO.tlf +0 -45
- data/examples/typeB_page_size/B4_JIS.tlf +0 -45
- data/examples/typeB_page_size/typeB_page_size.rb +0 -17
- data/examples/word_wrap/word_wrap.rb +0 -26
- data/test/tmp/.gitkeep +0 -0
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'open-uri'
|
4
|
-
|
5
|
-
example :dynamic_image, 'Show images dynamically' do
|
6
|
-
image50x50 = resource('img50x50.png')
|
7
|
-
image200x100 = resource('img200x100.png')
|
8
|
-
|
9
|
-
Thinreports::Report.generate filename: output_filename do |r|
|
10
|
-
r.use_layout(layout_filename)
|
11
|
-
|
12
|
-
r.start_new_page
|
13
|
-
|
14
|
-
r.page.values(pos_top_left: image50x50,
|
15
|
-
pos_top_center: image50x50,
|
16
|
-
pos_top_right: image50x50,
|
17
|
-
pos_center_left: image50x50,
|
18
|
-
pos_center_center: image50x50,
|
19
|
-
pos_center_right: image50x50,
|
20
|
-
pos_bottom_left: image50x50,
|
21
|
-
pos_bottom_center: image50x50,
|
22
|
-
pos_bottom_right: image50x50)
|
23
|
-
|
24
|
-
r.page.item(:overflow).src = image200x100
|
25
|
-
r.page[:thinreports_logo] = open('http://www.thinreports.org/assets/logos/thinreports-logo.png')
|
26
|
-
|
27
|
-
r.page.list(:list) do |list|
|
28
|
-
3.times { list.add_row in_list: image50x50 }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,150 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
example :dynamic_style, 'Change styles of the object dynamically' do |t|
|
4
|
-
image = t.resource('image.png')
|
5
|
-
setup_values = Proc.new do |page|
|
6
|
-
# The Basic Style
|
7
|
-
page.values(basic_show5: 'TextBlock',
|
8
|
-
basic_show6: image,
|
9
|
-
basic_hide5: 'TextBlock',
|
10
|
-
basic_hide6: image)
|
11
|
-
# The Text Style
|
12
|
-
page.values(text_b3: 'To bold',
|
13
|
-
text_b4: 'To normal',
|
14
|
-
text_i3: 'To italic',
|
15
|
-
text_i4: 'To normal',
|
16
|
-
text_u3: 'To underline',
|
17
|
-
text_u4: 'To none',
|
18
|
-
text_l3: 'To line-through',
|
19
|
-
text_l4: 'To none')
|
20
|
-
page.values(text_a2: 'To right align',
|
21
|
-
text_a3: "To right align\n右寄せ",
|
22
|
-
text_va2: "To bottom align\n下揃え",
|
23
|
-
text_color2: '赤色')
|
24
|
-
end
|
25
|
-
|
26
|
-
Thinreports::Report.generate(filename: t.output_filename,
|
27
|
-
layout: t.layout_filename) do |r|
|
28
|
-
# In case of using dynamic_style.tlf
|
29
|
-
|
30
|
-
# Create raw-page.
|
31
|
-
r.start_new_page
|
32
|
-
r.page.item(:title).value('Original Page')
|
33
|
-
|
34
|
-
setup_values.call(r.page)
|
35
|
-
|
36
|
-
# Create styled-page.
|
37
|
-
r.start_new_page
|
38
|
-
|
39
|
-
setup_values.call(r.page)
|
40
|
-
r.page.item(:title).value('Styled Page')
|
41
|
-
|
42
|
-
# The Basic Style
|
43
|
-
6.times do |i|
|
44
|
-
r.page.item("basic_show#{i + 1}").style(:visible, true)
|
45
|
-
r.page.item("basic_hide#{i + 1}").style(:visible, false)
|
46
|
-
end
|
47
|
-
|
48
|
-
# The Graphic Style
|
49
|
-
r.page.item(:graphic_bcolor1).style(:border_color, '#ff0000')
|
50
|
-
r.page[:graphic_bcolor2].style(:border_color, 'red')
|
51
|
-
# nil or 'none'.
|
52
|
-
r.page.item(:graphic_bcolor4).style(:border_color, nil)
|
53
|
-
|
54
|
-
r.page.item(:graphic_bwidth1).style(:border_width, 5)
|
55
|
-
r.page.item(:graphic_bwidth2).style(:border_width, 5)
|
56
|
-
r.page.item(:graphic_bwidth3).style(:border_width, 5)
|
57
|
-
r.page.item(:graphic_bwidth4).style(:border_width, 2)
|
58
|
-
r.page.item(:graphic_bwidth5).style(:border_width, 0)
|
59
|
-
|
60
|
-
r.page.item(:graphic_fcolor1).style(:fill_color, '#ff0000')
|
61
|
-
# nil or 'none'
|
62
|
-
r.page.item(:graphic_fcolor3).style(:fill_color, 'none')
|
63
|
-
r.page.item(:graphic_fcolor4).style(:fill_color, 'ff0000')
|
64
|
-
|
65
|
-
# The Text Style
|
66
|
-
[1, 3].each do |i|
|
67
|
-
r.page["text_b#{i}"].style(:bold, true)
|
68
|
-
r.page.item("text_i#{i}").style(:italic, true)
|
69
|
-
r.page.item("text_u#{i}").style(:underline, true)
|
70
|
-
r.page.item("text_l#{i}").style(:linethrough, true)
|
71
|
-
end
|
72
|
-
[2, 4].each do |i|
|
73
|
-
r.page.item("text_b#{i}").style(:bold, false)
|
74
|
-
r.page.item("text_i#{i}").style(:italic, false)
|
75
|
-
r.page.item("text_u#{i}").style(:underline, false)
|
76
|
-
r.page.item("text_l#{i}").style(:linethrough, false)
|
77
|
-
end
|
78
|
-
|
79
|
-
3.times do |i|
|
80
|
-
r.page.item("text_a#{i + 1}").style(:align, :right)
|
81
|
-
end
|
82
|
-
2.times do |i|
|
83
|
-
r.page.item("text_va#{i + 1}").style(:valign, :bottom)
|
84
|
-
end
|
85
|
-
|
86
|
-
2.times do |i|
|
87
|
-
r.page["text_color#{i + 1}"].style(:color, 'ff0000')
|
88
|
-
end
|
89
|
-
|
90
|
-
# In case of using "dynamic_style_in_list.tlf"
|
91
|
-
r.start_new_page(layout: t.resource('dynamic_style_in_list.tlf'))
|
92
|
-
|
93
|
-
# Settings for Header.
|
94
|
-
r.page.list(:list).header do |header|
|
95
|
-
header.item(:rect).styles(border_color: nil,
|
96
|
-
fill_color: 'ff00ff')
|
97
|
-
header.item(:text).styles(align: :center,
|
98
|
-
valign: :middle,
|
99
|
-
bold: true)
|
100
|
-
header[:tblock].styles(align: :center,
|
101
|
-
valign: :middle,
|
102
|
-
color: 'red',
|
103
|
-
linethrough: true)
|
104
|
-
end
|
105
|
-
|
106
|
-
1.step(10, 1) do |i|
|
107
|
-
# Flag of overflowed list-page.
|
108
|
-
is_overflowed = r.page.list(:list).overflow?
|
109
|
-
|
110
|
-
# Add details.
|
111
|
-
r.page.list(:list).add_row do |row|
|
112
|
-
case
|
113
|
-
when i % 2 == 0
|
114
|
-
row.item(:rect).styles(border_color: 'ff0000',
|
115
|
-
border_width: 3,
|
116
|
-
fill_color: '0000ff')
|
117
|
-
row.item(:text).styles(color: 'red',
|
118
|
-
align: :left,
|
119
|
-
valign: :middle)
|
120
|
-
row.item(:tblock).styles(color: 'blue',
|
121
|
-
align: :left,
|
122
|
-
valign: :middle)
|
123
|
-
when i % 3 == 0
|
124
|
-
row.item(:rect).style(:visible, false)
|
125
|
-
row.item(:text).styles(color: '0000ff',
|
126
|
-
align: :right,
|
127
|
-
valign: :bottom)
|
128
|
-
row.item(:tblock).styles(color: 'ff0000',
|
129
|
-
align: :right,
|
130
|
-
valign: :bottom)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
# Change header styles when list-page was overflowed.
|
135
|
-
if is_overflowed
|
136
|
-
r.page.list(:list).header do |header|
|
137
|
-
header.item(:rect).styles(border_color: 'black',
|
138
|
-
fill_color: '#ffffff')
|
139
|
-
header.item(:text).styles(align: :left,
|
140
|
-
valign: :top,
|
141
|
-
bold: false)
|
142
|
-
header.item(:tblock).styles(align: :left,
|
143
|
-
valign: :top,
|
144
|
-
color: '#000000',
|
145
|
-
linethrough: false)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
data/examples/eudc/eudc.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
example :eudc, 'Show External Characters' do |t|
|
4
|
-
Thinreports.configure do |config|
|
5
|
-
config.fallback_fonts = t.resource('eudc.ttf')
|
6
|
-
end
|
7
|
-
|
8
|
-
Thinreports::Report.generate(filename: t.output_filename) do
|
9
|
-
use_layout t.layout_filename
|
10
|
-
|
11
|
-
start_new_page
|
12
|
-
|
13
|
-
page.item(:eudc).value('日本で生まれ世界が育てた言語 Ruby')
|
14
|
-
page.values(eudc_bold: '太字',
|
15
|
-
eudc_italic: '斜体',
|
16
|
-
eudc_bold_italic: '太字斜体')
|
17
|
-
end
|
18
|
-
|
19
|
-
Thinreports.config.fallback_fonts = []
|
20
|
-
end
|
data/examples/helper.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'pathname'
|
4
|
-
require_relative '../lib/thinreports'
|
5
|
-
|
6
|
-
class Thinreports::Example
|
7
|
-
ROOT = Pathname.new File.expand_path('..', __FILE__)
|
8
|
-
|
9
|
-
attr_reader :name, :description
|
10
|
-
|
11
|
-
def initialize(name, description)
|
12
|
-
@name = name
|
13
|
-
@description = description
|
14
|
-
end
|
15
|
-
|
16
|
-
def start
|
17
|
-
print "[#{name}] #{description}: "
|
18
|
-
end
|
19
|
-
|
20
|
-
def success
|
21
|
-
print "ok#{$/}"
|
22
|
-
end
|
23
|
-
|
24
|
-
def error(e)
|
25
|
-
puts "#{$/}ERROR: #{e}"
|
26
|
-
puts e.backtrace
|
27
|
-
end
|
28
|
-
|
29
|
-
def layout_filename
|
30
|
-
resource("#{@name}.tlf")
|
31
|
-
end
|
32
|
-
|
33
|
-
def output_filename
|
34
|
-
resource("#{@name}.pdf")
|
35
|
-
end
|
36
|
-
|
37
|
-
def resource(filename = nil)
|
38
|
-
path = ROOT.join @name.to_s
|
39
|
-
filename ? path.join(filename).to_s : path.to_s
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def example(name, description = nil, &block)
|
44
|
-
ex = Thinreports::Example.new(name, description)
|
45
|
-
ex.start
|
46
|
-
block.arity == 1 ? block.call(ex) : ex.instance_eval(&block)
|
47
|
-
ex.success
|
48
|
-
rescue => e
|
49
|
-
ex.error(e)
|
50
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
example :list_manual_generation, 'Generate list manually' do |t|
|
4
|
-
Thinreports::Report.generate(filename: t.output_filename) do
|
5
|
-
use_layout(t.layout_filename)
|
6
|
-
|
7
|
-
list.header do |h|
|
8
|
-
h.item(:header).value(page.no)
|
9
|
-
end
|
10
|
-
|
11
|
-
25.times do |row_index|
|
12
|
-
if list.overflow?
|
13
|
-
start_new_page
|
14
|
-
list.header header: page.no
|
15
|
-
end
|
16
|
-
|
17
|
-
list.page_break if row_index == 15
|
18
|
-
|
19
|
-
list.add_row detail: t
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
example :list_page_number, 'Draw page-number automatically each list' do |t|
|
4
|
-
report = Thinreports::Report.new layout: t.layout_filename
|
5
|
-
|
6
|
-
report.start_new_page
|
7
|
-
report.page.item(:group_no).value('Group A')
|
8
|
-
|
9
|
-
10.times { report.list.add_row }
|
10
|
-
|
11
|
-
report.start_new_page
|
12
|
-
report.page.item(:group_no).value('Group B')
|
13
|
-
|
14
|
-
20.times { report.list.add_row }
|
15
|
-
|
16
|
-
report.generate filename: t.output_filename
|
17
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
example :page_number, 'Draw page-number automatically each pages' do |t|
|
4
|
-
# Basic PageNumber
|
5
|
-
report = Thinreports::Report.new layout: t.layout_filename
|
6
|
-
|
7
|
-
report.start_new_page do |page|
|
8
|
-
# change visibility
|
9
|
-
page.item(:pageno).hide
|
10
|
-
end
|
11
|
-
report.start_new_page do |page|
|
12
|
-
# change style
|
13
|
-
page.item(:pageno).styles(color: 'red',
|
14
|
-
bold: true,
|
15
|
-
underline: true,
|
16
|
-
linethrough: true)
|
17
|
-
end
|
18
|
-
|
19
|
-
# Do not count as total page count
|
20
|
-
report.start_new_page count: false
|
21
|
-
|
22
|
-
report.start_new_page count: true
|
23
|
-
|
24
|
-
report.generate filename: t.output_filename
|
25
|
-
|
26
|
-
# PageNumber is started from 5
|
27
|
-
report = Thinreports::Report.new layout: t.layout_filename
|
28
|
-
report.start_page_number_from 5
|
29
|
-
|
30
|
-
10.times { report.start_new_page }
|
31
|
-
|
32
|
-
report.generate filename: t.resource("#{t.name}_from5.pdf")
|
33
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
example :palleted_png, 'Rendering a palleted PNG with transparency' do |t|
|
4
|
-
report = Thinreports::Report.new layout: t.layout_filename
|
5
|
-
report.start_new_page do |page|
|
6
|
-
page.item(:image).src = t.resource('palleted_png.png')
|
7
|
-
end
|
8
|
-
report.generate filename: t.output_filename
|
9
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
example :password_setting, 'Set password to open' do |t|
|
4
|
-
report = Thinreports::Report.new layout: t.layout_filename
|
5
|
-
report.start_new_page
|
6
|
-
report.generate(filename: t.output_filename, security: {
|
7
|
-
user_password: 'password',
|
8
|
-
owner_password: :random
|
9
|
-
})
|
10
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": "0.9.0",
|
3
|
-
"items": [
|
4
|
-
{
|
5
|
-
"id": "",
|
6
|
-
"type": "text",
|
7
|
-
"display": true,
|
8
|
-
"description": "",
|
9
|
-
"x": 197.6,
|
10
|
-
"y": 137,
|
11
|
-
"width": 200,
|
12
|
-
"height": 100,
|
13
|
-
"style": {
|
14
|
-
"font-family": [
|
15
|
-
"Helvetica"
|
16
|
-
],
|
17
|
-
"font-size": 18,
|
18
|
-
"color": "#000000",
|
19
|
-
"text-align": "center",
|
20
|
-
"vertical-align": "top",
|
21
|
-
"line-height": "",
|
22
|
-
"line-height-ratio": "",
|
23
|
-
"letter-spacing": "",
|
24
|
-
"font-style": []
|
25
|
-
},
|
26
|
-
"texts": [
|
27
|
-
"Password is \"password\""
|
28
|
-
]
|
29
|
-
}
|
30
|
-
],
|
31
|
-
"state": {
|
32
|
-
"layout-guides": []
|
33
|
-
},
|
34
|
-
"title": "",
|
35
|
-
"report": {
|
36
|
-
"paper-type": "A4",
|
37
|
-
"orientation": "portrait",
|
38
|
-
"margin": [
|
39
|
-
20,
|
40
|
-
20,
|
41
|
-
20,
|
42
|
-
20
|
43
|
-
]
|
44
|
-
}
|
45
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
example :report_callbacks, 'Callbacks of Report' do |t|
|
4
|
-
report = Thinreports::Report.new layout: t.layout_filename
|
5
|
-
|
6
|
-
report.on_page_create do |page|
|
7
|
-
page.item(:text2).value('Rendered by on_page_create')
|
8
|
-
end
|
9
|
-
|
10
|
-
report.start_new_page
|
11
|
-
report.start_new_page
|
12
|
-
|
13
|
-
report.generate filename: t.output_filename
|
14
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
example :single_line_tblock, 'Show a single-line Tblock' do |t|
|
4
|
-
Thinreports::Report.generate filename: t.output_filename do
|
5
|
-
use_layout(t.layout_filename)
|
6
|
-
|
7
|
-
start_new_page
|
8
|
-
|
9
|
-
page.item(:fallback_to_ipafont).value('IPA明朝に自動的にフォールバックされる')
|
10
|
-
|
11
|
-
page.item(:set_multiline_text).value("1行目\n2行目\n3行目\n4行目\n5行目")
|
12
|
-
end
|
13
|
-
end
|