hexapdf 0.32.2 → 0.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +104 -1
  3. data/README.md +9 -0
  4. data/examples/002-graphics.rb +15 -17
  5. data/examples/003-arcs.rb +9 -9
  6. data/examples/009-text_layouter_alignment.rb +1 -1
  7. data/examples/010-text_layouter_inline_boxes.rb +2 -2
  8. data/examples/011-text_layouter_line_wrapping.rb +1 -1
  9. data/examples/012-text_layouter_styling.rb +7 -7
  10. data/examples/013-text_layouter_shapes.rb +1 -1
  11. data/examples/014-text_in_polygon.rb +1 -1
  12. data/examples/015-boxes.rb +8 -7
  13. data/examples/016-frame_automatic_box_placement.rb +2 -2
  14. data/examples/017-frame_text_flow.rb +2 -1
  15. data/examples/018-composer.rb +1 -1
  16. data/examples/020-column_box.rb +2 -1
  17. data/examples/025-table_box.rb +46 -0
  18. data/examples/026-optional_content.rb +55 -0
  19. data/examples/027-composer_optional_content.rb +83 -0
  20. data/lib/hexapdf/cli/command.rb +12 -3
  21. data/lib/hexapdf/cli/fonts.rb +1 -1
  22. data/lib/hexapdf/cli/form.rb +5 -5
  23. data/lib/hexapdf/cli/inspect.rb +5 -7
  24. data/lib/hexapdf/composer.rb +106 -53
  25. data/lib/hexapdf/configuration.rb +65 -40
  26. data/lib/hexapdf/content/canvas.rb +445 -267
  27. data/lib/hexapdf/content/color_space.rb +72 -25
  28. data/lib/hexapdf/content/graphic_object/arc.rb +57 -24
  29. data/lib/hexapdf/content/graphic_object/endpoint_arc.rb +66 -23
  30. data/lib/hexapdf/content/graphic_object/geom2d.rb +47 -6
  31. data/lib/hexapdf/content/graphic_object/solid_arc.rb +58 -36
  32. data/lib/hexapdf/content/graphic_object.rb +6 -7
  33. data/lib/hexapdf/content/graphics_state.rb +54 -45
  34. data/lib/hexapdf/content/operator.rb +54 -54
  35. data/lib/hexapdf/content/parser.rb +2 -2
  36. data/lib/hexapdf/content/processor.rb +15 -15
  37. data/lib/hexapdf/content/transformation_matrix.rb +1 -1
  38. data/lib/hexapdf/content.rb +5 -0
  39. data/lib/hexapdf/dictionary.rb +7 -5
  40. data/lib/hexapdf/dictionary_fields.rb +43 -16
  41. data/lib/hexapdf/digital_signature/cms_handler.rb +2 -2
  42. data/lib/hexapdf/digital_signature/handler.rb +1 -1
  43. data/lib/hexapdf/digital_signature/pkcs1_handler.rb +2 -3
  44. data/lib/hexapdf/digital_signature/signature.rb +6 -6
  45. data/lib/hexapdf/digital_signature/signatures.rb +13 -12
  46. data/lib/hexapdf/digital_signature/signing/default_handler.rb +14 -5
  47. data/lib/hexapdf/digital_signature/signing/signed_data_creator.rb +2 -4
  48. data/lib/hexapdf/digital_signature/signing/timestamp_handler.rb +4 -4
  49. data/lib/hexapdf/digital_signature/signing.rb +4 -0
  50. data/lib/hexapdf/digital_signature/verification_result.rb +3 -4
  51. data/lib/hexapdf/digital_signature.rb +7 -2
  52. data/lib/hexapdf/document/destinations.rb +12 -11
  53. data/lib/hexapdf/document/files.rb +1 -1
  54. data/lib/hexapdf/document/fonts.rb +1 -1
  55. data/lib/hexapdf/document/layout.rb +170 -39
  56. data/lib/hexapdf/document/pages.rb +4 -3
  57. data/lib/hexapdf/document.rb +96 -55
  58. data/lib/hexapdf/encryption/aes.rb +5 -5
  59. data/lib/hexapdf/encryption/arc4.rb +1 -1
  60. data/lib/hexapdf/encryption/fast_aes.rb +2 -2
  61. data/lib/hexapdf/encryption/fast_arc4.rb +1 -1
  62. data/lib/hexapdf/encryption/identity.rb +1 -1
  63. data/lib/hexapdf/encryption/ruby_aes.rb +11 -21
  64. data/lib/hexapdf/encryption/ruby_arc4.rb +1 -1
  65. data/lib/hexapdf/encryption/security_handler.rb +31 -24
  66. data/lib/hexapdf/encryption/standard_security_handler.rb +45 -36
  67. data/lib/hexapdf/encryption.rb +7 -2
  68. data/lib/hexapdf/error.rb +18 -0
  69. data/lib/hexapdf/filter/ascii85_decode.rb +1 -1
  70. data/lib/hexapdf/filter/ascii_hex_decode.rb +1 -1
  71. data/lib/hexapdf/filter/flate_decode.rb +1 -1
  72. data/lib/hexapdf/filter/lzw_decode.rb +1 -1
  73. data/lib/hexapdf/filter/pass_through.rb +1 -1
  74. data/lib/hexapdf/filter/predictor.rb +1 -1
  75. data/lib/hexapdf/filter/run_length_decode.rb +1 -1
  76. data/lib/hexapdf/filter.rb +55 -6
  77. data/lib/hexapdf/font/cmap/parser.rb +2 -2
  78. data/lib/hexapdf/font/cmap.rb +1 -1
  79. data/lib/hexapdf/font/encoding/difference_encoding.rb +1 -1
  80. data/lib/hexapdf/font/encoding/mac_expert_encoding.rb +1 -1
  81. data/lib/hexapdf/font/encoding/mac_roman_encoding.rb +2 -2
  82. data/lib/hexapdf/font/encoding/standard_encoding.rb +1 -1
  83. data/lib/hexapdf/font/encoding/symbol_encoding.rb +1 -1
  84. data/lib/hexapdf/font/encoding/win_ansi_encoding.rb +3 -3
  85. data/lib/hexapdf/font/encoding/zapf_dingbats_encoding.rb +1 -1
  86. data/lib/hexapdf/font/invalid_glyph.rb +3 -0
  87. data/lib/hexapdf/font/true_type_wrapper.rb +17 -4
  88. data/lib/hexapdf/font/type1_wrapper.rb +19 -4
  89. data/lib/hexapdf/font_loader/from_configuration.rb +5 -2
  90. data/lib/hexapdf/font_loader/from_file.rb +5 -5
  91. data/lib/hexapdf/font_loader/standard14.rb +3 -3
  92. data/lib/hexapdf/font_loader.rb +3 -0
  93. data/lib/hexapdf/image_loader/jpeg.rb +2 -2
  94. data/lib/hexapdf/image_loader/pdf.rb +1 -1
  95. data/lib/hexapdf/image_loader/png.rb +2 -2
  96. data/lib/hexapdf/image_loader.rb +1 -1
  97. data/lib/hexapdf/importer.rb +13 -0
  98. data/lib/hexapdf/layout/box.rb +32 -5
  99. data/lib/hexapdf/layout/box_fitter.rb +2 -2
  100. data/lib/hexapdf/layout/column_box.rb +20 -5
  101. data/lib/hexapdf/layout/frame.rb +53 -18
  102. data/lib/hexapdf/layout/image_box.rb +5 -0
  103. data/lib/hexapdf/layout/inline_box.rb +21 -9
  104. data/lib/hexapdf/layout/list_box.rb +50 -20
  105. data/lib/hexapdf/layout/page_style.rb +6 -5
  106. data/lib/hexapdf/layout/style.rb +64 -9
  107. data/lib/hexapdf/layout/table_box.rb +684 -0
  108. data/lib/hexapdf/layout/text_box.rb +12 -3
  109. data/lib/hexapdf/layout/text_fragment.rb +29 -3
  110. data/lib/hexapdf/layout/text_layouter.rb +32 -8
  111. data/lib/hexapdf/layout.rb +1 -0
  112. data/lib/hexapdf/name_tree_node.rb +1 -1
  113. data/lib/hexapdf/number_tree_node.rb +1 -1
  114. data/lib/hexapdf/object.rb +18 -7
  115. data/lib/hexapdf/parser.rb +7 -7
  116. data/lib/hexapdf/pdf_array.rb +1 -1
  117. data/lib/hexapdf/rectangle.rb +1 -1
  118. data/lib/hexapdf/reference.rb +1 -1
  119. data/lib/hexapdf/revision.rb +1 -1
  120. data/lib/hexapdf/revisions.rb +3 -3
  121. data/lib/hexapdf/serializer.rb +15 -15
  122. data/lib/hexapdf/stream.rb +5 -4
  123. data/lib/hexapdf/tokenizer.rb +14 -14
  124. data/lib/hexapdf/type/acro_form/appearance_generator.rb +22 -22
  125. data/lib/hexapdf/type/acro_form/button_field.rb +1 -1
  126. data/lib/hexapdf/type/acro_form/choice_field.rb +1 -1
  127. data/lib/hexapdf/type/acro_form/field.rb +2 -2
  128. data/lib/hexapdf/type/acro_form/form.rb +1 -1
  129. data/lib/hexapdf/type/acro_form/signature_field.rb +4 -4
  130. data/lib/hexapdf/type/acro_form/text_field.rb +1 -1
  131. data/lib/hexapdf/type/acro_form/variable_text_field.rb +1 -1
  132. data/lib/hexapdf/type/acro_form.rb +1 -1
  133. data/lib/hexapdf/type/action.rb +1 -1
  134. data/lib/hexapdf/type/actions/go_to.rb +1 -1
  135. data/lib/hexapdf/type/actions/go_to_r.rb +1 -1
  136. data/lib/hexapdf/type/actions/launch.rb +1 -1
  137. data/lib/hexapdf/type/actions/set_ocg_state.rb +86 -0
  138. data/lib/hexapdf/type/actions/uri.rb +1 -1
  139. data/lib/hexapdf/type/actions.rb +2 -1
  140. data/lib/hexapdf/type/annotation.rb +3 -3
  141. data/lib/hexapdf/type/annotations/link.rb +1 -1
  142. data/lib/hexapdf/type/annotations/markup_annotation.rb +1 -1
  143. data/lib/hexapdf/type/annotations/text.rb +2 -3
  144. data/lib/hexapdf/type/annotations/widget.rb +2 -2
  145. data/lib/hexapdf/type/annotations.rb +1 -1
  146. data/lib/hexapdf/type/catalog.rb +11 -2
  147. data/lib/hexapdf/type/cid_font.rb +18 -4
  148. data/lib/hexapdf/type/embedded_file.rb +1 -1
  149. data/lib/hexapdf/type/file_specification.rb +2 -2
  150. data/lib/hexapdf/type/font_descriptor.rb +1 -1
  151. data/lib/hexapdf/type/font_simple.rb +2 -2
  152. data/lib/hexapdf/type/font_type0.rb +3 -3
  153. data/lib/hexapdf/type/font_type3.rb +1 -1
  154. data/lib/hexapdf/type/form.rb +76 -6
  155. data/lib/hexapdf/type/graphics_state_parameter.rb +1 -1
  156. data/lib/hexapdf/type/icon_fit.rb +1 -1
  157. data/lib/hexapdf/type/image.rb +1 -1
  158. data/lib/hexapdf/type/info.rb +1 -1
  159. data/lib/hexapdf/type/mark_information.rb +1 -1
  160. data/lib/hexapdf/type/names.rb +2 -2
  161. data/lib/hexapdf/type/object_stream.rb +2 -1
  162. data/lib/hexapdf/type/optional_content_configuration.rb +170 -0
  163. data/lib/hexapdf/type/optional_content_group.rb +370 -0
  164. data/lib/hexapdf/type/optional_content_membership.rb +63 -0
  165. data/lib/hexapdf/type/optional_content_properties.rb +158 -0
  166. data/lib/hexapdf/type/outline.rb +1 -1
  167. data/lib/hexapdf/type/outline_item.rb +1 -1
  168. data/lib/hexapdf/type/page.rb +46 -21
  169. data/lib/hexapdf/type/page_label.rb +5 -9
  170. data/lib/hexapdf/type/page_tree_node.rb +1 -1
  171. data/lib/hexapdf/type/resources.rb +1 -1
  172. data/lib/hexapdf/type/trailer.rb +2 -2
  173. data/lib/hexapdf/type/viewer_preferences.rb +1 -1
  174. data/lib/hexapdf/type/xref_stream.rb +2 -2
  175. data/lib/hexapdf/type.rb +4 -0
  176. data/lib/hexapdf/utils/pdf_doc_encoding.rb +1 -2
  177. data/lib/hexapdf/version.rb +1 -1
  178. data/lib/hexapdf/writer.rb +4 -4
  179. data/lib/hexapdf/xref_section.rb +2 -2
  180. data/test/hexapdf/content/graphic_object/test_endpoint_arc.rb +11 -1
  181. data/test/hexapdf/content/graphic_object/test_geom2d.rb +7 -0
  182. data/test/hexapdf/content/test_canvas.rb +49 -1
  183. data/test/hexapdf/digital_signature/test_signatures.rb +22 -0
  184. data/test/hexapdf/document/test_files.rb +2 -2
  185. data/test/hexapdf/document/test_layout.rb +105 -2
  186. data/test/hexapdf/document/test_pages.rb +6 -6
  187. data/test/hexapdf/encryption/test_security_handler.rb +12 -11
  188. data/test/hexapdf/encryption/test_standard_security_handler.rb +35 -23
  189. data/test/hexapdf/font/test_true_type_wrapper.rb +18 -1
  190. data/test/hexapdf/font/test_type1_wrapper.rb +15 -1
  191. data/test/hexapdf/layout/test_box.rb +14 -5
  192. data/test/hexapdf/layout/test_column_box.rb +65 -21
  193. data/test/hexapdf/layout/test_frame.rb +27 -15
  194. data/test/hexapdf/layout/test_image_box.rb +4 -0
  195. data/test/hexapdf/layout/test_inline_box.rb +17 -3
  196. data/test/hexapdf/layout/test_list_box.rb +84 -33
  197. data/test/hexapdf/layout/test_page_style.rb +3 -2
  198. data/test/hexapdf/layout/test_style.rb +60 -0
  199. data/test/hexapdf/layout/test_table_box.rb +728 -0
  200. data/test/hexapdf/layout/test_text_box.rb +26 -0
  201. data/test/hexapdf/layout/test_text_fragment.rb +33 -0
  202. data/test/hexapdf/layout/test_text_layouter.rb +36 -5
  203. data/test/hexapdf/test_composer.rb +10 -0
  204. data/test/hexapdf/test_dictionary.rb +10 -0
  205. data/test/hexapdf/test_dictionary_fields.rb +4 -1
  206. data/test/hexapdf/test_document.rb +5 -0
  207. data/test/hexapdf/test_filter.rb +8 -0
  208. data/test/hexapdf/test_importer.rb +9 -0
  209. data/test/hexapdf/test_object.rb +16 -5
  210. data/test/hexapdf/test_stream.rb +7 -0
  211. data/test/hexapdf/test_writer.rb +3 -3
  212. data/test/hexapdf/type/acro_form/test_appearance_generator.rb +13 -5
  213. data/test/hexapdf/type/acro_form/test_form.rb +4 -3
  214. data/test/hexapdf/type/actions/test_set_ocg_state.rb +40 -0
  215. data/test/hexapdf/type/test_catalog.rb +11 -0
  216. data/test/hexapdf/type/test_form.rb +119 -0
  217. data/test/hexapdf/type/test_optional_content_configuration.rb +112 -0
  218. data/test/hexapdf/type/test_optional_content_group.rb +158 -0
  219. data/test/hexapdf/type/test_optional_content_properties.rb +109 -0
  220. data/test/hexapdf/type/test_page.rb +20 -6
  221. metadata +28 -8
@@ -44,12 +44,12 @@ module HexaPDF
44
44
  # == Overview
45
45
  #
46
46
  # HexaPDF allows detailed control over many aspects of PDF manipulation. If there is a need to
47
- # use a certain default value somewhere, it is defined as configuration options so that it can
47
+ # use a certain default value somewhere, it is defined as a configuration option so that it can
48
48
  # easily be changed.
49
49
  #
50
50
  # Some options are defined as global options because they are needed on the class level - see
51
- # HexaPDF::GlobalConfiguration[index.html#GlobalConfiguration]. Other options can be configured for
52
- # individual documents as they allow to fine-tune some behavior - see
51
+ # HexaPDF::GlobalConfiguration[index.html#GlobalConfiguration]. Other options can be configured
52
+ # for individual documents as they allow to fine-tune some behavior - see
53
53
  # HexaPDF::DefaultDocumentConfiguration[index.html#DefaultDocumentConfiguration].
54
54
  #
55
55
  # A configuration option name is dot-separted to provide a hierarchy of option names. For
@@ -155,9 +155,6 @@ module HexaPDF
155
155
  # A boolean specifying whether an AcroForm field's appearances should automatically be
156
156
  # generated if they are missing.
157
157
  #
158
- # acro_form.text_field.default_width::
159
- # A number specifying the default width of AcroForm text fields which should be auto-sized.
160
- #
161
158
  # acro_form.default_font_size::
162
159
  # A number specifying the default font size of AcroForm text fields which should be auto-sized.
163
160
  #
@@ -248,7 +245,7 @@ module HexaPDF
248
245
  #
249
246
  # The most often used filters are implemented and readily available.
250
247
  #
251
- # See PDF1.7 s7.4.1, ADB sH.3 3.3
248
+ # See PDF2.0 s7.4.1, ADB sH.3 3.3
252
249
  #
253
250
  # font.map::
254
251
  # Defines a mapping from font names and variants to font files.
@@ -271,14 +268,22 @@ module HexaPDF
271
268
  #
272
269
  # The value needs to be an object that responds to \#call(character, font_wrapper) where
273
270
  # +character+ is the Unicode character for the missing glyph and returns a substitute glyph to
274
- # be used instead.
271
+ # be used instead. This substitute glyph needs to be from the same font, i.e. it needs to be
272
+ # created through the provided +font_wrapper+ instance.
275
273
  #
276
274
  # The +font_wrapper+ argument is the used font wrapper object, e.g.
277
275
  # HexaPDF::Font::TrueTypeWrapper. To access the HexaPDF::Document instance from which this hook
278
276
  # was called, you can use +font_wrapper.pdf_object.document+.
279
277
  #
280
278
  # The default implementation returns an object of class HexaPDF::Font::InvalidGlyph which, when
281
- # not removed before encoding, will raise an error.
279
+ # not removed before encoding, will raise a HexaPDF::MissingGlyphError.
280
+ #
281
+ # If a replacement glyph should be displayed instead of an error, the following provides a good
282
+ # starting implementation:
283
+ #
284
+ # doc.config['font.on_missing_glyph'] = lambda do |character, font_wrapper|
285
+ # font_wrapper.custom_glyph(font_wrapper.font_type == :Type1 ? :question : 0, character)
286
+ # end
282
287
  #
283
288
  # font.on_missing_unicode_mapping::
284
289
  # Callback hook when a character code point cannot be converted to a Unicode character.
@@ -298,11 +303,6 @@ module HexaPDF
298
303
  #
299
304
  # See the HexaPDF::FontLoader module for information on how to implement a font loader object.
300
305
  #
301
- # graphic_object.map::
302
- # A mapping from graphic object names to graphic object factories.
303
- #
304
- # See HexaPDF::Content::GraphicObject for more information.
305
- #
306
306
  # graphic_object.arc.max_curves::
307
307
  # The maximum number of curves used for approximating a complete ellipse using Bezier curves.
308
308
  #
@@ -310,6 +310,11 @@ module HexaPDF
310
310
  # to compute. It should not be set to values lower than 4, otherwise the approximation of a
311
311
  # complete ellipse is visibly false.
312
312
  #
313
+ # graphic_object.map::
314
+ # A mapping from graphic object names to graphic object factories.
315
+ #
316
+ # See HexaPDF::Content::GraphicObject for more information.
317
+ #
313
318
  # image_loader::
314
319
  # An array with image loader implementations. When an image should be loaded, the array is
315
320
  # iterated in sequence to find a suitable image loader.
@@ -381,14 +386,6 @@ module HexaPDF
381
386
  #
382
387
  # Defaults to +true+.
383
388
  #
384
- # sorted_tree.max_leaf_node_size::
385
- # The maximum number of nodes that should be in a leaf node of a node tree.
386
- #
387
- # style.layers_map::
388
- # A mapping from style layer names to layer objects.
389
- #
390
- # See HexaPDF::Layout::Style::Layers for more information.
391
- #
392
389
  # signature.signing_handler::
393
390
  # A mapping from a Symbol to a signing handler class (see
394
391
  # HexaPDF::Document::Signatures::DefaultHandler). If the value is a String, it should contain
@@ -403,6 +400,14 @@ module HexaPDF
403
400
  # filter value of a signature dictionary is ignored since we only support the standard
404
401
  # signature algorithms.
405
402
  #
403
+ # sorted_tree.max_leaf_node_size::
404
+ # The maximum number of nodes that should be in a leaf node of a node tree.
405
+ #
406
+ # style.layers_map::
407
+ # A mapping from style layer names to layer objects.
408
+ #
409
+ # See HexaPDF::Layout::Style::Layers for more information.
410
+ #
406
411
  # task.map::
407
412
  # A mapping from task names to callable task objects. See HexaPDF::Task for more information.
408
413
  DefaultDocumentConfiguration =
@@ -459,13 +464,13 @@ module HexaPDF
459
464
  'HexaPDF::FontLoader::FromConfiguration',
460
465
  'HexaPDF::FontLoader::FromFile',
461
466
  ],
467
+ 'graphic_object.arc.max_curves' => 6,
462
468
  'graphic_object.map' => {
463
469
  arc: 'HexaPDF::Content::GraphicObject::Arc',
464
470
  endpoint_arc: 'HexaPDF::Content::GraphicObject::EndpointArc',
465
471
  solid_arc: 'HexaPDF::Content::GraphicObject::SolidArc',
466
472
  geom2d: 'HexaPDF::Content::GraphicObject::Geom2D',
467
473
  },
468
- 'graphic_object.arc.max_curves' => 6,
469
474
  'image_loader' => [
470
475
  'HexaPDF::ImageLoader::JPEG',
471
476
  'HexaPDF::ImageLoader::PNG',
@@ -479,15 +484,12 @@ module HexaPDF
479
484
  image: 'HexaPDF::Layout::ImageBox',
480
485
  column: 'HexaPDF::Layout::ColumnBox',
481
486
  list: 'HexaPDF::Layout::ListBox',
487
+ table: 'HexaPDF::Layout::TableBox',
482
488
  },
483
489
  'page.default_media_box' => :A4,
484
490
  'page.default_media_orientation' => :portrait,
485
491
  'parser.on_correctable_error' => proc { false },
486
492
  'parser.try_xref_reconstruction' => true,
487
- 'sorted_tree.max_leaf_node_size' => 64,
488
- 'style.layers_map' => {
489
- link: 'HexaPDF::Layout::Style::LinkLayer',
490
- },
491
493
  'signature.signing_handler' => {
492
494
  default: 'HexaPDF::DigitalSignature::Signing::DefaultHandler',
493
495
  timestamp: 'HexaPDF::DigitalSignature::Signing::TimestampHandler',
@@ -498,6 +500,10 @@ module HexaPDF
498
500
  'ETSI.CAdES.detached': 'HexaPDF::DigitalSignature::CMSHandler',
499
501
  'ETSI.RFC3161': 'HexaPDF::DigitalSignature::CMSHandler',
500
502
  },
503
+ 'sorted_tree.max_leaf_node_size' => 64,
504
+ 'style.layers_map' => {
505
+ link: 'HexaPDF::Layout::Style::LinkLayer',
506
+ },
501
507
  'task.map' => {
502
508
  optimize: 'HexaPDF::Task::Optimize',
503
509
  dereference: 'HexaPDF::Task::Dereference',
@@ -512,12 +518,19 @@ module HexaPDF
512
518
  #
513
519
  # Classes for the most often used color space families are implemented and readily available.
514
520
  #
515
- # See PDF1.7 s8.6
521
+ # See PDF2.0 s8.6
516
522
  #
517
523
  # filter.flate.compression::
518
524
  # Specifies the compression level that should be used with the FlateDecode filter. The level
519
525
  # can range from 0 (no compression), 1 (best speed) to 9 (best compression, default).
520
526
  #
527
+ # filter.flate.memory::
528
+ # Specifies the memory level that should be used with the FlateDecode filter. The level can
529
+ # range from 1 (minimum memory usage; slow, reduces compression) to 9 (maximum memory usage).
530
+ #
531
+ # The HexaPDF default value of 6 has been found in tests to be nearly equivalent to the Zlib
532
+ # default of 8 in terms of speed and compression level but uses less memory.
533
+ #
521
534
  # filter.flate.on_error::
522
535
  # Callback hook when a potentially recoverable Zlib error occurs in the FlateDecode filter.
523
536
  #
@@ -527,13 +540,6 @@ module HexaPDF
527
540
  #
528
541
  # The default implementation prevents errors from being raised.
529
542
  #
530
- # filter.flate.memory::
531
- # Specifies the memory level that should be used with the FlateDecode filter. The level can
532
- # range from 1 (minimum memory usage; slow, reduces compression) to 9 (maximum memory usage).
533
- #
534
- # The HexaPDF default value of 6 has been found in tests to be nearly equivalent to the Zlib
535
- # default of 8 in terms of speed and compression level but uses less memory.
536
- #
537
543
  # filter.predictor.strict::
538
544
  # Specifies whether the predictor algorithm used by LZWDecode and FlateDecode should operate in
539
545
  # strict mode, i.e. adhering to the PDF specification without correcting for common deficiences
@@ -555,15 +561,15 @@ module HexaPDF
555
561
  # This mapping is used to provide automatic wrapping of objects in the HexaPDF::Document#wrap
556
562
  # method.
557
563
  GlobalConfiguration =
558
- Configuration.new('filter.flate.compression' => 9,
559
- 'filter.flate.on_error' => proc { false },
560
- 'filter.flate.memory' => 6,
561
- 'filter.predictor.strict' => false,
562
- 'color_space.map' => {
564
+ Configuration.new('color_space.map' => {
563
565
  DeviceRGB: 'HexaPDF::Content::ColorSpace::DeviceRGB',
564
566
  DeviceCMYK: 'HexaPDF::Content::ColorSpace::DeviceCMYK',
565
567
  DeviceGray: 'HexaPDF::Content::ColorSpace::DeviceGray',
566
568
  },
569
+ 'filter.flate.compression' => 9,
570
+ 'filter.flate.memory' => 6,
571
+ 'filter.flate.on_error' => proc { false },
572
+ 'filter.predictor.strict' => false,
567
573
  'object.type_map' => {
568
574
  XRef: 'HexaPDF::Type::XRefStream',
569
575
  ObjStm: 'HexaPDF::Type::ObjectStream',
@@ -604,6 +610,23 @@ module HexaPDF
604
610
  XXOutlineItem: 'HexaPDF::Type::OutlineItem',
605
611
  PageLabel: 'HexaPDF::Type::PageLabel',
606
612
  XXMarkInformation: 'HexaPDF::Type::MarkInformation',
613
+ OCG: 'HexaPDF::Type::OptionalContentGroup',
614
+ OCMD: 'HexaPDF::Type::OptionalContentMembership',
615
+ XXOCUsage: 'HexaPDF::Type::OptionalContentGroup::OptionalContentUsage',
616
+ XXOCUsageCreatorInfo: 'HexaPDF::Type::OptionalContentGroup::OptionalContentUsage::CreatorInfo',
617
+ XXOCUsageLanguage: 'HexaPDF::Type::OptionalContentGroup::OptionalContentUsage::Language',
618
+ XXOCUsageExport: 'HexaPDF::Type::OptionalContentGroup::OptionalContentUsage::Export',
619
+ XXOCUsageZoom: 'HexaPDF::Type::OptionalContentGroup::OptionalContentUsage::Zoom',
620
+ XXOCUsagePrint: 'HexaPDF::Type::OptionalContentGroup::OptionalContentUsage::Print',
621
+ XXOCUsageView: 'HexaPDF::Type::OptionalContentGroup::OptionalContentUsage::View',
622
+ XXOCUsageUser: 'HexaPDF::Type::OptionalContentGroup::OptionalContentUsage::User',
623
+ XXOCUsagePageElement: 'HexaPDF::Type::OptionalContentGroup::OptionalContentUsage::PageElement',
624
+ XXOCProperties: 'HexaPDF::Type::OptionalContentProperties',
625
+ XXOCConfiguration: 'HexaPDF::Type::OptionalContentConfiguration',
626
+ XXOCUsageApplication: 'HexaPDF::Type::OptionalContentConfiguration::UsageApplication',
627
+ XXReference: 'HexaPDF::Type::Form::Reference',
628
+ XXCIDSystemInfo: 'HexaPDF::Type::CIDFont::CIDSystemInfo',
629
+ Group: 'HexaPDF::Type::Form::Group',
607
630
  },
608
631
  'object.subtype_map' => {
609
632
  nil => {
@@ -618,6 +641,7 @@ module HexaPDF
618
641
  GoToR: 'HexaPDF::Type::Actions::GoToR',
619
642
  Launch: 'HexaPDF::Type::Actions::Launch',
620
643
  URI: 'HexaPDF::Type::Actions::URI',
644
+ SetOCGState: 'HexaPDF::Type::Actions::SetOCGState',
621
645
  Text: 'HexaPDF::Type::Annotations::Text',
622
646
  Link: 'HexaPDF::Type::Annotations::Link',
623
647
  Widget: 'HexaPDF::Type::Annotations::Widget',
@@ -639,6 +663,7 @@ module HexaPDF
639
663
  GoToR: 'HexaPDF::Type::Actions::GoToR',
640
664
  Launch: 'HexaPDF::Type::Actions::Launch',
641
665
  URI: 'HexaPDF::Type::Actions::URI',
666
+ SetOCGState: 'HexaPDF::Type::Actions::SetOCGState',
642
667
  },
643
668
  Annot: {
644
669
  Text: 'HexaPDF::Type::Annotations::Text',