hexapdf 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (346) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTERS +3 -0
  3. data/LICENSE +26 -0
  4. data/README.md +88 -0
  5. data/Rakefile +121 -0
  6. data/VERSION +1 -0
  7. data/agpl-3.0.txt +661 -0
  8. data/bin/hexapdf +6 -0
  9. data/data/hexapdf/afm/Courier-Bold.afm +342 -0
  10. data/data/hexapdf/afm/Courier-BoldOblique.afm +342 -0
  11. data/data/hexapdf/afm/Courier-Oblique.afm +342 -0
  12. data/data/hexapdf/afm/Courier.afm +342 -0
  13. data/data/hexapdf/afm/Helvetica-Bold.afm +2827 -0
  14. data/data/hexapdf/afm/Helvetica-BoldOblique.afm +2827 -0
  15. data/data/hexapdf/afm/Helvetica-Oblique.afm +3051 -0
  16. data/data/hexapdf/afm/Helvetica.afm +3051 -0
  17. data/data/hexapdf/afm/MustRead.html +1 -0
  18. data/data/hexapdf/afm/Symbol.afm +213 -0
  19. data/data/hexapdf/afm/Times-Bold.afm +2588 -0
  20. data/data/hexapdf/afm/Times-BoldItalic.afm +2384 -0
  21. data/data/hexapdf/afm/Times-Italic.afm +2667 -0
  22. data/data/hexapdf/afm/Times-Roman.afm +2419 -0
  23. data/data/hexapdf/afm/ZapfDingbats.afm +225 -0
  24. data/data/hexapdf/encoding/glyphlist.txt +4305 -0
  25. data/data/hexapdf/encoding/zapfdingbats.txt +225 -0
  26. data/examples/arc.rb +50 -0
  27. data/examples/graphics.rb +274 -0
  28. data/examples/hello_world.rb +16 -0
  29. data/examples/machupicchu.jpg +0 -0
  30. data/examples/merging.rb +24 -0
  31. data/examples/optimizing.rb +20 -0
  32. data/examples/show_char_bboxes.rb +55 -0
  33. data/examples/standard_pdf_fonts.rb +72 -0
  34. data/examples/truetype.rb +45 -0
  35. data/lib/hexapdf/cli/extract.rb +128 -0
  36. data/lib/hexapdf/cli/info.rb +121 -0
  37. data/lib/hexapdf/cli/inspect.rb +157 -0
  38. data/lib/hexapdf/cli/modify.rb +218 -0
  39. data/lib/hexapdf/cli.rb +121 -0
  40. data/lib/hexapdf/configuration.rb +392 -0
  41. data/lib/hexapdf/content/canvas.rb +1974 -0
  42. data/lib/hexapdf/content/color_space.rb +364 -0
  43. data/lib/hexapdf/content/graphic_object/arc.rb +267 -0
  44. data/lib/hexapdf/content/graphic_object/endpoint_arc.rb +208 -0
  45. data/lib/hexapdf/content/graphic_object/solid_arc.rb +173 -0
  46. data/lib/hexapdf/content/graphic_object.rb +81 -0
  47. data/lib/hexapdf/content/graphics_state.rb +579 -0
  48. data/lib/hexapdf/content/operator.rb +1072 -0
  49. data/lib/hexapdf/content/parser.rb +204 -0
  50. data/lib/hexapdf/content/processor.rb +451 -0
  51. data/lib/hexapdf/content/transformation_matrix.rb +172 -0
  52. data/lib/hexapdf/content.rb +47 -0
  53. data/lib/hexapdf/data_dir.rb +51 -0
  54. data/lib/hexapdf/dictionary.rb +303 -0
  55. data/lib/hexapdf/dictionary_fields.rb +382 -0
  56. data/lib/hexapdf/document.rb +589 -0
  57. data/lib/hexapdf/document_utils.rb +209 -0
  58. data/lib/hexapdf/encryption/aes.rb +206 -0
  59. data/lib/hexapdf/encryption/arc4.rb +93 -0
  60. data/lib/hexapdf/encryption/fast_aes.rb +79 -0
  61. data/lib/hexapdf/encryption/fast_arc4.rb +67 -0
  62. data/lib/hexapdf/encryption/identity.rb +63 -0
  63. data/lib/hexapdf/encryption/ruby_aes.rb +447 -0
  64. data/lib/hexapdf/encryption/ruby_arc4.rb +96 -0
  65. data/lib/hexapdf/encryption/security_handler.rb +494 -0
  66. data/lib/hexapdf/encryption/standard_security_handler.rb +616 -0
  67. data/lib/hexapdf/encryption.rb +94 -0
  68. data/lib/hexapdf/error.rb +73 -0
  69. data/lib/hexapdf/filter/ascii85_decode.rb +160 -0
  70. data/lib/hexapdf/filter/ascii_hex_decode.rb +87 -0
  71. data/lib/hexapdf/filter/dct_decode.rb +57 -0
  72. data/lib/hexapdf/filter/encryption.rb +59 -0
  73. data/lib/hexapdf/filter/flate_decode.rb +93 -0
  74. data/lib/hexapdf/filter/jpx_decode.rb +56 -0
  75. data/lib/hexapdf/filter/lzw_decode.rb +191 -0
  76. data/lib/hexapdf/filter/predictor.rb +266 -0
  77. data/lib/hexapdf/filter/run_length_decode.rb +108 -0
  78. data/lib/hexapdf/filter.rb +176 -0
  79. data/lib/hexapdf/font/cmap/parser.rb +146 -0
  80. data/lib/hexapdf/font/cmap/writer.rb +176 -0
  81. data/lib/hexapdf/font/cmap.rb +90 -0
  82. data/lib/hexapdf/font/encoding/base.rb +77 -0
  83. data/lib/hexapdf/font/encoding/difference_encoding.rb +64 -0
  84. data/lib/hexapdf/font/encoding/glyph_list.rb +150 -0
  85. data/lib/hexapdf/font/encoding/mac_expert_encoding.rb +221 -0
  86. data/lib/hexapdf/font/encoding/mac_roman_encoding.rb +265 -0
  87. data/lib/hexapdf/font/encoding/standard_encoding.rb +205 -0
  88. data/lib/hexapdf/font/encoding/symbol_encoding.rb +244 -0
  89. data/lib/hexapdf/font/encoding/win_ansi_encoding.rb +280 -0
  90. data/lib/hexapdf/font/encoding/zapf_dingbats_encoding.rb +250 -0
  91. data/lib/hexapdf/font/encoding.rb +68 -0
  92. data/lib/hexapdf/font/true_type/font.rb +179 -0
  93. data/lib/hexapdf/font/true_type/table/cmap.rb +103 -0
  94. data/lib/hexapdf/font/true_type/table/cmap_subtable.rb +384 -0
  95. data/lib/hexapdf/font/true_type/table/directory.rb +92 -0
  96. data/lib/hexapdf/font/true_type/table/glyf.rb +166 -0
  97. data/lib/hexapdf/font/true_type/table/head.rb +143 -0
  98. data/lib/hexapdf/font/true_type/table/hhea.rb +109 -0
  99. data/lib/hexapdf/font/true_type/table/hmtx.rb +79 -0
  100. data/lib/hexapdf/font/true_type/table/loca.rb +79 -0
  101. data/lib/hexapdf/font/true_type/table/maxp.rb +112 -0
  102. data/lib/hexapdf/font/true_type/table/name.rb +218 -0
  103. data/lib/hexapdf/font/true_type/table/os2.rb +200 -0
  104. data/lib/hexapdf/font/true_type/table/post.rb +230 -0
  105. data/lib/hexapdf/font/true_type/table.rb +155 -0
  106. data/lib/hexapdf/font/true_type.rb +48 -0
  107. data/lib/hexapdf/font/true_type_wrapper.rb +240 -0
  108. data/lib/hexapdf/font/type1/afm_parser.rb +230 -0
  109. data/lib/hexapdf/font/type1/character_metrics.rb +67 -0
  110. data/lib/hexapdf/font/type1/font.rb +123 -0
  111. data/lib/hexapdf/font/type1/font_metrics.rb +117 -0
  112. data/lib/hexapdf/font/type1/pfb_parser.rb +71 -0
  113. data/lib/hexapdf/font/type1.rb +52 -0
  114. data/lib/hexapdf/font/type1_wrapper.rb +193 -0
  115. data/lib/hexapdf/font_loader/from_configuration.rb +70 -0
  116. data/lib/hexapdf/font_loader/standard14.rb +98 -0
  117. data/lib/hexapdf/font_loader.rb +85 -0
  118. data/lib/hexapdf/font_utils.rb +89 -0
  119. data/lib/hexapdf/image_loader/jpeg.rb +166 -0
  120. data/lib/hexapdf/image_loader/pdf.rb +89 -0
  121. data/lib/hexapdf/image_loader/png.rb +410 -0
  122. data/lib/hexapdf/image_loader.rb +68 -0
  123. data/lib/hexapdf/importer.rb +139 -0
  124. data/lib/hexapdf/name_tree_node.rb +78 -0
  125. data/lib/hexapdf/number_tree_node.rb +67 -0
  126. data/lib/hexapdf/object.rb +363 -0
  127. data/lib/hexapdf/parser.rb +349 -0
  128. data/lib/hexapdf/rectangle.rb +99 -0
  129. data/lib/hexapdf/reference.rb +98 -0
  130. data/lib/hexapdf/revision.rb +206 -0
  131. data/lib/hexapdf/revisions.rb +194 -0
  132. data/lib/hexapdf/serializer.rb +326 -0
  133. data/lib/hexapdf/stream.rb +279 -0
  134. data/lib/hexapdf/task/dereference.rb +109 -0
  135. data/lib/hexapdf/task/optimize.rb +230 -0
  136. data/lib/hexapdf/task.rb +68 -0
  137. data/lib/hexapdf/tokenizer.rb +406 -0
  138. data/lib/hexapdf/type/catalog.rb +107 -0
  139. data/lib/hexapdf/type/embedded_file.rb +87 -0
  140. data/lib/hexapdf/type/file_specification.rb +232 -0
  141. data/lib/hexapdf/type/font.rb +81 -0
  142. data/lib/hexapdf/type/font_descriptor.rb +109 -0
  143. data/lib/hexapdf/type/font_simple.rb +190 -0
  144. data/lib/hexapdf/type/font_true_type.rb +47 -0
  145. data/lib/hexapdf/type/font_type1.rb +162 -0
  146. data/lib/hexapdf/type/form.rb +103 -0
  147. data/lib/hexapdf/type/graphics_state_parameter.rb +79 -0
  148. data/lib/hexapdf/type/image.rb +73 -0
  149. data/lib/hexapdf/type/info.rb +70 -0
  150. data/lib/hexapdf/type/names.rb +69 -0
  151. data/lib/hexapdf/type/object_stream.rb +224 -0
  152. data/lib/hexapdf/type/page.rb +355 -0
  153. data/lib/hexapdf/type/page_tree_node.rb +269 -0
  154. data/lib/hexapdf/type/resources.rb +212 -0
  155. data/lib/hexapdf/type/trailer.rb +128 -0
  156. data/lib/hexapdf/type/viewer_preferences.rb +73 -0
  157. data/lib/hexapdf/type/xref_stream.rb +204 -0
  158. data/lib/hexapdf/type.rb +67 -0
  159. data/lib/hexapdf/utils/bit_field.rb +87 -0
  160. data/lib/hexapdf/utils/bit_stream.rb +148 -0
  161. data/lib/hexapdf/utils/lru_cache.rb +65 -0
  162. data/lib/hexapdf/utils/math_helpers.rb +55 -0
  163. data/lib/hexapdf/utils/object_hash.rb +130 -0
  164. data/lib/hexapdf/utils/pdf_doc_encoding.rb +93 -0
  165. data/lib/hexapdf/utils/sorted_tree_node.rb +339 -0
  166. data/lib/hexapdf/version.rb +39 -0
  167. data/lib/hexapdf/writer.rb +199 -0
  168. data/lib/hexapdf/xref_section.rb +152 -0
  169. data/lib/hexapdf.rb +34 -0
  170. data/man/man1/hexapdf.1 +249 -0
  171. data/test/data/aes-test-vectors/CBCGFSbox-128-decrypt.data.gz +0 -0
  172. data/test/data/aes-test-vectors/CBCGFSbox-128-encrypt.data.gz +0 -0
  173. data/test/data/aes-test-vectors/CBCGFSbox-192-decrypt.data.gz +0 -0
  174. data/test/data/aes-test-vectors/CBCGFSbox-192-encrypt.data.gz +0 -0
  175. data/test/data/aes-test-vectors/CBCGFSbox-256-decrypt.data.gz +0 -0
  176. data/test/data/aes-test-vectors/CBCGFSbox-256-encrypt.data.gz +0 -0
  177. data/test/data/aes-test-vectors/CBCKeySbox-128-decrypt.data.gz +0 -0
  178. data/test/data/aes-test-vectors/CBCKeySbox-128-encrypt.data.gz +0 -0
  179. data/test/data/aes-test-vectors/CBCKeySbox-192-decrypt.data.gz +0 -0
  180. data/test/data/aes-test-vectors/CBCKeySbox-192-encrypt.data.gz +0 -0
  181. data/test/data/aes-test-vectors/CBCKeySbox-256-decrypt.data.gz +0 -0
  182. data/test/data/aes-test-vectors/CBCKeySbox-256-encrypt.data.gz +0 -0
  183. data/test/data/aes-test-vectors/CBCVarKey-128-decrypt.data.gz +0 -0
  184. data/test/data/aes-test-vectors/CBCVarKey-128-encrypt.data.gz +0 -0
  185. data/test/data/aes-test-vectors/CBCVarKey-192-decrypt.data.gz +0 -0
  186. data/test/data/aes-test-vectors/CBCVarKey-192-encrypt.data.gz +0 -0
  187. data/test/data/aes-test-vectors/CBCVarKey-256-decrypt.data.gz +0 -0
  188. data/test/data/aes-test-vectors/CBCVarKey-256-encrypt.data.gz +0 -0
  189. data/test/data/aes-test-vectors/CBCVarTxt-128-decrypt.data.gz +0 -0
  190. data/test/data/aes-test-vectors/CBCVarTxt-128-encrypt.data.gz +0 -0
  191. data/test/data/aes-test-vectors/CBCVarTxt-192-decrypt.data.gz +0 -0
  192. data/test/data/aes-test-vectors/CBCVarTxt-192-encrypt.data.gz +0 -0
  193. data/test/data/aes-test-vectors/CBCVarTxt-256-decrypt.data.gz +0 -0
  194. data/test/data/aes-test-vectors/CBCVarTxt-256-encrypt.data.gz +0 -0
  195. data/test/data/fonts/Ubuntu-Title.ttf +0 -0
  196. data/test/data/images/cmyk.jpg +0 -0
  197. data/test/data/images/fillbytes.jpg +0 -0
  198. data/test/data/images/gray.jpg +0 -0
  199. data/test/data/images/greyscale-1bit.png +0 -0
  200. data/test/data/images/greyscale-2bit.png +0 -0
  201. data/test/data/images/greyscale-4bit.png +0 -0
  202. data/test/data/images/greyscale-8bit.png +0 -0
  203. data/test/data/images/greyscale-alpha-8bit.png +0 -0
  204. data/test/data/images/greyscale-trns-8bit.png +0 -0
  205. data/test/data/images/greyscale-with-gamma1.0.png +0 -0
  206. data/test/data/images/greyscale-with-gamma1.5.png +0 -0
  207. data/test/data/images/indexed-1bit.png +0 -0
  208. data/test/data/images/indexed-2bit.png +0 -0
  209. data/test/data/images/indexed-4bit.png +0 -0
  210. data/test/data/images/indexed-8bit.png +0 -0
  211. data/test/data/images/indexed-alpha-4bit.png +0 -0
  212. data/test/data/images/indexed-alpha-8bit.png +0 -0
  213. data/test/data/images/rgb.jpg +0 -0
  214. data/test/data/images/truecolour-8bit.png +0 -0
  215. data/test/data/images/truecolour-alpha-8bit.png +0 -0
  216. data/test/data/images/truecolour-gama-chrm-8bit.png +0 -0
  217. data/test/data/images/truecolour-srgb-8bit.png +0 -0
  218. data/test/data/minimal.pdf +44 -0
  219. data/test/data/standard-security-handler/README +9 -0
  220. data/test/data/standard-security-handler/bothpwd-aes-128bit-V4.pdf +44 -0
  221. data/test/data/standard-security-handler/bothpwd-aes-256bit-V5.pdf +0 -0
  222. data/test/data/standard-security-handler/bothpwd-arc4-128bit-V2.pdf +43 -0
  223. data/test/data/standard-security-handler/bothpwd-arc4-128bit-V4.pdf +43 -0
  224. data/test/data/standard-security-handler/bothpwd-arc4-40bit-V1.pdf +0 -0
  225. data/test/data/standard-security-handler/nopwd-aes-128bit-V4.pdf +43 -0
  226. data/test/data/standard-security-handler/nopwd-aes-256bit-V5.pdf +0 -0
  227. data/test/data/standard-security-handler/nopwd-arc4-128bit-V2.pdf +43 -0
  228. data/test/data/standard-security-handler/nopwd-arc4-128bit-V4.pdf +43 -0
  229. data/test/data/standard-security-handler/nopwd-arc4-40bit-V1.pdf +43 -0
  230. data/test/data/standard-security-handler/ownerpwd-aes-128bit-V4.pdf +0 -0
  231. data/test/data/standard-security-handler/ownerpwd-aes-256bit-V5.pdf +43 -0
  232. data/test/data/standard-security-handler/ownerpwd-arc4-128bit-V2.pdf +43 -0
  233. data/test/data/standard-security-handler/ownerpwd-arc4-128bit-V4.pdf +43 -0
  234. data/test/data/standard-security-handler/ownerpwd-arc4-40bit-V1.pdf +43 -0
  235. data/test/data/standard-security-handler/userpwd-aes-128bit-V4.pdf +43 -0
  236. data/test/data/standard-security-handler/userpwd-aes-256bit-V5.pdf +43 -0
  237. data/test/data/standard-security-handler/userpwd-arc4-128bit-V2.pdf +0 -0
  238. data/test/data/standard-security-handler/userpwd-arc4-128bit-V4.pdf +0 -0
  239. data/test/data/standard-security-handler/userpwd-arc4-40bit-V1.pdf +43 -0
  240. data/test/hexapdf/common_tokenizer_tests.rb +204 -0
  241. data/test/hexapdf/content/common.rb +31 -0
  242. data/test/hexapdf/content/graphic_object/test_arc.rb +93 -0
  243. data/test/hexapdf/content/graphic_object/test_endpoint_arc.rb +91 -0
  244. data/test/hexapdf/content/graphic_object/test_solid_arc.rb +86 -0
  245. data/test/hexapdf/content/test_canvas.rb +1113 -0
  246. data/test/hexapdf/content/test_color_space.rb +97 -0
  247. data/test/hexapdf/content/test_graphics_state.rb +138 -0
  248. data/test/hexapdf/content/test_operator.rb +619 -0
  249. data/test/hexapdf/content/test_parser.rb +66 -0
  250. data/test/hexapdf/content/test_processor.rb +156 -0
  251. data/test/hexapdf/content/test_transformation_matrix.rb +64 -0
  252. data/test/hexapdf/encryption/common.rb +87 -0
  253. data/test/hexapdf/encryption/test_aes.rb +121 -0
  254. data/test/hexapdf/encryption/test_arc4.rb +39 -0
  255. data/test/hexapdf/encryption/test_fast_aes.rb +17 -0
  256. data/test/hexapdf/encryption/test_fast_arc4.rb +12 -0
  257. data/test/hexapdf/encryption/test_identity.rb +21 -0
  258. data/test/hexapdf/encryption/test_ruby_aes.rb +23 -0
  259. data/test/hexapdf/encryption/test_ruby_arc4.rb +20 -0
  260. data/test/hexapdf/encryption/test_security_handler.rb +356 -0
  261. data/test/hexapdf/encryption/test_standard_security_handler.rb +274 -0
  262. data/test/hexapdf/filter/common.rb +53 -0
  263. data/test/hexapdf/filter/test_ascii85_decode.rb +60 -0
  264. data/test/hexapdf/filter/test_ascii_hex_decode.rb +33 -0
  265. data/test/hexapdf/filter/test_encryption.rb +24 -0
  266. data/test/hexapdf/filter/test_flate_decode.rb +35 -0
  267. data/test/hexapdf/filter/test_lzw_decode.rb +52 -0
  268. data/test/hexapdf/filter/test_predictor.rb +183 -0
  269. data/test/hexapdf/filter/test_run_length_decode.rb +32 -0
  270. data/test/hexapdf/font/cmap/test_parser.rb +67 -0
  271. data/test/hexapdf/font/cmap/test_writer.rb +58 -0
  272. data/test/hexapdf/font/encoding/test_base.rb +35 -0
  273. data/test/hexapdf/font/encoding/test_difference_encoding.rb +21 -0
  274. data/test/hexapdf/font/encoding/test_glyph_list.rb +59 -0
  275. data/test/hexapdf/font/encoding/test_zapf_dingbats_encoding.rb +16 -0
  276. data/test/hexapdf/font/test_encoding.rb +27 -0
  277. data/test/hexapdf/font/test_true_type_wrapper.rb +110 -0
  278. data/test/hexapdf/font/test_type1_wrapper.rb +66 -0
  279. data/test/hexapdf/font/true_type/common.rb +19 -0
  280. data/test/hexapdf/font/true_type/table/test_cmap.rb +59 -0
  281. data/test/hexapdf/font/true_type/table/test_cmap_subtable.rb +133 -0
  282. data/test/hexapdf/font/true_type/table/test_directory.rb +35 -0
  283. data/test/hexapdf/font/true_type/table/test_glyf.rb +58 -0
  284. data/test/hexapdf/font/true_type/table/test_head.rb +76 -0
  285. data/test/hexapdf/font/true_type/table/test_hhea.rb +40 -0
  286. data/test/hexapdf/font/true_type/table/test_hmtx.rb +38 -0
  287. data/test/hexapdf/font/true_type/table/test_loca.rb +43 -0
  288. data/test/hexapdf/font/true_type/table/test_maxp.rb +62 -0
  289. data/test/hexapdf/font/true_type/table/test_name.rb +95 -0
  290. data/test/hexapdf/font/true_type/table/test_os2.rb +65 -0
  291. data/test/hexapdf/font/true_type/table/test_post.rb +89 -0
  292. data/test/hexapdf/font/true_type/test_font.rb +120 -0
  293. data/test/hexapdf/font/true_type/test_table.rb +41 -0
  294. data/test/hexapdf/font/type1/test_afm_parser.rb +51 -0
  295. data/test/hexapdf/font/type1/test_font.rb +68 -0
  296. data/test/hexapdf/font/type1/test_pfb_parser.rb +37 -0
  297. data/test/hexapdf/font_loader/test_from_configuration.rb +28 -0
  298. data/test/hexapdf/font_loader/test_standard14.rb +22 -0
  299. data/test/hexapdf/image_loader/test_jpeg.rb +83 -0
  300. data/test/hexapdf/image_loader/test_pdf.rb +47 -0
  301. data/test/hexapdf/image_loader/test_png.rb +258 -0
  302. data/test/hexapdf/task/test_dereference.rb +46 -0
  303. data/test/hexapdf/task/test_optimize.rb +137 -0
  304. data/test/hexapdf/test_configuration.rb +82 -0
  305. data/test/hexapdf/test_data_dir.rb +32 -0
  306. data/test/hexapdf/test_dictionary.rb +284 -0
  307. data/test/hexapdf/test_dictionary_fields.rb +185 -0
  308. data/test/hexapdf/test_document.rb +574 -0
  309. data/test/hexapdf/test_document_utils.rb +144 -0
  310. data/test/hexapdf/test_filter.rb +96 -0
  311. data/test/hexapdf/test_font_utils.rb +47 -0
  312. data/test/hexapdf/test_importer.rb +78 -0
  313. data/test/hexapdf/test_object.rb +177 -0
  314. data/test/hexapdf/test_parser.rb +394 -0
  315. data/test/hexapdf/test_rectangle.rb +36 -0
  316. data/test/hexapdf/test_reference.rb +41 -0
  317. data/test/hexapdf/test_revision.rb +139 -0
  318. data/test/hexapdf/test_revisions.rb +93 -0
  319. data/test/hexapdf/test_serializer.rb +169 -0
  320. data/test/hexapdf/test_stream.rb +262 -0
  321. data/test/hexapdf/test_tokenizer.rb +30 -0
  322. data/test/hexapdf/test_writer.rb +120 -0
  323. data/test/hexapdf/test_xref_section.rb +35 -0
  324. data/test/hexapdf/type/test_catalog.rb +30 -0
  325. data/test/hexapdf/type/test_embedded_file.rb +16 -0
  326. data/test/hexapdf/type/test_file_specification.rb +148 -0
  327. data/test/hexapdf/type/test_font.rb +35 -0
  328. data/test/hexapdf/type/test_font_descriptor.rb +51 -0
  329. data/test/hexapdf/type/test_font_simple.rb +190 -0
  330. data/test/hexapdf/type/test_font_type1.rb +128 -0
  331. data/test/hexapdf/type/test_form.rb +60 -0
  332. data/test/hexapdf/type/test_info.rb +14 -0
  333. data/test/hexapdf/type/test_names.rb +9 -0
  334. data/test/hexapdf/type/test_object_stream.rb +84 -0
  335. data/test/hexapdf/type/test_page.rb +260 -0
  336. data/test/hexapdf/type/test_page_tree_node.rb +255 -0
  337. data/test/hexapdf/type/test_resources.rb +167 -0
  338. data/test/hexapdf/type/test_trailer.rb +109 -0
  339. data/test/hexapdf/type/test_xref_stream.rb +131 -0
  340. data/test/hexapdf/utils/test_bit_field.rb +47 -0
  341. data/test/hexapdf/utils/test_lru_cache.rb +22 -0
  342. data/test/hexapdf/utils/test_object_hash.rb +115 -0
  343. data/test/hexapdf/utils/test_pdf_doc_encoding.rb +18 -0
  344. data/test/hexapdf/utils/test_sorted_tree_node.rb +232 -0
  345. data/test/test_helper.rb +56 -0
  346. metadata +427 -0
@@ -0,0 +1,280 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ #--
4
+ # This file is part of HexaPDF.
5
+ #
6
+ # HexaPDF - A Versatile PDF Creation and Manipulation Library For Ruby
7
+ # Copyright (C) 2016 Thomas Leitner
8
+ #
9
+ # HexaPDF is free software: you can redistribute it and/or modify it
10
+ # under the terms of the GNU Affero General Public License version 3 as
11
+ # published by the Free Software Foundation with the addition of the
12
+ # following permission added to Section 15 as permitted in Section 7(a):
13
+ # FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
14
+ # THOMAS LEITNER, THOMAS LEITNER DISCLAIMS THE WARRANTY OF NON
15
+ # INFRINGEMENT OF THIRD PARTY RIGHTS.
16
+ #
17
+ # HexaPDF is distributed in the hope that it will be useful, but WITHOUT
18
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
20
+ # License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Affero General Public License
23
+ # along with HexaPDF. If not, see <http://www.gnu.org/licenses/>.
24
+ #
25
+ # The interactive user interfaces in modified source and object code
26
+ # versions of HexaPDF must display Appropriate Legal Notices, as required
27
+ # under Section 5 of the GNU Affero General Public License version 3.
28
+ #
29
+ # In accordance with Section 7(b) of the GNU Affero General Public
30
+ # License, a covered work must retain the producer line in every PDF that
31
+ # is created or manipulated using HexaPDF.
32
+ #++
33
+
34
+ require 'hexapdf/font/encoding/base'
35
+
36
+ module HexaPDF
37
+ module Font
38
+ module Encoding
39
+
40
+ # The Windows Code Page 1252, the standard Windows encoding for Latin texts.
41
+ #
42
+ # See: PDF1.7 sD.1, sD.2
43
+ class WinAnsiEncoding < Base
44
+
45
+ def initialize #:nodoc:
46
+ super
47
+ @encoding_name = :WinAnsiEncoding
48
+ @code_to_name = {
49
+ 0101 => :A,
50
+ 0306 => :AE,
51
+ 0301 => :Aacute,
52
+ 0302 => :Acircumflex,
53
+ 0304 => :Adieresis,
54
+ 0300 => :Agrave,
55
+ 0305 => :Aring,
56
+ 0303 => :Atilde,
57
+ 0102 => :B,
58
+ 0103 => :C,
59
+ 0307 => :Ccedilla,
60
+ 0104 => :D,
61
+ 0105 => :E,
62
+ 0311 => :Eacute,
63
+ 0312 => :Ecircumflex,
64
+ 0313 => :Edieresis,
65
+ 0310 => :Egrave,
66
+ 0320 => :Eth,
67
+ 0200 => :Euro,
68
+ 0106 => :F,
69
+ 0107 => :G,
70
+ 0110 => :H,
71
+ 0111 => :I,
72
+ 0315 => :Iacute,
73
+ 0316 => :Icircumflex,
74
+ 0317 => :Idieresis,
75
+ 0314 => :Igrave,
76
+ 0112 => :J,
77
+ 0113 => :K,
78
+ 0114 => :L,
79
+ 0115 => :M,
80
+ 0116 => :N,
81
+ 0321 => :Ntilde,
82
+ 0117 => :O,
83
+ 0214 => :OE,
84
+ 0323 => :Oacute,
85
+ 0324 => :Ocircumflex,
86
+ 0326 => :Odieresis,
87
+ 0322 => :Ograve,
88
+ 0330 => :Oslash,
89
+ 0325 => :Otilde,
90
+ 0120 => :P,
91
+ 0121 => :Q,
92
+ 0122 => :R,
93
+ 0123 => :S,
94
+ 0212 => :Scaron,
95
+ 0124 => :T,
96
+ 0336 => :Thorn,
97
+ 0125 => :U,
98
+ 0332 => :Uacute,
99
+ 0333 => :Ucircumflex,
100
+ 0334 => :Udieresis,
101
+ 0331 => :Ugrave,
102
+ 0126 => :V,
103
+ 0127 => :W,
104
+ 0130 => :X,
105
+ 0131 => :Y,
106
+ 0335 => :Yacute,
107
+ 0237 => :Ydieresis,
108
+ 0132 => :Z,
109
+ 0216 => :Zcaron,
110
+ 0141 => :a,
111
+ 0341 => :aacute,
112
+ 0342 => :acircumflex,
113
+ 0264 => :acute,
114
+ 0344 => :adieresis,
115
+ 0346 => :ae,
116
+ 0340 => :agrave,
117
+ 0046 => :ampersand,
118
+ 0345 => :aring,
119
+ 0136 => :asciicircum,
120
+ 0176 => :asciitilde,
121
+ 0052 => :asterisk,
122
+ 0100 => :at,
123
+ 0343 => :atilde,
124
+ 0142 => :b,
125
+ 0134 => :backslash,
126
+ 0174 => :bar,
127
+ 0173 => :braceleft,
128
+ 0175 => :braceright,
129
+ 0133 => :bracketleft,
130
+ 0135 => :bracketright,
131
+ 0246 => :brokenbar,
132
+ 0225 => :bullet,
133
+ 0143 => :c,
134
+ 0347 => :ccedilla,
135
+ 0270 => :cedilla,
136
+ 0242 => :cent,
137
+ 0210 => :circumflex,
138
+ 0072 => :colon,
139
+ 0054 => :comma,
140
+ 0251 => :copyright,
141
+ 0244 => :currency,
142
+ 0144 => :d,
143
+ 0206 => :dagger,
144
+ 0207 => :daggerdbl,
145
+ 0260 => :degree,
146
+ 0250 => :dieresis,
147
+ 0367 => :divide,
148
+ 0044 => :dollar,
149
+ 0145 => :e,
150
+ 0351 => :eacute,
151
+ 0352 => :ecircumflex,
152
+ 0353 => :edieresis,
153
+ 0350 => :egrave,
154
+ 0070 => :eight,
155
+ 0205 => :ellipsis,
156
+ 0227 => :emdash,
157
+ 0226 => :endash,
158
+ 0075 => :equal,
159
+ 0360 => :eth,
160
+ 0041 => :exclam,
161
+ 0241 => :exclamdown,
162
+ 0146 => :f,
163
+ 0065 => :five,
164
+ 0203 => :florin,
165
+ 0064 => :four,
166
+ 0147 => :g,
167
+ 0337 => :germandbls,
168
+ 0140 => :grave,
169
+ 0076 => :greater,
170
+ 0253 => :guillemotleft,
171
+ 0273 => :guillemotright,
172
+ 0213 => :guilsinglleft,
173
+ 0233 => :guilsinglright,
174
+ 0150 => :h,
175
+ 0055 => :hyphen,
176
+ 0151 => :i,
177
+ 0355 => :iacute,
178
+ 0356 => :icircumflex,
179
+ 0357 => :idieresis,
180
+ 0354 => :igrave,
181
+ 0152 => :j,
182
+ 0153 => :k,
183
+ 0154 => :l,
184
+ 0074 => :less,
185
+ 0254 => :logicalnot,
186
+ 0155 => :m,
187
+ 0257 => :macron,
188
+ 0265 => :mu,
189
+ 0327 => :multiply,
190
+ 0156 => :n,
191
+ 0071 => :nine,
192
+ 0361 => :ntilde,
193
+ 0043 => :numbersign,
194
+ 0157 => :o,
195
+ 0363 => :oacute,
196
+ 0364 => :ocircumflex,
197
+ 0366 => :odieresis,
198
+ 0234 => :oe,
199
+ 0362 => :ograve,
200
+ 0061 => :one,
201
+ 0275 => :onehalf,
202
+ 0274 => :onequarter,
203
+ 0271 => :onesuperior,
204
+ 0252 => :ordfeminine,
205
+ 0272 => :ordmasculine,
206
+ 0370 => :oslash,
207
+ 0365 => :otilde,
208
+ 0160 => :p,
209
+ 0266 => :paragraph,
210
+ 0050 => :parenleft,
211
+ 0051 => :parenright,
212
+ 0045 => :percent,
213
+ 0056 => :period,
214
+ 0267 => :periodcentered,
215
+ 0211 => :perthousand,
216
+ 0053 => :plus,
217
+ 0261 => :plusminus,
218
+ 0161 => :q,
219
+ 0077 => :question,
220
+ 0277 => :questiondown,
221
+ 0042 => :quotedbl,
222
+ 0204 => :quotedblbase,
223
+ 0223 => :quotedblleft,
224
+ 0224 => :quotedblright,
225
+ 0221 => :quoteleft,
226
+ 0222 => :quoteright,
227
+ 0202 => :quotesinglbase,
228
+ 0047 => :quotesingle,
229
+ 0162 => :r,
230
+ 0256 => :registered,
231
+ 0163 => :s,
232
+ 0232 => :scaron,
233
+ 0247 => :section,
234
+ 0073 => :semicolon,
235
+ 0067 => :seven,
236
+ 0066 => :six,
237
+ 0057 => :slash,
238
+ 0040 => :space,
239
+ 0243 => :sterling,
240
+ 0164 => :t,
241
+ 0376 => :thorn,
242
+ 0063 => :three,
243
+ 0276 => :threequarters,
244
+ 0263 => :threesuperior,
245
+ 0230 => :tilde,
246
+ 0231 => :trademark,
247
+ 0062 => :two,
248
+ 0262 => :twosuperior,
249
+ 0165 => :u,
250
+ 0372 => :uacute,
251
+ 0373 => :ucircumflex,
252
+ 0374 => :udieresis,
253
+ 0371 => :ugrave,
254
+ 0137 => :underscore,
255
+ 0166 => :v,
256
+ 0167 => :w,
257
+ 0170 => :x,
258
+ 0171 => :y,
259
+ 0375 => :yacute,
260
+ 0377 => :ydieresis,
261
+ 0245 => :yen,
262
+ 0172 => :z,
263
+ 0236 => :zcaron,
264
+ 0060 => :zero,
265
+ # additions due to PDF1.7 sD.2 footnote 5,6
266
+ 0240 => :space,
267
+ 0255 => :hyphen,
268
+ }
269
+ # additions due to PDF1.7 sD.2 footnote 3
270
+ 041.upto(255) do |i|
271
+ next if @code_to_name.key?(i)
272
+ @code_to_name[i] = :bullet
273
+ end
274
+ end
275
+
276
+ end
277
+
278
+ end
279
+ end
280
+ end
@@ -0,0 +1,250 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ #--
4
+ # This file is part of HexaPDF.
5
+ #
6
+ # HexaPDF - A Versatile PDF Creation and Manipulation Library For Ruby
7
+ # Copyright (C) 2016 Thomas Leitner
8
+ #
9
+ # HexaPDF is free software: you can redistribute it and/or modify it
10
+ # under the terms of the GNU Affero General Public License version 3 as
11
+ # published by the Free Software Foundation with the addition of the
12
+ # following permission added to Section 15 as permitted in Section 7(a):
13
+ # FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
14
+ # THOMAS LEITNER, THOMAS LEITNER DISCLAIMS THE WARRANTY OF NON
15
+ # INFRINGEMENT OF THIRD PARTY RIGHTS.
16
+ #
17
+ # HexaPDF is distributed in the hope that it will be useful, but WITHOUT
18
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
20
+ # License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Affero General Public License
23
+ # along with HexaPDF. If not, see <http://www.gnu.org/licenses/>.
24
+ #
25
+ # The interactive user interfaces in modified source and object code
26
+ # versions of HexaPDF must display Appropriate Legal Notices, as required
27
+ # under Section 5 of the GNU Affero General Public License version 3.
28
+ #
29
+ # In accordance with Section 7(b) of the GNU Affero General Public
30
+ # License, a covered work must retain the producer line in every PDF that
31
+ # is created or manipulated using HexaPDF.
32
+ #++
33
+
34
+ require 'hexapdf/font/encoding/base'
35
+
36
+ module HexaPDF
37
+ module Font
38
+ module Encoding
39
+
40
+ # The built-in encoding of the ZapfDingbats font.
41
+ #
42
+ # See: PDF1.7 sD.6
43
+ class ZapfDingbatsEncoding < Base
44
+
45
+ def initialize #:nodoc:
46
+ super
47
+ @code_to_name = {
48
+ 0040 => :space,
49
+ 0041 => :a1,
50
+ 0042 => :a2,
51
+ 0043 => :a202,
52
+ 0044 => :a3,
53
+ 0045 => :a4,
54
+ 0046 => :a5,
55
+ 0047 => :a119,
56
+ 0050 => :a118,
57
+ 0051 => :a117,
58
+ 0052 => :a11,
59
+ 0053 => :a12,
60
+ 0054 => :a13,
61
+ 0055 => :a14,
62
+ 0056 => :a15,
63
+ 0057 => :a16,
64
+ 0060 => :a105,
65
+ 0061 => :a17,
66
+ 0062 => :a18,
67
+ 0063 => :a19,
68
+ 0064 => :a20,
69
+ 0065 => :a21,
70
+ 0066 => :a22,
71
+ 0067 => :a23,
72
+ 0070 => :a24,
73
+ 0071 => :a25,
74
+ 0072 => :a26,
75
+ 0073 => :a27,
76
+ 0074 => :a28,
77
+ 0075 => :a6,
78
+ 0076 => :a7,
79
+ 0077 => :a8,
80
+ 0100 => :a9,
81
+ 0101 => :a10,
82
+ 0102 => :a29,
83
+ 0103 => :a30,
84
+ 0104 => :a31,
85
+ 0105 => :a32,
86
+ 0106 => :a33,
87
+ 0107 => :a34,
88
+ 0110 => :a35,
89
+ 0111 => :a36,
90
+ 0112 => :a37,
91
+ 0113 => :a38,
92
+ 0114 => :a39,
93
+ 0115 => :a40,
94
+ 0116 => :a41,
95
+ 0117 => :a42,
96
+ 0120 => :a43,
97
+ 0121 => :a44,
98
+ 0122 => :a45,
99
+ 0123 => :a46,
100
+ 0124 => :a47,
101
+ 0125 => :a48,
102
+ 0126 => :a49,
103
+ 0127 => :a50,
104
+ 0130 => :a51,
105
+ 0131 => :a52,
106
+ 0132 => :a53,
107
+ 0133 => :a54,
108
+ 0134 => :a55,
109
+ 0135 => :a56,
110
+ 0136 => :a57,
111
+ 0137 => :a58,
112
+ 0140 => :a59,
113
+ 0141 => :a60,
114
+ 0142 => :a61,
115
+ 0143 => :a62,
116
+ 0144 => :a63,
117
+ 0145 => :a64,
118
+ 0146 => :a65,
119
+ 0147 => :a66,
120
+ 0150 => :a67,
121
+ 0151 => :a68,
122
+ 0152 => :a69,
123
+ 0153 => :a70,
124
+ 0154 => :a71,
125
+ 0155 => :a72,
126
+ 0156 => :a73,
127
+ 0157 => :a74,
128
+ 0160 => :a203,
129
+ 0161 => :a75,
130
+ 0162 => :a204,
131
+ 0163 => :a76,
132
+ 0164 => :a77,
133
+ 0165 => :a78,
134
+ 0166 => :a79,
135
+ 0167 => :a81,
136
+ 0170 => :a82,
137
+ 0171 => :a83,
138
+ 0172 => :a84,
139
+ 0173 => :a97,
140
+ 0174 => :a98,
141
+ 0175 => :a99,
142
+ 0176 => :a100,
143
+ 0241 => :a101,
144
+ 0242 => :a102,
145
+ 0243 => :a103,
146
+ 0244 => :a104,
147
+ 0245 => :a106,
148
+ 0246 => :a107,
149
+ 0247 => :a108,
150
+ 0250 => :a112,
151
+ 0251 => :a111,
152
+ 0252 => :a110,
153
+ 0253 => :a109,
154
+ 0254 => :a120,
155
+ 0255 => :a121,
156
+ 0256 => :a122,
157
+ 0257 => :a123,
158
+ 0260 => :a124,
159
+ 0261 => :a125,
160
+ 0262 => :a126,
161
+ 0263 => :a127,
162
+ 0264 => :a128,
163
+ 0265 => :a129,
164
+ 0266 => :a130,
165
+ 0267 => :a131,
166
+ 0270 => :a132,
167
+ 0271 => :a133,
168
+ 0272 => :a134,
169
+ 0273 => :a135,
170
+ 0274 => :a136,
171
+ 0275 => :a137,
172
+ 0276 => :a138,
173
+ 0277 => :a139,
174
+ 0300 => :a140,
175
+ 0301 => :a141,
176
+ 0302 => :a142,
177
+ 0303 => :a143,
178
+ 0304 => :a144,
179
+ 0305 => :a145,
180
+ 0306 => :a146,
181
+ 0307 => :a147,
182
+ 0310 => :a148,
183
+ 0311 => :a149,
184
+ 0312 => :a150,
185
+ 0313 => :a151,
186
+ 0314 => :a152,
187
+ 0315 => :a153,
188
+ 0316 => :a154,
189
+ 0317 => :a155,
190
+ 0320 => :a156,
191
+ 0321 => :a157,
192
+ 0322 => :a158,
193
+ 0323 => :a159,
194
+ 0324 => :a160,
195
+ 0325 => :a161,
196
+ 0326 => :a163,
197
+ 0327 => :a164,
198
+ 0330 => :a196,
199
+ 0331 => :a165,
200
+ 0332 => :a192,
201
+ 0333 => :a166,
202
+ 0334 => :a167,
203
+ 0335 => :a168,
204
+ 0336 => :a169,
205
+ 0337 => :a170,
206
+ 0340 => :a171,
207
+ 0341 => :a172,
208
+ 0342 => :a173,
209
+ 0343 => :a162,
210
+ 0344 => :a174,
211
+ 0345 => :a175,
212
+ 0346 => :a176,
213
+ 0347 => :a177,
214
+ 0350 => :a178,
215
+ 0351 => :a179,
216
+ 0352 => :a193,
217
+ 0353 => :a180,
218
+ 0354 => :a199,
219
+ 0355 => :a181,
220
+ 0356 => :a200,
221
+ 0357 => :a182,
222
+ 0361 => :a201,
223
+ 0362 => :a183,
224
+ 0363 => :a184,
225
+ 0364 => :a197,
226
+ 0365 => :a185,
227
+ 0366 => :a194,
228
+ 0367 => :a198,
229
+ 0370 => :a186,
230
+ 0371 => :a195,
231
+ 0372 => :a187,
232
+ 0373 => :a188,
233
+ 0374 => :a189,
234
+ 0375 => :a190,
235
+ 0376 => :a191,
236
+ }
237
+ end
238
+
239
+ # The ZapfDingbats font uses a special glyph list, so we need to specialize this method.
240
+ #
241
+ # See: Encoding#unicode
242
+ def unicode(code)
243
+ @unicode_cache[code] ||= GlyphList.name_to_unicode(name(code), zapf_dingbats: true)
244
+ end
245
+
246
+ end
247
+
248
+ end
249
+ end
250
+ end
@@ -0,0 +1,68 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ #--
4
+ # This file is part of HexaPDF.
5
+ #
6
+ # HexaPDF - A Versatile PDF Creation and Manipulation Library For Ruby
7
+ # Copyright (C) 2016 Thomas Leitner
8
+ #
9
+ # HexaPDF is free software: you can redistribute it and/or modify it
10
+ # under the terms of the GNU Affero General Public License version 3 as
11
+ # published by the Free Software Foundation with the addition of the
12
+ # following permission added to Section 15 as permitted in Section 7(a):
13
+ # FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
14
+ # THOMAS LEITNER, THOMAS LEITNER DISCLAIMS THE WARRANTY OF NON
15
+ # INFRINGEMENT OF THIRD PARTY RIGHTS.
16
+ #
17
+ # HexaPDF is distributed in the hope that it will be useful, but WITHOUT
18
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
20
+ # License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Affero General Public License
23
+ # along with HexaPDF. If not, see <http://www.gnu.org/licenses/>.
24
+ #
25
+ # The interactive user interfaces in modified source and object code
26
+ # versions of HexaPDF must display Appropriate Legal Notices, as required
27
+ # under Section 5 of the GNU Affero General Public License version 3.
28
+ #
29
+ # In accordance with Section 7(b) of the GNU Affero General Public
30
+ # License, a covered work must retain the producer line in every PDF that
31
+ # is created or manipulated using HexaPDF.
32
+ #++
33
+
34
+ require 'hexapdf/data_dir'
35
+
36
+ module HexaPDF
37
+ module Font
38
+
39
+ # Contains implementations of the encodings used for fonts.
40
+ module Encoding
41
+
42
+ autoload(:Base, 'hexapdf/font/encoding/base')
43
+ autoload(:StandardEncoding, 'hexapdf/font/encoding/standard_encoding')
44
+ autoload(:MacRomanEncoding, 'hexapdf/font/encoding/mac_roman_encoding')
45
+ autoload(:WinAnsiEncoding, 'hexapdf/font/encoding/win_ansi_encoding')
46
+ autoload(:MacExpertEncoding, 'hexapdf/font/encoding/mac_expert_encoding')
47
+ autoload(:SymbolEncoding, 'hexapdf/font/encoding/symbol_encoding')
48
+ autoload(:ZapfDingbatsEncoding, 'hexapdf/font/encoding/zapf_dingbats_encoding')
49
+ autoload(:DifferenceEncoding, 'hexapdf/font/encoding/difference_encoding')
50
+ autoload(:GlyphList, 'hexapdf/font/encoding/glyph_list')
51
+
52
+ # Returns the encoding object for the given name, or +nil+ if no such encoding is available.
53
+ def self.for_name(name)
54
+ case name
55
+ when :WinAnsiEncoding then @win_ansi ||= WinAnsiEncoding.new
56
+ when :MacRomanEncoding then @mac_roman ||= MacRomanEncoding.new
57
+ when :StandardEncoding then @standard ||= StandardEncoding.new
58
+ when :MacExpertEncoding then @mac_expert ||= MacExpertEncoding.new
59
+ when :SymbolEncoding then @symbol ||= SymbolEncoding.new
60
+ when :ZapfDingbatsEncoding then @zapf_dingbats ||= ZapfDingbatsEncoding.new
61
+ else nil
62
+ end
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+ end