thinreports 0.7.6 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -5
  3. data/.travis.yml +8 -4
  4. data/CHANGELOG.md +220 -0
  5. data/Gemfile +2 -9
  6. data/MIT-LICENSE +1 -1
  7. data/README.md +286 -0
  8. data/Rakefile +38 -8
  9. data/examples/character_spacing/character_spacing.rb +8 -0
  10. data/examples/character_spacing/character_spacing.tlf +1 -0
  11. data/examples/dynamic_image/dynamic_image.rb +31 -0
  12. data/examples/dynamic_image/dynamic_image.tlf +1 -0
  13. data/examples/dynamic_style/dynamic_style.rb +150 -0
  14. data/examples/dynamic_style/dynamic_style.tlf +1 -0
  15. data/examples/dynamic_style/dynamic_style_in_list.tlf +1 -0
  16. data/examples/eudc/eudc.rb +20 -0
  17. data/examples/eudc/eudc.tlf +1 -0
  18. data/examples/helper.rb +50 -0
  19. data/examples/hidden_shapes/hidden_shapes.rb +9 -0
  20. data/examples/hidden_shapes/hidden_shapes.tlf +1 -0
  21. data/examples/list_events/list_events.rb +59 -0
  22. data/examples/list_events/list_events_0_7_7.tlf +1 -0
  23. data/examples/list_events/list_events_0_8.tlf +1 -0
  24. data/examples/list_manual_generation/list_manual_generation.rb +22 -0
  25. data/examples/list_manual_generation/list_manual_generation.tlf +1 -0
  26. data/examples/list_page_number/list_page_number.rb +17 -0
  27. data/examples/list_page_number/list_page_number.tlf +1 -0
  28. data/examples/page_number/page_number.rb +33 -0
  29. data/examples/page_number/page_number.tlf +1 -0
  30. data/examples/password_setting/password_setting.rb +10 -0
  31. data/examples/password_setting/password_setting.tlf +1 -0
  32. data/examples/report_callbacks/report_callbacks.rb +31 -0
  33. data/examples/report_callbacks/report_callbacks.tlf +1 -0
  34. data/examples/single_line_tblock/single_line_tblock.rb +13 -0
  35. data/examples/single_line_tblock/single_line_tblock.tlf +1 -0
  36. data/examples/tblock_overflow/tblock_overflow.rb +20 -0
  37. data/examples/tblock_overflow/tblock_overflow.tlf +1 -0
  38. data/examples/tblock_styles/font_size.tlf +1 -0
  39. data/examples/tblock_styles/tblock_styles.rb +43 -0
  40. data/examples/tblock_styles/tblock_styles.tlf +1 -0
  41. data/examples/text_align/text_align.rb +8 -0
  42. data/examples/text_align/text_align.tlf +1 -0
  43. data/examples/typeB_page_size/B4_ISO.tlf +1 -0
  44. data/examples/typeB_page_size/B4_JIS.tlf +1 -0
  45. data/examples/typeB_page_size/typeB_page_size.rb +17 -0
  46. data/examples/word_wrap/word_wrap.rb +26 -0
  47. data/examples/word_wrap/word_wrap.tlf +1 -0
  48. data/lib/thinreports/config.rb +30 -10
  49. data/lib/thinreports/core/errors.rb +23 -20
  50. data/lib/thinreports/core/events.rb +18 -19
  51. data/lib/thinreports/core/format/base.rb +20 -25
  52. data/lib/thinreports/core/format/builder.rb +19 -27
  53. data/lib/thinreports/core/shape/base/interface.rb +15 -15
  54. data/lib/thinreports/core/shape/base/internal.rb +15 -20
  55. data/lib/thinreports/core/shape/base.rb +4 -5
  56. data/lib/thinreports/core/shape/basic/block_format.rb +3 -4
  57. data/lib/thinreports/core/shape/basic/block_interface.rb +9 -4
  58. data/lib/thinreports/core/shape/basic/block_internal.rb +9 -10
  59. data/lib/thinreports/core/shape/basic/format.rb +11 -10
  60. data/lib/thinreports/core/shape/basic/interface.rb +3 -3
  61. data/lib/thinreports/core/shape/basic/internal.rb +9 -6
  62. data/lib/thinreports/core/shape/basic.rb +1 -1
  63. data/lib/thinreports/core/shape/image_block/format.rb +5 -6
  64. data/lib/thinreports/core/shape/image_block/interface.rb +9 -7
  65. data/lib/thinreports/core/shape/image_block/internal.rb +5 -6
  66. data/lib/thinreports/core/shape/image_block.rb +1 -1
  67. data/lib/thinreports/core/shape/list/configuration.rb +37 -16
  68. data/lib/thinreports/core/shape/list/events.rb +11 -11
  69. data/lib/thinreports/core/shape/list/format.rb +27 -28
  70. data/lib/thinreports/core/shape/list/manager.rb +135 -95
  71. data/lib/thinreports/core/shape/list/page.rb +57 -51
  72. data/lib/thinreports/core/shape/list/page_state.rb +19 -17
  73. data/lib/thinreports/core/shape/list/section_format.rb +14 -15
  74. data/lib/thinreports/core/shape/list/section_interface.rb +15 -16
  75. data/lib/thinreports/core/shape/list/section_internal.rb +7 -8
  76. data/lib/thinreports/core/shape/list/store.rb +10 -11
  77. data/lib/thinreports/core/shape/list.rb +1 -1
  78. data/lib/thinreports/core/shape/manager/format.rb +10 -11
  79. data/lib/thinreports/core/shape/manager/internal.rb +22 -21
  80. data/lib/thinreports/core/shape/manager/target.rb +63 -34
  81. data/lib/thinreports/core/shape/manager.rb +1 -1
  82. data/lib/thinreports/core/shape/page_number/format.rb +25 -0
  83. data/lib/thinreports/core/shape/page_number/interface.rb +27 -0
  84. data/lib/thinreports/core/shape/page_number/internal.rb +57 -0
  85. data/lib/thinreports/core/shape/page_number.rb +15 -0
  86. data/lib/thinreports/core/shape/style/base.rb +29 -29
  87. data/lib/thinreports/core/shape/style/basic.rb +1 -1
  88. data/lib/thinreports/core/shape/style/graphic.rb +10 -25
  89. data/lib/thinreports/core/shape/style/text.rb +41 -31
  90. data/lib/thinreports/core/shape/style.rb +1 -1
  91. data/lib/thinreports/core/shape/text/format.rb +8 -9
  92. data/lib/thinreports/core/shape/text/interface.rb +2 -2
  93. data/lib/thinreports/core/shape/text/internal.rb +6 -7
  94. data/lib/thinreports/core/shape/text.rb +1 -1
  95. data/lib/thinreports/core/shape/text_block/format.rb +17 -17
  96. data/lib/thinreports/core/shape/text_block/formatter/basic.rb +13 -12
  97. data/lib/thinreports/core/shape/text_block/formatter/datetime.rb +8 -9
  98. data/lib/thinreports/core/shape/text_block/formatter/number.rb +11 -12
  99. data/lib/thinreports/core/shape/text_block/formatter/padding.rb +9 -32
  100. data/lib/thinreports/core/shape/text_block/formatter.rb +7 -8
  101. data/lib/thinreports/core/shape/text_block/interface.rb +2 -2
  102. data/lib/thinreports/core/shape/text_block/internal.rb +19 -20
  103. data/lib/thinreports/core/shape/text_block.rb +1 -1
  104. data/lib/thinreports/core/shape.rb +11 -13
  105. data/lib/thinreports/core/utils.rb +33 -32
  106. data/lib/thinreports/generator/base.rb +15 -24
  107. data/lib/thinreports/generator/configuration.rb +10 -9
  108. data/lib/thinreports/generator/pdf/configuration.rb +11 -6
  109. data/lib/thinreports/generator/pdf/document/draw_shape.rb +41 -32
  110. data/lib/thinreports/generator/pdf/document/font.rb +53 -44
  111. data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +34 -25
  112. data/lib/thinreports/generator/pdf/document/graphics/basic.rb +25 -25
  113. data/lib/thinreports/generator/pdf/document/graphics/image.rb +15 -15
  114. data/lib/thinreports/generator/pdf/document/graphics/text.rb +43 -41
  115. data/lib/thinreports/generator/pdf/document/graphics.rb +8 -9
  116. data/lib/thinreports/generator/pdf/document/page.rb +37 -23
  117. data/lib/thinreports/generator/pdf/document/parse_color.rb +9 -10
  118. data/lib/thinreports/generator/pdf/document/parse_svg.rb +14 -15
  119. data/lib/thinreports/generator/pdf/document.rb +28 -28
  120. data/lib/thinreports/generator/pdf/drawer/base.rb +16 -22
  121. data/lib/thinreports/generator/pdf/drawer/list.rb +39 -21
  122. data/lib/thinreports/generator/pdf/drawer/list_section.rb +17 -18
  123. data/lib/thinreports/generator/pdf/drawer/page.rb +37 -26
  124. data/lib/thinreports/generator/pdf/prawn_ext.rb +18 -17
  125. data/lib/thinreports/generator/pdf.rb +28 -31
  126. data/lib/thinreports/generator.rb +6 -8
  127. data/lib/thinreports/layout/base.rb +24 -36
  128. data/lib/thinreports/layout/configuration.rb +11 -9
  129. data/lib/thinreports/layout/format.rb +26 -31
  130. data/lib/thinreports/layout/version.rb +8 -9
  131. data/lib/thinreports/layout.rb +2 -2
  132. data/lib/thinreports/report/base.rb +117 -109
  133. data/lib/thinreports/report/events.rb +5 -5
  134. data/lib/thinreports/report/internal.rb +48 -38
  135. data/lib/thinreports/{core → report}/page.rb +42 -32
  136. data/lib/thinreports/report.rb +10 -14
  137. data/lib/thinreports/version.rb +2 -3
  138. data/lib/thinreports.rb +14 -2
  139. data/test/data/font.ttf +0 -0
  140. data/test/data/layout_block.tlf +1 -0
  141. data/test/data/layout_list.tlf +1 -0
  142. data/test/data/layout_list_noheader.tlf +1 -0
  143. data/test/data/layout_text1.tlf +1 -0
  144. data/test/data/layout_text2.tlf +1 -0
  145. data/test/test_helper.rb +74 -0
  146. data/test/tmp/.gitkeep +0 -0
  147. data/test/unit/core/format/test_base.rb +14 -14
  148. data/test/unit/core/format/test_builder.rb +20 -25
  149. data/test/unit/core/shape/base/test_internal.rb +34 -37
  150. data/test/unit/core/shape/basic/test_basic_format.rb +4 -4
  151. data/test/unit/core/shape/basic/test_basic_interface.rb +15 -13
  152. data/test/unit/core/shape/basic/test_basic_internal.rb +19 -16
  153. data/test/unit/core/shape/basic/test_format.rb +4 -4
  154. data/test/unit/core/shape/basic/test_interface.rb +36 -46
  155. data/test/unit/core/shape/basic/test_internal.rb +29 -18
  156. data/test/unit/core/shape/image_block/test_format.rb +5 -5
  157. data/test/unit/core/shape/image_block/test_interface.rb +17 -16
  158. data/test/unit/core/shape/image_block/test_internal.rb +19 -16
  159. data/test/unit/core/shape/list/test_configuration.rb +50 -33
  160. data/test/unit/core/shape/list/test_events.rb +7 -7
  161. data/test/unit/core/shape/list/test_format.rb +16 -18
  162. data/test/unit/core/shape/list/test_manager.rb +15 -5
  163. data/test/unit/core/shape/list/test_page.rb +80 -22
  164. data/test/unit/core/shape/list/test_page_state.rb +13 -13
  165. data/test/unit/core/shape/list/test_section_format.rb +16 -17
  166. data/test/unit/core/shape/list/test_section_interface.rb +30 -22
  167. data/test/unit/core/shape/list/test_section_internal.rb +21 -19
  168. data/test/unit/core/shape/list/test_store.rb +7 -7
  169. data/test/unit/core/shape/manager/test_format.rb +11 -15
  170. data/test/unit/core/shape/manager/test_internal.rb +9 -9
  171. data/test/unit/core/shape/manager/test_target.rb +85 -57
  172. data/test/unit/core/shape/page_number/test_format.rb +73 -0
  173. data/test/unit/core/shape/page_number/test_interface.rb +33 -0
  174. data/test/unit/core/shape/page_number/test_internal.rb +81 -0
  175. data/test/unit/core/shape/styles/test_base.rb +9 -9
  176. data/test/unit/core/shape/styles/test_basic.rb +5 -5
  177. data/test/unit/core/shape/styles/test_graphic.rb +19 -33
  178. data/test/unit/core/shape/styles/test_text.rb +29 -7
  179. data/test/unit/core/shape/text/test_format.rb +6 -6
  180. data/test/unit/core/shape/text/test_internal.rb +11 -12
  181. data/test/unit/core/shape/text_block/formatter/test_basic.rb +16 -16
  182. data/test/unit/core/shape/text_block/formatter/test_datetime.rb +22 -20
  183. data/test/unit/core/shape/text_block/formatter/test_number.rb +34 -34
  184. data/test/unit/core/shape/text_block/formatter/test_padding.rb +44 -44
  185. data/test/unit/core/shape/text_block/test_format.rb +13 -8
  186. data/test/unit/core/shape/text_block/test_formatter.rb +17 -17
  187. data/test/unit/core/shape/text_block/test_interface.rb +37 -20
  188. data/test/unit/core/shape/text_block/test_internal.rb +38 -38
  189. data/test/unit/core/test_events.rb +10 -8
  190. data/test/unit/core/test_shape.rb +11 -7
  191. data/test/unit/core/test_utils.rb +68 -0
  192. data/test/unit/generator/pdf/document/graphics/test_attributes.rb +10 -4
  193. data/test/unit/generator/pdf/document/graphics/test_text.rb +60 -53
  194. data/test/unit/generator/pdf/document/test_draw_shape.rb +14 -6
  195. data/test/unit/generator/pdf/document/test_font.rb +79 -58
  196. data/test/unit/generator/pdf/document/test_graphics.rb +18 -19
  197. data/test/unit/generator/pdf/document/test_page.rb +68 -43
  198. data/test/unit/generator/pdf/document/test_parse_color.rb +5 -5
  199. data/test/unit/generator/pdf/test_configuration.rb +16 -9
  200. data/test/unit/generator/pdf/test_document.rb +8 -16
  201. data/test/unit/generator/test_base.rb +31 -42
  202. data/test/unit/generator/test_configuration.rb +6 -6
  203. data/test/unit/generator/test_pdf.rb +15 -21
  204. data/test/unit/layout/test_base.rb +34 -79
  205. data/test/unit/layout/test_configuration.rb +12 -37
  206. data/test/unit/layout/test_format.rb +36 -39
  207. data/test/unit/layout/test_version.rb +4 -4
  208. data/test/unit/report/test_base.rb +160 -192
  209. data/test/unit/report/test_events.rb +4 -4
  210. data/test/unit/report/test_internal.rb +102 -82
  211. data/test/unit/test_config.rb +31 -12
  212. data/test/unit/test_layout.rb +7 -7
  213. data/test/unit/test_report.rb +12 -24
  214. data/thinreports.gemspec +23 -26
  215. metadata +118 -181
  216. data/.yardopts +0 -1
  217. data/LICENSE +0 -1
  218. data/README.rdoc +0 -167
  219. data/doc/yardoc_templates/default/layout/html/footer.erb +0 -10
  220. data/lib/thinreports/core/ext/array.rb +0 -19
  221. data/lib/thinreports/core/ext/hash.rb +0 -19
  222. data/lib/thinreports/core/ext/object.rb +0 -25
  223. data/lib/thinreports/core/ext.rb +0 -5
  224. data/lib/thinreports/core/format.rb +0 -14
  225. data/lib/thinreports/core/ordered_hash.rb +0 -39
  226. data/lib/thinreports/core.rb +0 -20
  227. data/lib/thinreports/generator/pdf/drawer.rb +0 -16
  228. data/tasks/doc.rake +0 -13
  229. data/tasks/test.rake +0 -56
  230. data/test/benchmark/basic_estimate.tlf +0 -1
  231. data/test/benchmark/bench_basic_estimate.rb +0 -95
  232. data/test/case/character_spacing/character_spacing.rb +0 -7
  233. data/test/case/character_spacing/character_spacing.tlf +0 -1
  234. data/test/case/dynamic_image/dynamic_image.rb +0 -41
  235. data/test/case/dynamic_image/dynamic_image.tlf +0 -1
  236. data/test/case/dynamic_style/dynamic_style.rb +0 -154
  237. data/test/case/dynamic_style/dynamic_style.tlf +0 -1
  238. data/test/case/dynamic_style/dynamic_style_in_list.tlf +0 -1
  239. data/test/case/eudc/eudc.rb +0 -20
  240. data/test/case/eudc/eudc.tlf +0 -1
  241. data/test/case/helper.rb +0 -29
  242. data/test/case/hidden_shapes/hidden_shapes.rb +0 -13
  243. data/test/case/hidden_shapes/hidden_shapes.tlf +0 -1
  244. data/test/case/list_events/list_events.rb +0 -32
  245. data/test/case/list_events/list_events.tlf +0 -1
  246. data/test/case/list_header_inheriting/list_header_inheriting.rb +0 -17
  247. data/test/case/list_header_inheriting/list_header_inheriting.tlf +0 -1
  248. data/test/case/list_manual_generation/list_manual_generation.rb +0 -22
  249. data/test/case/list_manual_generation/list_manual_generation.tlf +0 -1
  250. data/test/case/single_line_tblock/single_line_tblock.rb +0 -15
  251. data/test/case/single_line_tblock/single_line_tblock.tlf +0 -1
  252. data/test/case/tblock_overflow/tblock_overflow.rb +0 -20
  253. data/test/case/tblock_overflow/tblock_overflow.tlf +0 -1
  254. data/test/case/tblock_styles/tblock_styles.rb +0 -27
  255. data/test/case/tblock_styles/tblock_styles.tlf +0 -1
  256. data/test/case/text_align/text_align.rb +0 -9
  257. data/test/case/text_align/text_align.tlf +0 -1
  258. data/test/unit/core/ext/array_spec.rb +0 -29
  259. data/test/unit/core/ext/hash_spec.rb +0 -29
  260. data/test/unit/core/ext/object_spec.rb +0 -30
  261. data/test/unit/core/ordered_hash_spec.rb +0 -51
  262. data/test/unit/core/shape/base/test_interface.rb +0 -52
  263. data/test/unit/core/utils_spec.rb +0 -56
  264. data/test/unit/data/basic_layout1.tlf +0 -1
  265. data/test/unit/data/basic_layout2.tlf +0 -1
  266. data/test/unit/data/basic_list_layout.tlf +0 -1
  267. data/test/unit/data/basic_list_noheader_layout.tlf +0 -1
  268. data/test/unit/helper.rb +0 -65
  269. /data/{test/case → examples}/dynamic_image/img200x100.png +0 -0
  270. /data/{test/case → examples}/dynamic_image/img50x50.png +0 -0
  271. /data/{test/case → examples}/dynamic_style/image.png +0 -0
  272. /data/{test/case → examples}/eudc/eudc.ttf +0 -0
  273. /data/{resources/fonts → fonts}/IPA_Font_License_Agreement_v1.0.txt +0 -0
  274. /data/{resources/fonts → fonts}/ipag.ttf +0 -0
  275. /data/{resources/fonts → fonts}/ipagp.ttf +0 -0
  276. /data/{resources/fonts → fonts}/ipam.ttf +0 -0
  277. /data/{resources/fonts → fonts}/ipamp.ttf +0 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 52d5b58f89d69995f780cad5fee9ee7d9476ba48
4
+ data.tar.gz: 1ac6e9e07a7fb3776137cd9d4663fdbae832418e
5
+ SHA512:
6
+ metadata.gz: 5bd6e15835d02834f428649d474bcdf398e1e550f406652c1827539628e2e83b1aa4e8a550e2003d1521ed950f011dbb9b858101bde330c2eb44322a68eb6dad
7
+ data.tar.gz: 25ec1244b98b2da6558b05ab5e36650993574c26aae541ed077934169e4f9ae0154b2a0e7153bedfa668e8f3107ca586fd0cac1b67cab461854559f3c12929de
data/.gitignore CHANGED
@@ -1,8 +1,6 @@
1
1
  Gemfile.lock
2
2
  *.gem
3
- *.swp
4
3
  *.pdf
5
-
6
- doc/yardoc
7
- .yardoc/
8
- coverage
4
+ .bundle
5
+ .yardoc
6
+ doc
data/.travis.yml CHANGED
@@ -1,6 +1,10 @@
1
- rvm:
2
- - 1.8.7
1
+ language: ruby
2
+
3
+ rvm:
3
4
  - 1.9.3
4
- - jruby-18mode
5
+ - 2.0.0
6
+ - 2.1.6
7
+ - 2.2.2
8
+ - jruby
5
9
 
6
- script: rake test:unit
10
+ script: rake test
data/CHANGELOG.md ADDED
@@ -0,0 +1,220 @@
1
+ ## 0.8.0
2
+
3
+ This release is a stepping stone to next major version 1.0.0 release.
4
+
5
+ * Upgrade to Prawn 1.3 and drop support for Ruby 1.8.7 (#11)
6
+ * Change name of root module to Thinreports from ThinReports (#15)
7
+ * Implement `Item#value=` method (#20)
8
+ * Implement new list callbacks (#17)
9
+ * Implement `page[:item_id]=` as alias for `page.item(:item_id).value=` (#22)
10
+ * Support font-size style for Text and TextBlock (#23)
11
+ * Support for setting the default fallback font (#7)
12
+ * Remove `Report#generate_file` method (#13)
13
+ * Deprecate `Report#events`, and implement new callbacks (#18)
14
+ * Deprecate `List#events`, recommend to use `List#on_page_finalize` callback or create manually (#9)
15
+
16
+ ### Upgrade to Prawn 1.3 and drop support for Ruby 1.8.7
17
+
18
+ We have dropped support for MRI 1.8.7 and 1.8 mode JRuby by upgrading to Prawn 1.3.
19
+ Currently supported versions are MRI 1.9.3 and 2.0.0 or higher, JRuby(1.9 mode) 1.7 or higher.
20
+
21
+ ### Change name of root module to Thinreports from ThinReports
22
+
23
+ We have changed name of root module to `Thinreports` from `ThinReports`.
24
+ Old name `ThinReports` has been enabling as alias, but it will be removed
25
+ in the next major release.
26
+
27
+ ### Deprecate `List#events` and `List#store`
28
+
29
+ `List#events` and `List#store` have been deprecated.
30
+
31
+ ```ruby
32
+ report.layout.config.list do |list|
33
+ list.events.on :page_footer_insert do |e|
34
+ # ...
35
+ end
36
+ # => warn: "[DEPRECATION] ..."
37
+
38
+ list.events.on :footer_insert do |e|
39
+ # ...
40
+ end
41
+ # => warn: "[DEPRECATION] ..."
42
+
43
+ list.events.on :page_finalize do |e|
44
+ # ...
45
+ end
46
+ # => warn: "[DEPRECATION] ..."
47
+ end
48
+
49
+ list.store.price += 0 # => warn: "[DEPRECATION] ..."
50
+ ```
51
+
52
+ Please use new callbacks instead:
53
+
54
+ ```ruby
55
+ report.list do |list|
56
+ price = 0
57
+
58
+ list.on_page_footer_insert do |footer|
59
+ footer.item(:price).value = price
60
+ end
61
+
62
+ list.on_footer_insert do |footer|
63
+ # ...
64
+ end
65
+
66
+ list.on_page_finalize do
67
+ # ...
68
+ end
69
+ end
70
+ ```
71
+
72
+ See [Issue #17](https://github.com/thinreports/thinreports-generator/issues/17), [Issue #9](https://github.com/thinreports/thinreports-generator/issues/9) and [examples/list_events](https://github.com/thinreports/thinreports-generator/tree/master/examples/list_events) for further details.
73
+
74
+ ### Deprecate `Report#events`, and implement new callbacks
75
+
76
+ `Report#events` has been deprecated:
77
+
78
+ ```ruby
79
+ report.events.on :page_create do |e|
80
+ e.page.item(:text1).value('Text1')
81
+ end
82
+ # => warn: "[DEPRECATION] ..."
83
+
84
+ report.events.on :generate do |e|
85
+ e.pages.each do |page|
86
+ page.item(:text2).value('Text2')
87
+ end
88
+ end
89
+ # => warn: "[DEPRECATION] ..."
90
+ ```
91
+
92
+ Please use `Report#on_page_create` callback instead.
93
+ However `Report#on_generate` callback has not been implemented,
94
+ but you can do the same things using `Report#pages` method.
95
+
96
+ ```ruby
97
+ report.on_page_create do |page|
98
+ page.item(:text1).value('Text1')
99
+ end
100
+
101
+ report.pages.each do |page|
102
+ page.item(:text2).value('Text2')
103
+ end
104
+
105
+ report.generate filename: 'foo.pdf'
106
+ ```
107
+
108
+ See [Issue #18](https://github.com/thinreports/thinreports-generator/issues/18) for further details.
109
+
110
+ ### Implement `page[:item_id]=` as alias for `page.item(:item_id).value=` (#22)
111
+
112
+ ```ruby
113
+ # New setter, same as `page.item(:text_block).value = 'tblock value'`
114
+ page[:text_block] = 'tblock value'
115
+ # New getter, same as `page.item(:text_block).value`
116
+ page[:text_block] # => "tblock value"
117
+ page.item(:text_block).value # => "tblock value"
118
+
119
+ page[:image_block] = '/path/to/image.png'
120
+ page[:image_block] # => "/path/to/image.png"
121
+ ```
122
+
123
+ See [Issue #22](https://github.com/thinreports/thinreports-generator/issues/22) for further details.
124
+
125
+ ### Implement `Item#value=` method
126
+
127
+ ```ruby
128
+ page.item(:text_block).value('value')
129
+ page.item(:text_block).value = 'value'
130
+ page.item(:image_block).src('/path/to/image.tlf')
131
+ page.item(:image_block).src = '/path/to/image.tlf'
132
+ ```
133
+
134
+ See [Issue #20](https://github.com/thinreports/thinreports-generator/issues/20) for further details.
135
+
136
+ ### Support font-size style for Text and TextBlock
137
+
138
+ ```ruby
139
+ page.item(:text).style(:font_size, 20)
140
+ page.item(:text_block).style(:font_size, 20)
141
+ page.item(:text_block).style(:font_size) # => 20
142
+ ```
143
+
144
+ See [Issue #23](https://github.com/thinreports/thinreports-generator/issues/23) for further details.
145
+
146
+ ### Support for setting the default fallback font
147
+
148
+ Please see [Issue #7](https://github.com/thinreports/thinreports-generator/issues/7) for further details.
149
+
150
+ ## 0.7.7.1
151
+
152
+ * No release for generator
153
+
154
+ ## 0.7.7
155
+
156
+ ### Features
157
+
158
+ * ページ番号ツール [Katsuya Hidaka]
159
+ * New "Word-wrap" property of TextBlock [Katsuya Hidaka]
160
+ * B4/B5 の ISO サイズを追加 [Takumi FUJISE / Minoru Maeda / Katsuya Hidaka]
161
+ * generate filename: 'foo.pdf' を実装、#generate_file を非推奨へ [Katsuya Hidaka]
162
+ * start_new_page layout: 'file.tlf' でもデフォルトレイアウトが設定されるよう改善 [Eito Katagiri / Katsuya Hidaka]
163
+
164
+ ### Bug fixes
165
+
166
+ * Report#use_layout で list の設定を行うとエラーが発生する [Katsuya Hidaka]
167
+ * Layout::Format#page_margin_right が不正な値を返す [Katsuya Hidaka]
168
+ * セキュリティを設定した PDF を印刷すると "このページにはエラーがあります..." メッセージが表示される [Katsuya Hidaka]
169
+ * B4 サイズで出力した PDF の用紙サイズが正しくない [Takumi FUJISE / Katsuya Hidaka]
170
+
171
+ ## 0.7.6
172
+
173
+ ### Features
174
+
175
+ * デフォルトレイアウトを書き換え可能へ変更 [Katsuya Hidaka]
176
+
177
+ ### Bug fixes
178
+
179
+ * Fix raise NoMethodError when has no default layout [Katsuya Hidaka]
180
+
181
+ ## 0.7.5
182
+
183
+ ### Features
184
+
185
+ * テキストブロックのオーバフロープロパティ [Katsuya Hidaka]
186
+ * list メソッドのデフォルト id と Report#list の追加 [Katsuya Hidaka]
187
+
188
+ ### Bug fixes
189
+
190
+ * gem install 時にRDoc生成時のエラーが表示される場合がある [Katsuya Hidaka]
191
+ * エディターにて一覧表ツールのヘッダーを使わない場合の動作について [吉田 和弘 / Katsuya Hidaka]
192
+
193
+ ## 0.7.0
194
+
195
+ ### Features
196
+
197
+ * Listに :page_finalize イベントを追加
198
+ * ダイナミックスタイルの拡充
199
+ * イメージブロックの実装
200
+ * Tblockで行間、横位置、縦位置、文字間隔の指定を可能に
201
+ * Prawn 0.12.0 を採用
202
+ * メタ情報のタイトルに反映
203
+ * Example Test環境の構築
204
+ * 外字の埋め込みサポート
205
+ * clean taskの削除
206
+ * YARD Docのテンプレート追加
207
+ * ロードするprawnのバージョンを固定
208
+ * .generate, .generate_fileメソッドのオプション指定をフラット化
209
+ * 単行モードテキストブロックがレイアウトで定義した「高さ」の影響を受けないように
210
+ * PXD形式の出力フォーマット廃止とデフォルトタイプの導入
211
+ * $KCODEによる文字カウント処理の改善
212
+ * List#headerの挙動を改善
213
+ * Errors::UnknownItemId 時のエラーメッセージを分かりやすく
214
+ * テスト漏れに対するテストコード作成とテスト
215
+
216
+ ### Bug fixes
217
+
218
+ * フッターが挿入時、リスト領域をオーバフローしない場合でも改ページされる場合がある
219
+ * Tblockで基本書式のみ設定されている場合、その書式が反映されない
220
+ * Tblockがフォントサイズに対して小さすぎる場合にエラー
data/Gemfile CHANGED
@@ -2,13 +2,6 @@ source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- # In the case of Ruby 1.8.7.
6
- unless RUBY_VERSION > '1.9'
7
- gem 'json', '>= 1.4.6'
8
- gem 'minitest', '>= 0'
9
- gem 'turn', '>=0'
5
+ group :example do
6
+ gem 'pdf-inspector'
10
7
  end
11
-
12
- platforms :mswin, :mingw do
13
- gem 'win32console'
14
- end
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Matsukei Co.,Ltd.
1
+ Copyright (c) 2015 Matsukei Co.,Ltd.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md ADDED
@@ -0,0 +1,286 @@
1
+ # Thinreports Generator [![Join the chat at https://gitter.im/thinreports/thinreports-generator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/thinreports/thinreports-generator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/thinreports.svg)](http://badge.fury.io/rb/thinreports)
4
+ [![](http://img.shields.io/travis/thinreports/thinreports-generator.svg?style=flat)](http://travis-ci.org/thinreports/thinreports-generator)
5
+ [![](http://img.shields.io/codeclimate/github/thinreports/thinreports-generator.svg?style=flat)](https://codeclimate.com/github/thinreports/thinreports-generator)
6
+ [![](http://img.shields.io/gemnasium/thinreports/thinreports-generator.svg?style=flat)](https://gemnasium.com/thinreports/thinreports-generator)
7
+
8
+ [Thinreports](http://www.thinreports.org) is an open source report generating tool for Ruby.
9
+
10
+ * Thinreports Editor (GUI Designer)
11
+ * Thinreports Generator (Report Generator for Ruby)
12
+
13
+ ## Getting Started
14
+
15
+ * [Installation Guide](http://www.thinreports.org/documentation/getting-started/installation.html)
16
+ * [Quick Start Guide](http://www.thinreports.org/documentation/getting-started/quickstart.html)
17
+ * [Examples](https://github.com/thinreports/thinreports-examples)
18
+ * [Rails4 Example](https://github.com/thinreports/thinreports-rails4-example)
19
+ * [Changelog](https://github.com/thinreports/thinreports-generator/blob/master/CHANGELOG.md)
20
+ * [Discussion Group](https://groups.google.com/forum/#!forum/thinreports)
21
+ * [![Join the chat at https://gitter.im/thinreports/thinreports-generator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/thinreports/thinreports-generator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
22
+
23
+ ## Supported versions
24
+
25
+ * Ruby 1.9.3, 2.0, 2.1, 2.2
26
+ * JRuby 1.7.0+ (1.9 mode)
27
+
28
+ ## Quick Reference
29
+
30
+ **NOTE:** You need to create a layout file `.tlf` using [Thinreports Editor](http://www.thinreports.org/features/editor/).
31
+
32
+ ### Basic Objects and Basic Usage
33
+
34
+ ```ruby
35
+ require 'thinreports'
36
+
37
+ report = Thinreports::Report.new layout: 'report.tlf'
38
+
39
+ report.start_new_page do
40
+ item(:title).value('Thinreports')
41
+ end
42
+
43
+ report.start_new_page do |page|
44
+ # Item Finder
45
+ page.item(:item_id) # => Item object
46
+ page[:item_id] # => Item object
47
+
48
+ # Text block
49
+ page.item(:text_block).value('Pure Ruby')
50
+ page.item(:text_block).value = 'Pure Ruby'
51
+ page[:text_block] = 'Pure Ruby'
52
+ page.item('text_block').set('value', color: '#0000ff')
53
+ page.item(:text_block).format_enabled(false)
54
+
55
+ # Image block
56
+ page.item(:image_block).src('/path/to/image.png')
57
+ page.item(:image_block).src = '/path/to/image.png'
58
+ page[:image_block] = '/path/to/image.png'
59
+ require 'open-uri'
60
+ page.item(:image_block).src(open('http://www.thinreports.org/assets/logos/thinreports-logo.png'))
61
+
62
+ # Attributes
63
+ page.item(:any).hide
64
+ page.item(:any).show
65
+ page.item(:any).visible(true)
66
+ page.item(:any).visible? # => true
67
+ page.item(:any).id # => "any"
68
+
69
+ # Styles
70
+ page.item(:text).style(:color, 'red')
71
+ page.item(:text).style(:bold, true)
72
+ page.item(:text).style(:italic, true)
73
+ page.item(:text).style(:linethrough, true)
74
+ page.item(:text).style(:underline, true)
75
+ page.item(:text).style(:font_size, 20)
76
+
77
+ page.item(:text).style(:align, :left or :center or :right)
78
+ page.item(:text).style(:valign, :top or :center or :bottom)
79
+
80
+ page.item(:rectangle).style(:border_color, '#ff0000')
81
+ .style(:border_width, 1)
82
+ .style(:fill_color, '#ffffff')
83
+
84
+ # Bulk setting of styles
85
+ page.item(:text).styles(color: '#00000', align: :right)
86
+
87
+ # Bulk setting of values
88
+ page.values text_block_a: 'value', text_block_b: 'value'
89
+
90
+ # Helpers
91
+ page.item_exists?(:existing_id) # => true
92
+ page.item_exists?('existing_id') # => true
93
+ page.item_exists?(:unknown_id) # => false
94
+ end
95
+
96
+ report.generate(filename: 'report.pdf')
97
+ ```
98
+
99
+ ```ruby
100
+ Thinreports::Report.generate(filename: 'report.pdf', layout: 'report.tlf') do |report|
101
+ report.start_new_page do |page|
102
+ # :
103
+ end
104
+ end
105
+ ```
106
+
107
+ ### Report and Page
108
+
109
+ ```ruby
110
+ report = Thinreports::Report.new layout: 'foo.tlf'
111
+
112
+ 3.times { report.start_new_page }
113
+
114
+ # Returns all pages
115
+ report.pages # => [<Report::Page>, <Report::Page>, <Report::Page>]
116
+ # Returns number of pages
117
+ report.page_count # => 3
118
+
119
+ # Add a blank page
120
+ report.add_blank_page
121
+
122
+ report.pages.last # => Report::BlankPage
123
+ ```
124
+
125
+ ### Using multiple layouts
126
+
127
+ ```ruby
128
+ report = Thinreports::Report.new
129
+
130
+ report.use_layout '/path/to/default.tlf', default: true
131
+ report.use_layout '/path/to/other1.tlf', id: :other
132
+
133
+ report.start_new_page do |page|
134
+ # use '/path/to/default.tlf' layout
135
+ end
136
+
137
+ report.start_new_page layout: :other do |page|
138
+ # use '/path/to/other1.tlf' layout
139
+ end
140
+
141
+ report.start_new_page layout: '/path/to/other2.tlf' do |page|
142
+ # use '/path/to/other2.tlf' layout
143
+ end
144
+ ```
145
+
146
+ ### Callbacks
147
+
148
+ ```ruby
149
+ report = Thinreports::Report.new layout: 'foo.tlf'
150
+
151
+ # It will be called before finalizing each page
152
+ report.on_page_create do |page|
153
+ page.item(:text).value('Text for all pages')
154
+ end
155
+ ```
156
+
157
+ See also [examples/report_callbacks](https://github.com/thinreports/thinreports-generator/tree/master/examples/report_callbacks).
158
+
159
+ ### List
160
+
161
+ ```ruby
162
+ report = Thinreports::Report.new layout: 'list.tlf'
163
+
164
+ report.list.header do |header|
165
+ header.item(:text_block).value('Title')
166
+ end
167
+
168
+ 10.times do |n|
169
+ report.list.add_row do |row|
170
+ row.item(:text_block).value(n)
171
+ end
172
+ end
173
+
174
+ report.generate(filename: 'list.pdf')
175
+ ```
176
+
177
+ ```ruby
178
+ report = Thinreports::Report.new layout: 'list_with_footer.tlf'
179
+
180
+ report.list do |list|
181
+ total_price = 0
182
+ price_per_page = 0
183
+
184
+ list.on_page_finalize do
185
+ total_price += price_per_page
186
+ price_per_page = 0
187
+ end
188
+
189
+ list.on_page_footer_insert do |footer|
190
+ footer.values price: price_per_page
191
+ end
192
+
193
+ list.on_footer_insert do |footer|
194
+ footer.item(:price).value(total_price)
195
+ end
196
+
197
+ [100, 200, 300].each do |price|
198
+ list.add_row do |row|
199
+ row[:price] = price
200
+ end
201
+ price_per_page += price
202
+ end
203
+ end
204
+ ```
205
+
206
+ See also [examples/list_events](https://github.com/thinreports/thinreports-generator/tree/master/examples/list_events).
207
+
208
+ ### Page Number
209
+
210
+ ```ruby
211
+ # Setting starting number of page
212
+ report.start_page_number_from 5
213
+
214
+ # Setting whether to count new page
215
+ report.start_new_page count: true # default
216
+ report.start_new_page count: false
217
+
218
+ # Change styles
219
+ report.start_new_page do |page|
220
+ page.item(:pageno).hide
221
+ page.item(:pageno).show
222
+ page.item(:pageno).visible(false)
223
+ page.item(:pageno).styles(color: 'red', bold: true)
224
+ end
225
+ ```
226
+
227
+ See also [examples/page_number](https://github.com/thinreports/thinreports-generator/blob/master/examples/page_number) and [examples/list_page_number](https://github.com/thinreports/thinreports-generator/blob/master/examples/list_page_number).
228
+
229
+ ### Configuring fallback fonts
230
+
231
+ ```ruby
232
+ Thinreports.configure do |config|
233
+ config.fallback_fonts = '/path/to/fallback.ttf'
234
+ end
235
+
236
+ Thinreports.config.fallback_fonts = ['/path/to/font_a.ttf', '/path/to/font_b.ttf']
237
+ ```
238
+
239
+ See also [examples/eudc](https://github.com/thinreports/thinreports-generator/blob/master/examples/eudc).
240
+
241
+ ## Features
242
+
243
+ Features of Editor is [here](http://www.thinreports.org/features/editor/).
244
+
245
+ ### Easy to generate PDF
246
+
247
+ Design layout using Editor, then embed values to text field in layout.
248
+
249
+ ### Simple runtime environment
250
+
251
+ Ruby, RubyGems, Prawn and Generator.
252
+
253
+ ### Dynamic operation
254
+
255
+ Generator can dynamically:
256
+
257
+ * change value of TextBlock and ImageBlock
258
+ * change style (border, fill, visibility, position, color, font) of Shape
259
+
260
+ ### Others
261
+
262
+ * External characters (Gaiji) for Japanese
263
+
264
+ ## Contributing
265
+
266
+ ### Report bug, post your suggestion
267
+
268
+ If you find bugs or improvements for the Editor, please report it [here](https://github.com/thinreports/thinreports-generator/issues/new).
269
+
270
+ ### Sending a Pull Request
271
+
272
+ 1. Fork it
273
+ 2. Clone your forked repository
274
+ 3. Create your feature branch: `git checkout -b my-new-feature`
275
+ 4. Fix your feature
276
+ 5. Commit your changes: `git commit -am 'Fixed some bugs or features'`
277
+ 6. Push to the branch: `git push origin my-new-feature`
278
+ 7. Create new Pull Request
279
+
280
+ ## License
281
+
282
+ Thinreports Generator is licensed under the [MIT-License](https://github.com/thinreports/thinreports-generator/blob/master/MIT-LICENSE).
283
+
284
+ ## Copyright
285
+
286
+ &copy; 2010-2015 [Matsukei Co.,Ltd](http://www.matsukei.co.jp).
data/Rakefile CHANGED
@@ -1,10 +1,40 @@
1
1
  # coding: utf-8
2
2
 
3
- # Load thinreports
4
- $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/lib'))
5
- require 'thinreports'
6
-
7
- # Load tasks
8
- Dir.glob('tasks/**/*.rake').each do |r|
9
- Rake.application.add_import r
10
- end
3
+ require 'rake/testtask'
4
+ require 'yard'
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.libs << 'test'
8
+ t.test_files = Dir['test/unit/**/test_*.rb'] +
9
+ Dir['test/unit/**/*_spec.rb']
10
+ end
11
+
12
+ namespace :examples do
13
+ desc 'Run all examples'
14
+ task all: :_init do
15
+ require_relative 'examples/helper'
16
+ Dir['examples/*/*.rb'].each {|f| require_relative f }
17
+ end
18
+
19
+ Dir['examples/*/*.rb'].each do |f|
20
+ casename = File.basename(File.dirname(f))
21
+
22
+ desc "Run example: #{casename}"
23
+ task casename.to_sym => :_init do
24
+ require_relative 'examples/helper'
25
+ require_relative "examples/#{casename}/#{casename}"
26
+ end
27
+ end
28
+
29
+ task :_init do
30
+ $:.push File.expand_path('../lib', __FILE__)
31
+ end
32
+ end
33
+
34
+ desc 'Run all examples'
35
+ task examples: :'examples:all'
36
+
37
+ YARD::Rake::YardocTask.new :doc do |yard|
38
+ yard.files = Dir['lib/**/*.rb']
39
+ yard.options = ['--readme', 'README.md']
40
+ end
@@ -0,0 +1,8 @@
1
+ # coding: utf-8
2
+
3
+ example :character_spacing, 'Sets the character spacing in the Editor' do
4
+ report = Thinreports::Report.new layout: layout_filename
5
+ report.start_new_page
6
+
7
+ report.generate filename: output_filename
8
+ end
@@ -0,0 +1 @@
1
+ {"version":"0.7.7.1","finger-print":-105588852,"config":{"title":"Character Spacing","option":{},"page":{"paper-type":"A4","orientation":"portrait","margin-top":"20","margin-bottom":"20","margin-left":"20","margin-right":"20"}},"svg":"<svg width=\"595.2\" height=\"841.8\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" preserveAspectRatio=\"none\" viewBox=\"0 0 595.2 841.8\"><g class=\"canvas\"><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"10\" x-display=\"true\" x-id=\"\" font-size=\"36\" font-family=\"Times New Roman\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"555.2\" x-height=\"40\" x-left=\"20\" x-top=\"21\" id=\"goog_2086231467\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"555.2\" height=\"40\" x=\"20\" y=\"21\"/><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"20\" y=\"45.4\">Times Roman Left</text></g><line stroke=\"#ff0000\" stroke-width=\"1\" fill=\"none\" class=\"s-line\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" x1=\"436\" x2=\"436\" y1=\"20\" y2=\"57\" id=\"goog_2086231468\"/><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"10\" x-display=\"true\" x-id=\"\" font-size=\"36\" font-family=\"IPAMincho\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"555.2\" x-height=\"36\" x-left=\"20\" x-top=\"137\" id=\"goog_2086231469\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"555.2\" height=\"36\" x=\"20\" y=\"137\"/><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"20\" y=\"169\">IPA\u660e\u671d \u5de6\u5bc4\u305b</text></g><line stroke=\"#ff0000\" stroke-width=\"1\" fill=\"none\" class=\"s-line\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" x2=\"351\" y1=\"136\" y2=\"173\" x1=\"351\" id=\"goog_2086231470\"/><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"10\" x-display=\"true\" x-id=\"\" stroke=\"none\" font-weight=\"normal\" font-style=\"normal\" font-family=\"IPAPGothic\" font-size=\"36\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"555.2\" x-height=\"36\" x-left=\"20\" x-top=\"260\" id=\"goog_2086231471\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"555.2\" height=\"36\" x=\"20\" y=\"260\"/><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"20\" y=\"292\">IPA P\u30b4\u30b7\u30c3\u30af\u3000\u5de6\u5bc4\u305b</text></g><line stroke=\"#ff0000\" stroke-width=\"1\" fill=\"none\" class=\"s-line\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" x2=\"487\" y1=\"262\" y2=\"299\" x1=\"487\" id=\"goog_2086231472\"/><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"10\" x-display=\"true\" x-id=\"\" stroke=\"none\" font-weight=\"normal\" font-style=\"normal\" font-family=\"Times New Roman\" font-size=\"36\" text-anchor=\"end\" text-decoration=\"none\" x-width=\"555.2\" x-height=\"40\" x-left=\"20\" x-top=\"70\" id=\"goog_2086231473\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"555.2\" height=\"40\" x=\"20\" y=\"70\"/><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"575.2\" y=\"94\">Times Roman Right</text></g><line stroke=\"#ff0000\" stroke-width=\"1\" fill=\"none\" class=\"s-line\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" x2=\"575.2\" y1=\"21\" y2=\"821.8\" x1=\"575\" id=\"goog_2086231474\"/><line stroke=\"#ff0000\" stroke-width=\"1\" fill=\"none\" class=\"s-line\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" x2=\"131\" y1=\"66\" y2=\"103\" x1=\"131\" id=\"goog_2086231475\"/><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"10\" x-display=\"true\" x-id=\"\" stroke=\"none\" font-weight=\"normal\" font-style=\"normal\" font-family=\"IPAMincho\" font-size=\"36\" text-anchor=\"end\" text-decoration=\"none\" x-width=\"555.2\" x-height=\"36\" x-left=\"20\" x-top=\"186.9\" id=\"goog_2086231476\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"555.2\" height=\"36\" x=\"20\" y=\"186.9\"/><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"575.2\" y=\"218.9\">IPA\u660e\u671d \u53f3\u5bc4\u305b</text></g><line stroke=\"#ff0000\" stroke-width=\"1\" fill=\"none\" class=\"s-line\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" x2=\"247\" y1=\"185.9\" y2=\"222.9\" x1=\"247\" id=\"goog_2086231477\"/><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"10\" x-display=\"true\" x-id=\"\" stroke=\"none\" font-weight=\"normal\" font-style=\"normal\" font-family=\"IPAPGothic\" font-size=\"36\" text-anchor=\"end\" text-decoration=\"none\" x-width=\"555.2\" x-height=\"36\" x-left=\"20\" x-top=\"316\" id=\"goog_2086231478\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"555.2\" height=\"36\" x=\"20\" y=\"316\"/><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"575.2\" y=\"347\">IPA P\u30b4\u30b7\u30c3\u30af\u3000\u53f3\u5bc4\u305b</text></g><line stroke=\"#ff0000\" stroke-width=\"1\" fill=\"none\" class=\"s-line\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" x2=\"108\" y1=\"318\" y2=\"355\" x1=\"108\" id=\"goog_2086231479\"/></g></svg>","state":{"layout-guide":[{"type":"x","position":59.5},{"type":"y","position":434.1},{"type":"y","position":374.1}]}}
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
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