hexapdf 0.32.2 → 0.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +63 -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/lib/hexapdf/cli/command.rb +5 -2
  19. data/lib/hexapdf/cli/form.rb +5 -5
  20. data/lib/hexapdf/cli/inspect.rb +3 -3
  21. data/lib/hexapdf/composer.rb +104 -52
  22. data/lib/hexapdf/configuration.rb +44 -39
  23. data/lib/hexapdf/content/canvas.rb +393 -267
  24. data/lib/hexapdf/content/color_space.rb +72 -25
  25. data/lib/hexapdf/content/graphic_object/arc.rb +57 -24
  26. data/lib/hexapdf/content/graphic_object/endpoint_arc.rb +66 -23
  27. data/lib/hexapdf/content/graphic_object/geom2d.rb +47 -6
  28. data/lib/hexapdf/content/graphic_object/solid_arc.rb +58 -36
  29. data/lib/hexapdf/content/graphic_object.rb +6 -7
  30. data/lib/hexapdf/content/graphics_state.rb +54 -45
  31. data/lib/hexapdf/content/operator.rb +52 -54
  32. data/lib/hexapdf/content/parser.rb +2 -2
  33. data/lib/hexapdf/content/processor.rb +15 -15
  34. data/lib/hexapdf/content/transformation_matrix.rb +1 -1
  35. data/lib/hexapdf/content.rb +5 -0
  36. data/lib/hexapdf/dictionary.rb +6 -5
  37. data/lib/hexapdf/dictionary_fields.rb +42 -14
  38. data/lib/hexapdf/digital_signature/cms_handler.rb +2 -2
  39. data/lib/hexapdf/digital_signature/handler.rb +1 -1
  40. data/lib/hexapdf/digital_signature/pkcs1_handler.rb +2 -3
  41. data/lib/hexapdf/digital_signature/signature.rb +6 -6
  42. data/lib/hexapdf/digital_signature/signatures.rb +13 -12
  43. data/lib/hexapdf/digital_signature/signing/default_handler.rb +14 -5
  44. data/lib/hexapdf/digital_signature/signing/signed_data_creator.rb +2 -4
  45. data/lib/hexapdf/digital_signature/signing/timestamp_handler.rb +4 -4
  46. data/lib/hexapdf/digital_signature/signing.rb +4 -0
  47. data/lib/hexapdf/digital_signature/verification_result.rb +2 -2
  48. data/lib/hexapdf/digital_signature.rb +7 -2
  49. data/lib/hexapdf/document/destinations.rb +12 -11
  50. data/lib/hexapdf/document/files.rb +1 -1
  51. data/lib/hexapdf/document/fonts.rb +1 -1
  52. data/lib/hexapdf/document/layout.rb +167 -39
  53. data/lib/hexapdf/document/pages.rb +3 -2
  54. data/lib/hexapdf/document.rb +89 -55
  55. data/lib/hexapdf/encryption/aes.rb +5 -5
  56. data/lib/hexapdf/encryption/arc4.rb +1 -1
  57. data/lib/hexapdf/encryption/fast_aes.rb +2 -2
  58. data/lib/hexapdf/encryption/fast_arc4.rb +1 -1
  59. data/lib/hexapdf/encryption/identity.rb +1 -1
  60. data/lib/hexapdf/encryption/ruby_aes.rb +1 -1
  61. data/lib/hexapdf/encryption/ruby_arc4.rb +1 -1
  62. data/lib/hexapdf/encryption/security_handler.rb +31 -24
  63. data/lib/hexapdf/encryption/standard_security_handler.rb +45 -36
  64. data/lib/hexapdf/encryption.rb +7 -2
  65. data/lib/hexapdf/error.rb +18 -0
  66. data/lib/hexapdf/filter/ascii85_decode.rb +1 -1
  67. data/lib/hexapdf/filter/ascii_hex_decode.rb +1 -1
  68. data/lib/hexapdf/filter/flate_decode.rb +1 -1
  69. data/lib/hexapdf/filter/lzw_decode.rb +1 -1
  70. data/lib/hexapdf/filter/pass_through.rb +1 -1
  71. data/lib/hexapdf/filter/predictor.rb +1 -1
  72. data/lib/hexapdf/filter/run_length_decode.rb +1 -1
  73. data/lib/hexapdf/filter.rb +55 -6
  74. data/lib/hexapdf/font/cmap/parser.rb +2 -2
  75. data/lib/hexapdf/font/cmap.rb +1 -1
  76. data/lib/hexapdf/font/encoding/difference_encoding.rb +1 -1
  77. data/lib/hexapdf/font/encoding/mac_expert_encoding.rb +1 -1
  78. data/lib/hexapdf/font/encoding/mac_roman_encoding.rb +2 -2
  79. data/lib/hexapdf/font/encoding/standard_encoding.rb +1 -1
  80. data/lib/hexapdf/font/encoding/symbol_encoding.rb +1 -1
  81. data/lib/hexapdf/font/encoding/win_ansi_encoding.rb +3 -3
  82. data/lib/hexapdf/font/encoding/zapf_dingbats_encoding.rb +1 -1
  83. data/lib/hexapdf/font/invalid_glyph.rb +3 -0
  84. data/lib/hexapdf/font/true_type_wrapper.rb +17 -4
  85. data/lib/hexapdf/font/type1_wrapper.rb +19 -4
  86. data/lib/hexapdf/font_loader/from_configuration.rb +5 -2
  87. data/lib/hexapdf/font_loader/from_file.rb +5 -5
  88. data/lib/hexapdf/font_loader/standard14.rb +3 -3
  89. data/lib/hexapdf/font_loader.rb +3 -0
  90. data/lib/hexapdf/image_loader/jpeg.rb +2 -2
  91. data/lib/hexapdf/image_loader/pdf.rb +1 -1
  92. data/lib/hexapdf/image_loader/png.rb +2 -2
  93. data/lib/hexapdf/image_loader.rb +1 -1
  94. data/lib/hexapdf/importer.rb +13 -0
  95. data/lib/hexapdf/layout/box.rb +9 -2
  96. data/lib/hexapdf/layout/box_fitter.rb +2 -2
  97. data/lib/hexapdf/layout/column_box.rb +18 -4
  98. data/lib/hexapdf/layout/frame.rb +30 -12
  99. data/lib/hexapdf/layout/image_box.rb +5 -0
  100. data/lib/hexapdf/layout/inline_box.rb +1 -0
  101. data/lib/hexapdf/layout/list_box.rb +17 -1
  102. data/lib/hexapdf/layout/page_style.rb +4 -4
  103. data/lib/hexapdf/layout/style.rb +18 -3
  104. data/lib/hexapdf/layout/table_box.rb +682 -0
  105. data/lib/hexapdf/layout/text_box.rb +5 -3
  106. data/lib/hexapdf/layout/text_fragment.rb +1 -1
  107. data/lib/hexapdf/layout/text_layouter.rb +12 -4
  108. data/lib/hexapdf/layout.rb +1 -0
  109. data/lib/hexapdf/name_tree_node.rb +1 -1
  110. data/lib/hexapdf/number_tree_node.rb +1 -1
  111. data/lib/hexapdf/object.rb +18 -7
  112. data/lib/hexapdf/parser.rb +7 -7
  113. data/lib/hexapdf/pdf_array.rb +1 -1
  114. data/lib/hexapdf/rectangle.rb +1 -1
  115. data/lib/hexapdf/reference.rb +1 -1
  116. data/lib/hexapdf/revision.rb +1 -1
  117. data/lib/hexapdf/revisions.rb +3 -3
  118. data/lib/hexapdf/serializer.rb +15 -15
  119. data/lib/hexapdf/stream.rb +4 -2
  120. data/lib/hexapdf/tokenizer.rb +14 -14
  121. data/lib/hexapdf/type/acro_form/appearance_generator.rb +22 -22
  122. data/lib/hexapdf/type/acro_form/button_field.rb +1 -1
  123. data/lib/hexapdf/type/acro_form/choice_field.rb +1 -1
  124. data/lib/hexapdf/type/acro_form/field.rb +2 -2
  125. data/lib/hexapdf/type/acro_form/form.rb +1 -1
  126. data/lib/hexapdf/type/acro_form/signature_field.rb +4 -4
  127. data/lib/hexapdf/type/acro_form/text_field.rb +1 -1
  128. data/lib/hexapdf/type/acro_form/variable_text_field.rb +1 -1
  129. data/lib/hexapdf/type/acro_form.rb +1 -1
  130. data/lib/hexapdf/type/action.rb +1 -1
  131. data/lib/hexapdf/type/actions/go_to.rb +1 -1
  132. data/lib/hexapdf/type/actions/go_to_r.rb +1 -1
  133. data/lib/hexapdf/type/actions/launch.rb +1 -1
  134. data/lib/hexapdf/type/actions/uri.rb +1 -1
  135. data/lib/hexapdf/type/actions.rb +1 -1
  136. data/lib/hexapdf/type/annotation.rb +3 -3
  137. data/lib/hexapdf/type/annotations/link.rb +1 -1
  138. data/lib/hexapdf/type/annotations/markup_annotation.rb +1 -1
  139. data/lib/hexapdf/type/annotations/text.rb +1 -1
  140. data/lib/hexapdf/type/annotations/widget.rb +2 -2
  141. data/lib/hexapdf/type/annotations.rb +1 -1
  142. data/lib/hexapdf/type/catalog.rb +1 -1
  143. data/lib/hexapdf/type/cid_font.rb +3 -3
  144. data/lib/hexapdf/type/embedded_file.rb +1 -1
  145. data/lib/hexapdf/type/file_specification.rb +2 -2
  146. data/lib/hexapdf/type/font_descriptor.rb +1 -1
  147. data/lib/hexapdf/type/font_simple.rb +2 -2
  148. data/lib/hexapdf/type/font_type0.rb +3 -3
  149. data/lib/hexapdf/type/font_type3.rb +1 -1
  150. data/lib/hexapdf/type/form.rb +1 -1
  151. data/lib/hexapdf/type/graphics_state_parameter.rb +1 -1
  152. data/lib/hexapdf/type/icon_fit.rb +1 -1
  153. data/lib/hexapdf/type/image.rb +1 -1
  154. data/lib/hexapdf/type/info.rb +1 -1
  155. data/lib/hexapdf/type/mark_information.rb +1 -1
  156. data/lib/hexapdf/type/names.rb +2 -2
  157. data/lib/hexapdf/type/object_stream.rb +2 -1
  158. data/lib/hexapdf/type/outline.rb +1 -1
  159. data/lib/hexapdf/type/outline_item.rb +1 -1
  160. data/lib/hexapdf/type/page.rb +19 -10
  161. data/lib/hexapdf/type/page_label.rb +1 -1
  162. data/lib/hexapdf/type/page_tree_node.rb +1 -1
  163. data/lib/hexapdf/type/resources.rb +1 -1
  164. data/lib/hexapdf/type/trailer.rb +2 -2
  165. data/lib/hexapdf/type/viewer_preferences.rb +1 -1
  166. data/lib/hexapdf/type/xref_stream.rb +2 -2
  167. data/lib/hexapdf/utils/pdf_doc_encoding.rb +1 -1
  168. data/lib/hexapdf/version.rb +1 -1
  169. data/lib/hexapdf/writer.rb +4 -4
  170. data/lib/hexapdf/xref_section.rb +2 -2
  171. data/test/hexapdf/content/graphic_object/test_endpoint_arc.rb +11 -1
  172. data/test/hexapdf/content/graphic_object/test_geom2d.rb +7 -0
  173. data/test/hexapdf/content/test_canvas.rb +0 -1
  174. data/test/hexapdf/digital_signature/test_signatures.rb +22 -0
  175. data/test/hexapdf/document/test_files.rb +2 -2
  176. data/test/hexapdf/document/test_layout.rb +98 -0
  177. data/test/hexapdf/encryption/test_security_handler.rb +12 -11
  178. data/test/hexapdf/encryption/test_standard_security_handler.rb +35 -23
  179. data/test/hexapdf/font/test_true_type_wrapper.rb +18 -1
  180. data/test/hexapdf/font/test_type1_wrapper.rb +15 -1
  181. data/test/hexapdf/layout/test_box.rb +1 -1
  182. data/test/hexapdf/layout/test_column_box.rb +65 -21
  183. data/test/hexapdf/layout/test_frame.rb +14 -14
  184. data/test/hexapdf/layout/test_image_box.rb +4 -0
  185. data/test/hexapdf/layout/test_inline_box.rb +5 -0
  186. data/test/hexapdf/layout/test_list_box.rb +40 -6
  187. data/test/hexapdf/layout/test_page_style.rb +3 -2
  188. data/test/hexapdf/layout/test_style.rb +50 -0
  189. data/test/hexapdf/layout/test_table_box.rb +722 -0
  190. data/test/hexapdf/layout/test_text_box.rb +18 -0
  191. data/test/hexapdf/layout/test_text_layouter.rb +4 -0
  192. data/test/hexapdf/test_dictionary_fields.rb +4 -1
  193. data/test/hexapdf/test_document.rb +1 -0
  194. data/test/hexapdf/test_filter.rb +8 -0
  195. data/test/hexapdf/test_importer.rb +9 -0
  196. data/test/hexapdf/test_object.rb +16 -5
  197. data/test/hexapdf/test_stream.rb +7 -0
  198. data/test/hexapdf/test_writer.rb +3 -3
  199. data/test/hexapdf/type/acro_form/test_appearance_generator.rb +13 -5
  200. data/test/hexapdf/type/acro_form/test_form.rb +4 -3
  201. data/test/hexapdf/type/test_page.rb +18 -4
  202. metadata +17 -8
@@ -50,10 +50,9 @@ module HexaPDF
50
50
  # color to the specified gray value.
51
51
  #
52
52
  # Since HexaPDF doesn't have a content stream rendering facility, it is only interested in the
53
- # effects an operator has on the graphics state. By calling the #invoke method with a
54
- # Content::Processor as first argument and the operands as the rest of the arguments, the
55
- # operator can modify the graphics state as needed. This ensures internal consistency and
56
- # correct operation.
53
+ # effects an operator has on the graphics state. By calling the #invoke method with a Processor
54
+ # as first argument and the operands as the rest of the arguments, the operator can modify the
55
+ # graphics state as needed. This ensures internal consistency and correct operation.
57
56
  #
58
57
  # Operator objects are designed to be state-less. This means that the operands have to be
59
58
  # passed as arguments to the methods that need them.
@@ -62,8 +61,7 @@ module HexaPDF
62
61
  # == Operator Implementations
63
62
  #
64
63
  # HexaPDF comes with operator implementations for all PDF operations. These operator
65
- # implementations are derived from the Operator::BaseOperator class which provides all needed
66
- # methods.
64
+ # implementations are derived from the BaseOperator class which provides all needed methods.
67
65
  #
68
66
  # In general, an operator implementation is an object that responds to the following methods:
69
67
  #
@@ -76,10 +74,10 @@ module HexaPDF
76
74
  # #name::
77
75
  # Returns the name of the operator as String.
78
76
  #
79
- # See: PDF1.7 s8, s9
77
+ # See: PDF2.0 s8, s9
80
78
  module Operator
81
79
 
82
- # A base class for operator implementations.
80
+ # Base class for operator implementations.
83
81
  #
84
82
  # A default implementation for the #serialize method is provided. However, for performance
85
83
  # reasons each operator should provide a custom #serialize method.
@@ -148,7 +146,7 @@ module HexaPDF
148
146
 
149
147
  # Implementation of the 'q' operator.
150
148
  #
151
- # See: PDF1.7 s8.4.4
149
+ # See: PDF2.0 s8.4.4
152
150
  class SaveGraphicsState < NoArgumentOperator
153
151
 
154
152
  # Creates the operator.
@@ -164,7 +162,7 @@ module HexaPDF
164
162
 
165
163
  # Implementation of the 'Q' operator.
166
164
  #
167
- # See: PDF1.7 s8.4.4
165
+ # See: PDF2.0 s8.4.4
168
166
  class RestoreGraphicsState < NoArgumentOperator
169
167
 
170
168
  # Creates the operator.
@@ -180,7 +178,7 @@ module HexaPDF
180
178
 
181
179
  # Implementation of the 'cm' operator.
182
180
  #
183
- # See: PDF1.7 s8.4.4
181
+ # See: PDF2.0 s8.4.4
184
182
  class ConcatenateMatrix < BaseOperator
185
183
 
186
184
  # Creates the operator.
@@ -202,7 +200,7 @@ module HexaPDF
202
200
 
203
201
  # Implementation of the 'w' operator.
204
202
  #
205
- # See: PDF1.7 s8.4.4
203
+ # See: PDF2.0 s8.4.4
206
204
  class SetLineWidth < SingleNumericArgumentOperator
207
205
 
208
206
  # Creates the operator.
@@ -218,7 +216,7 @@ module HexaPDF
218
216
 
219
217
  # Implementation of the 'J' operator.
220
218
  #
221
- # See: PDF1.7 s8.4.4
219
+ # See: PDF2.0 s8.4.4
222
220
  class SetLineCapStyle < SingleNumericArgumentOperator
223
221
 
224
222
  # Creates the operator.
@@ -234,7 +232,7 @@ module HexaPDF
234
232
 
235
233
  # Implementation of the 'j' operator.
236
234
  #
237
- # See: PDF1.7 s8.4.4
235
+ # See: PDF2.0 s8.4.4
238
236
  class SetLineJoinStyle < SingleNumericArgumentOperator
239
237
 
240
238
  # Creates the operator.
@@ -250,7 +248,7 @@ module HexaPDF
250
248
 
251
249
  # Implementation of the 'M' operator.
252
250
  #
253
- # See: PDF1.7 s8.4.4
251
+ # See: PDF2.0 s8.4.4
254
252
  class SetMiterLimit < SingleNumericArgumentOperator
255
253
 
256
254
  # Creates the operator.
@@ -266,7 +264,7 @@ module HexaPDF
266
264
 
267
265
  # Implementation of the 'd' operator.
268
266
  #
269
- # See: PDF1.7 s8.4.4
267
+ # See: PDF2.0 s8.4.4
270
268
  class SetLineDashPattern < BaseOperator
271
269
 
272
270
  # Creates the operator.
@@ -287,7 +285,7 @@ module HexaPDF
287
285
 
288
286
  # Implementation of the 'ri' operator.
289
287
  #
290
- # See: PDF1.7 s8.4.4
288
+ # See: PDF2.0 s8.4.4
291
289
  class SetRenderingIntent < BaseOperator
292
290
 
293
291
  # Creates the operator.
@@ -310,7 +308,7 @@ module HexaPDF
310
308
  # Note: Only parameters supported by the GraphicsState/TextState classes are assigned, the
311
309
  # rest are ignored!
312
310
  #
313
- # See: PDF1.7 s8.4.4
311
+ # See: PDF2.0 s8.4.4
314
312
  class SetGraphicsStateParameters < BaseOperator
315
313
 
316
314
  # Creates the operator.
@@ -352,7 +350,7 @@ module HexaPDF
352
350
 
353
351
  # Implementation of the 'CS' operator.
354
352
  #
355
- # See: PDF1.7 s8.6.8
353
+ # See: PDF2.0 s8.6.8
356
354
  class SetStrokingColorSpace < BaseOperator
357
355
 
358
356
  # Creates the operator.
@@ -372,7 +370,7 @@ module HexaPDF
372
370
 
373
371
  # Implementation of the 'cs' operator.
374
372
  #
375
- # See: PDF1.7 s8.6.8
373
+ # See: PDF2.0 s8.6.8
376
374
  class SetNonStrokingColorSpace < BaseOperator
377
375
 
378
376
  # Creates the operator.
@@ -392,7 +390,7 @@ module HexaPDF
392
390
 
393
391
  # Implementation of the 'SC' and 'SCN' operator.
394
392
  #
395
- # See: PDF1.7 s8.6.8
393
+ # See: PDF2.0 s8.6.8
396
394
  class SetStrokingColor < BaseOperator
397
395
 
398
396
  def invoke(processor, *operands) #:nodoc:
@@ -404,7 +402,7 @@ module HexaPDF
404
402
 
405
403
  # Implementation of the 'sc' and 'scn' operator.
406
404
  #
407
- # See: PDF1.7 s8.6.8
405
+ # See: PDF2.0 s8.6.8
408
406
  class SetNonStrokingColor < BaseOperator
409
407
 
410
408
  def invoke(processor, *operands) #:nodoc:
@@ -416,7 +414,7 @@ module HexaPDF
416
414
 
417
415
  # Implementation of the 'G' operator.
418
416
  #
419
- # See: PDF1.7 s8.6.8
417
+ # See: PDF2.0 s8.6.8
420
418
  class SetDeviceGrayStrokingColor < SingleNumericArgumentOperator
421
419
 
422
420
  def initialize #:nodoc:
@@ -432,7 +430,7 @@ module HexaPDF
432
430
 
433
431
  # Implementation of the 'g' operator.
434
432
  #
435
- # See: PDF1.7 s8.6.8
433
+ # See: PDF2.0 s8.6.8
436
434
  class SetDeviceGrayNonStrokingColor < SingleNumericArgumentOperator
437
435
 
438
436
  # Creates the operator.
@@ -449,7 +447,7 @@ module HexaPDF
449
447
 
450
448
  # Implementation of the 'RG' operator.
451
449
  #
452
- # See: PDF1.7 s8.6.8
450
+ # See: PDF2.0 s8.6.8
453
451
  class SetDeviceRGBStrokingColor < BaseOperator
454
452
 
455
453
  # Creates the operator.
@@ -471,7 +469,7 @@ module HexaPDF
471
469
 
472
470
  # Implementation of the 'rg' operator.
473
471
  #
474
- # See: PDF1.7 s8.6.8
472
+ # See: PDF2.0 s8.6.8
475
473
  class SetDeviceRGBNonStrokingColor < BaseOperator
476
474
 
477
475
  # Creates the operator.
@@ -493,7 +491,7 @@ module HexaPDF
493
491
 
494
492
  # Implementation of the 'K' operator.
495
493
  #
496
- # See: PDF1.7 s8.6.8
494
+ # See: PDF2.0 s8.6.8
497
495
  class SetDeviceCMYKStrokingColor < BaseOperator
498
496
 
499
497
  # Creates the operator.
@@ -515,7 +513,7 @@ module HexaPDF
515
513
 
516
514
  # Implementation of the 'k' operator.
517
515
  #
518
- # See: PDF1.7 s8.6.8
516
+ # See: PDF2.0 s8.6.8
519
517
  class SetDeviceCMYKNonStrokingColor < BaseOperator
520
518
 
521
519
  # Creates the operator.
@@ -537,7 +535,7 @@ module HexaPDF
537
535
 
538
536
  # Implementation of the 'm' operator.
539
537
  #
540
- # See: PDF1.7 s8.5.2.1
538
+ # See: PDF2.0 s8.5.2.1
541
539
  class MoveTo < BaseOperator
542
540
 
543
541
  # Creates the operator.
@@ -557,7 +555,7 @@ module HexaPDF
557
555
 
558
556
  # Implementation of the 're' operator.
559
557
  #
560
- # See: PDF1.7 s8.5.2.1
558
+ # See: PDF2.0 s8.5.2.1
561
559
  class AppendRectangle < BaseOperator
562
560
 
563
561
  # Creates the operator.
@@ -578,7 +576,7 @@ module HexaPDF
578
576
 
579
577
  # Implementation of the 'l' operator.
580
578
  #
581
- # See: PDF1.7 s8.5.2.1
579
+ # See: PDF2.0 s8.5.2.1
582
580
  class LineTo < BaseOperator
583
581
 
584
582
  # Creates the operator.
@@ -597,7 +595,7 @@ module HexaPDF
597
595
 
598
596
  # Implementation of the 'c' operators.
599
597
  #
600
- # See: PDF1.7 s8.5.2.1
598
+ # See: PDF2.0 s8.5.2.1
601
599
  class CurveTo < BaseOperator
602
600
 
603
601
  # Creates the operator.
@@ -615,7 +613,7 @@ module HexaPDF
615
613
 
616
614
  # Implementation of the 'v' operators.
617
615
  #
618
- # See: PDF1.7 s8.5.2.1
616
+ # See: PDF2.0 s8.5.2.1
619
617
  class CurveToNoFirstControlPoint < BaseOperator
620
618
 
621
619
  # Creates the operator.
@@ -632,7 +630,7 @@ module HexaPDF
632
630
 
633
631
  # Implementation of the 'y' operators.
634
632
  #
635
- # See: PDF1.7 s8.5.2.1
633
+ # See: PDF2.0 s8.5.2.1
636
634
  class CurveToNoSecondControlPoint < BaseOperator
637
635
 
638
636
  # Creates the operator.
@@ -649,7 +647,7 @@ module HexaPDF
649
647
 
650
648
  # Implementation of the 'S', 's', 'f', 'F', 'f*', 'B', 'B*', 'b', 'b*' and 'n' operators.
651
649
  #
652
- # See: PDF1.7 s8.5.3.1
650
+ # See: PDF2.0 s8.5.3.1
653
651
  class EndPath < NoArgumentOperator
654
652
 
655
653
  def invoke(processor) #:nodoc:
@@ -660,7 +658,7 @@ module HexaPDF
660
658
 
661
659
  # Implementation of the 'W' and 'W*' operators.
662
660
  #
663
- # See: PDF1.7 s8.5.4
661
+ # See: PDF2.0 s8.5.4
664
662
  class ClipPath < NoArgumentOperator
665
663
 
666
664
  def invoke(processor) #:nodoc:
@@ -672,7 +670,7 @@ module HexaPDF
672
670
  # Implementation of the 'BI' operator which handles the *complete* inline image, i.e. the
673
671
  # 'ID' and 'EI' operators are never encountered.
674
672
  #
675
- # See: PDF1.7 s8.9.7
673
+ # See: PDF2.0 s8.9.7
676
674
  class InlineImage < BaseOperator
677
675
 
678
676
  # Creates the operator.
@@ -693,7 +691,7 @@ module HexaPDF
693
691
 
694
692
  # Implementation of the 'Tc' operator.
695
693
  #
696
- # See: PDF1.7 s9.3.1
694
+ # See: PDF2.0 s9.3.1
697
695
  class SetCharacterSpacing < SingleNumericArgumentOperator
698
696
 
699
697
  # Creates the operator.
@@ -709,7 +707,7 @@ module HexaPDF
709
707
 
710
708
  # Implementation of the 'Tw' operator.
711
709
  #
712
- # See: PDF1.7 s9.3.1
710
+ # See: PDF2.0 s9.3.1
713
711
  class SetWordSpacing < SingleNumericArgumentOperator
714
712
 
715
713
  # Creates the operator.
@@ -725,7 +723,7 @@ module HexaPDF
725
723
 
726
724
  # Implementation of the 'Tz' operator.
727
725
  #
728
- # See: PDF1.7 s9.3.1
726
+ # See: PDF2.0 s9.3.1
729
727
  class SetHorizontalScaling < SingleNumericArgumentOperator
730
728
 
731
729
  # Creates the operator.
@@ -741,7 +739,7 @@ module HexaPDF
741
739
 
742
740
  # Implementation of the 'TL' operator.
743
741
  #
744
- # See: PDF1.7 s9.3.1
742
+ # See: PDF2.0 s9.3.1
745
743
  class SetLeading < SingleNumericArgumentOperator
746
744
 
747
745
  # Creates the operator.
@@ -757,7 +755,7 @@ module HexaPDF
757
755
 
758
756
  # Implementation of the 'Tf' operator.
759
757
  #
760
- # See: PDF1.7 s9.3.1
758
+ # See: PDF2.0 s9.3.1
761
759
  class SetFontAndSize < BaseOperator
762
760
 
763
761
  # Creates the operator.
@@ -778,7 +776,7 @@ module HexaPDF
778
776
 
779
777
  # Implementation of the 'Tr' operator.
780
778
  #
781
- # See: PDF1.7 s9.3.1
779
+ # See: PDF2.0 s9.3.1
782
780
  class SetTextRenderingMode < SingleNumericArgumentOperator
783
781
 
784
782
  # Creates the operator.
@@ -794,7 +792,7 @@ module HexaPDF
794
792
 
795
793
  # Implementation of the 'Ts' operator.
796
794
  #
797
- # See: PDF1.7 s9.3.1
795
+ # See: PDF2.0 s9.3.1
798
796
  class SetTextRise < SingleNumericArgumentOperator
799
797
 
800
798
  # Creates the operator.
@@ -810,7 +808,7 @@ module HexaPDF
810
808
 
811
809
  # Implementation of the 'BT' operator.
812
810
  #
813
- # See: PDF1.7 s9.4.1
811
+ # See: PDF2.0 s9.4.1
814
812
  class BeginText < NoArgumentOperator
815
813
 
816
814
  def initialize #:nodoc:
@@ -827,7 +825,7 @@ module HexaPDF
827
825
 
828
826
  # Implementation of the 'ET' operator.
829
827
  #
830
- # See: PDF1.7 s9.4.1
828
+ # See: PDF2.0 s9.4.1
831
829
  class EndText < NoArgumentOperator
832
830
 
833
831
  # Creates the operator.
@@ -845,7 +843,7 @@ module HexaPDF
845
843
 
846
844
  # Implementation of the 'Td' operator.
847
845
  #
848
- # See: PDF1.7 s9.4.2
846
+ # See: PDF2.0 s9.4.2
849
847
  class MoveText < BaseOperator
850
848
 
851
849
  # Creates the operator.
@@ -866,7 +864,7 @@ module HexaPDF
866
864
 
867
865
  # Implementation of the 'TD' operator.
868
866
  #
869
- # See: PDF1.7 s9.4.2
867
+ # See: PDF2.0 s9.4.2
870
868
  class MoveTextAndSetLeading < BaseOperator
871
869
 
872
870
  # Creates the operator.
@@ -887,7 +885,7 @@ module HexaPDF
887
885
 
888
886
  # Implementation of the 'Tm' operator.
889
887
  #
890
- # See: PDF1.7 s9.4.2
888
+ # See: PDF2.0 s9.4.2
891
889
  class SetTextMatrix < BaseOperator
892
890
 
893
891
  # Creates the operator.
@@ -910,7 +908,7 @@ module HexaPDF
910
908
 
911
909
  # Implementation of the 'T*' operator.
912
910
  #
913
- # See: PDF1.7 s9.4.2
911
+ # See: PDF2.0 s9.4.2
914
912
  class MoveTextNextLine < NoArgumentOperator
915
913
 
916
914
  # Creates the operator.
@@ -927,7 +925,7 @@ module HexaPDF
927
925
 
928
926
  # Implementation of the 'Tj' operator.
929
927
  #
930
- # See: PDF1.7 s9.4.3
928
+ # See: PDF2.0 s9.4.3
931
929
  class ShowText < BaseOperator
932
930
 
933
931
  # Creates the operator.
@@ -943,7 +941,7 @@ module HexaPDF
943
941
 
944
942
  # Implementation of the ' operator.
945
943
  #
946
- # See: PDF1.7 s9.4.3
944
+ # See: PDF2.0 s9.4.3
947
945
  class MoveTextNextLineAndShowText < BaseOperator
948
946
 
949
947
  def initialize #:nodoc:
@@ -963,7 +961,7 @@ module HexaPDF
963
961
 
964
962
  # Implementation of the " operator.
965
963
  #
966
- # See: PDF1.7 s9.4.3
964
+ # See: PDF2.0 s9.4.3
967
965
  class SetSpacingMoveTextNextLineAndShowText < BaseOperator
968
966
 
969
967
  # Creates the operator.
@@ -987,7 +985,7 @@ module HexaPDF
987
985
 
988
986
  # Implementation of the 'TJ' operator.
989
987
  #
990
- # See: PDF1.7 s9.4.3
988
+ # See: PDF2.0 s9.4.3
991
989
  class ShowTextWithPositioning < BaseOperator
992
990
 
993
991
  # Creates the operator.
@@ -46,14 +46,14 @@ module HexaPDF
46
46
  #
47
47
  # Changes:
48
48
  #
49
- # * Since a content stream is normally parsed front to back, a StopIteration error can be raised
49
+ # * Since a content stream is usually parsed front to back, a StopIteration error can be raised
50
50
  # instead of returning +NO_MORE_TOKENS+ once the end of the string is reached to avoid costly
51
51
  # checks in each iteration. If this behaviour is wanted, pass "raise_on_eos: true" in the
52
52
  # constructor.
53
53
  #
54
54
  # * Indirect object references are *not* supported by this tokenizer!
55
55
  #
56
- # See: PDF1.7 s7.2
56
+ # See: PDF2.0 s7.2
57
57
  class Tokenizer < HexaPDF::Tokenizer #:nodoc:
58
58
 
59
59
  # The string that is tokenized.
@@ -45,7 +45,7 @@ module HexaPDF
45
45
  # == General Information
46
46
  #
47
47
  # When a content stream is read, operators and their operands are extracted. After extracting
48
- # these operators are normally processed with a Processor instance that ensures that the needed
48
+ # these operators are usually processed with a Processor instance that ensures that the needed
49
49
  # setup (like modifying the graphics state) is done before further processing.
50
50
  #
51
51
  # == How Processing Works
@@ -79,7 +79,7 @@ module HexaPDF
79
79
 
80
80
  # Represents an (immutable) glyph box with positioning information.
81
81
  #
82
- # Since the glyph may have been transformed by an affine matrix, the bounding may not be a
82
+ # Since the glyph may have been transformed by an affine matrix, the bounding box may not be a
83
83
  # rectangle in all cases but it is always a parallelogram.
84
84
  class GlyphBox
85
85
 
@@ -105,7 +105,7 @@ module HexaPDF
105
105
  end
106
106
 
107
107
  # :call-seq:
108
- # fragment.lower_left -> [llx, lly]
108
+ # glyph_box.lower_left -> [llx, lly]
109
109
  #
110
110
  # Returns the lower left coordinate
111
111
  def lower_left
@@ -113,7 +113,7 @@ module HexaPDF
113
113
  end
114
114
 
115
115
  # :call-seq:
116
- # fragment.lower_right -> [lrx, lry]
116
+ # glyph_box.lower_right -> [lrx, lry]
117
117
  #
118
118
  # Returns the lower right coordinate
119
119
  def lower_right
@@ -121,7 +121,7 @@ module HexaPDF
121
121
  end
122
122
 
123
123
  # :call-seq:
124
- # fragment.upper_left -> [ulx, uly]
124
+ # glyph_box.upper_left -> [ulx, uly]
125
125
  #
126
126
  # Returns the upper left coordinate
127
127
  def upper_left
@@ -129,7 +129,7 @@ module HexaPDF
129
129
  end
130
130
 
131
131
  # :call-seq:
132
- # fragment.upper_right -> [urx, ury]
132
+ # glyph_box.upper_right -> [urx, ury]
133
133
  #
134
134
  # Returns the upper right coordinate which is computed by using the other three points of
135
135
  # the parallelogram.
@@ -138,7 +138,7 @@ module HexaPDF
138
138
  end
139
139
 
140
140
  # :call-seq:
141
- # fragment.points -> [llx, lly, lrx, lry, urx, ury, ulx, uly]
141
+ # glyph_box.points -> [llx, lly, lrx, lry, urx, ury, ulx, uly]
142
142
  #
143
143
  # Returns the four corners of the box as an array of coordinates, starting with the lower
144
144
  # left corner and going counterclockwise.
@@ -155,7 +155,7 @@ module HexaPDF
155
155
  # in a straight line.
156
156
  class CompositeBox
157
157
 
158
- # The text boxes contained in this positioned text object.
158
+ # The glyph boxes contained in this composite box object.
159
159
  attr_reader :boxes
160
160
 
161
161
  # Creates an empty object.
@@ -185,7 +185,7 @@ module HexaPDF
185
185
  self
186
186
  end
187
187
 
188
- # Returns the concatenated text of the boxes.
188
+ # Returns the concatenated text of all the glyph boxes.
189
189
  def string
190
190
  @boxes.map(&:string).join
191
191
  end
@@ -311,14 +311,14 @@ module HexaPDF
311
311
 
312
312
  # The GraphicsState object containing the current graphics state.
313
313
  #
314
- # It is not advised that this attribute is changed manually, it is automatically adjusted
315
- # according to the processed operators!
314
+ # It is not advised to change this attribute manually, it is automatically adjusted according
315
+ # to the processed operators!
316
316
  attr_reader :graphics_state
317
317
 
318
318
  # The current graphics object.
319
319
  #
320
- # It is not advised that this attribute is changed manually, it is automatically adjusted
321
- # according to the processed operators!
320
+ # It is not advised to change this attribute manually, it is automatically adjusted according
321
+ # to the processed operators!
322
322
  #
323
323
  # This attribute can have the following values:
324
324
  #
@@ -327,7 +327,7 @@ module HexaPDF
327
327
  # :clipping_path:: The current graphics object is a clipping path.
328
328
  # :text:: The current graphics object is text.
329
329
  #
330
- # See: PDF1.7 s8.2
330
+ # See: PDF2.0 s8.2
331
331
  attr_accessor :graphics_object
332
332
 
333
333
  # Initializes a new processor that uses the resources PDF dictionary for resolving resources
@@ -417,7 +417,7 @@ module HexaPDF
417
417
  # Decodes the given array containing text and positioning information while assuming that the
418
418
  # writing direction is horizontal.
419
419
  #
420
- # See: PDF1.7 s9.4.4
420
+ # See: PDF2.0 s9.4.4
421
421
  def decode_horizontal_text(array)
422
422
  font = graphics_state.font
423
423
  scaled_char_space = graphics_state.scaled_character_spacing
@@ -67,7 +67,7 @@ module HexaPDF
67
67
  #
68
68
  # Details and some examples can be found in the PDF reference.
69
69
  #
70
- # See: PDF1.7 s8.3
70
+ # See: PDF2.0 s8.3
71
71
  class TransformationMatrix
72
72
 
73
73
  include HexaPDF::Utils::MathHelpers
@@ -39,6 +39,11 @@ module HexaPDF
39
39
  # == Overview
40
40
  #
41
41
  # The Content module contains everything related to working with page content streams.
42
+ #
43
+ # The most important classes are:
44
+ #
45
+ # * The Canvas class which provides an interface for drawing graphics and text.
46
+ # * The Parser and Processor classes for processing an existing content stream.
42
47
  module Content
43
48
 
44
49
  autoload(:Canvas, 'hexapdf/content/canvas')
@@ -47,10 +47,11 @@ module HexaPDF
47
47
  # the PDF specification. This allows, among other things, automatic type checking and
48
48
  # basic validation.
49
49
  #
50
- # Fields defined in superclasses are inherited by their subclasses. This avoids duplicating
51
- # basic field information.
50
+ # Fields defined in superclasses are inherited by their subclasses. This avoids duplicating basic
51
+ # field information. If fields differ from their superclass definition, they can be defined again
52
+ # in the subclass.
52
53
  #
53
- # See: PDF1.7 s7.3.7
54
+ # See: PDF2.0 s7.3.7
54
55
  class Dictionary < HexaPDF::Object
55
56
 
56
57
  include DictionaryFields
@@ -85,7 +86,7 @@ module HexaPDF
85
86
  # a Symbol), it has to be the first in the list. Otherwise automatic type conversion
86
87
  # functions won't work correctly.
87
88
  #
88
- # required:: Specifies whether this field is required.
89
+ # required:: Specifies whether this field is required, either +true+ or +false+.
89
90
  #
90
91
  # default:: Specifies the default value for the field, if any.
91
92
  #
@@ -174,7 +175,7 @@ module HexaPDF
174
175
  data
175
176
  end
176
177
 
177
- # Stores the data under name in the dictionary. Name has to be a Symbol object.
178
+ # Stores the data under name in the dictionary. Name has to be a Symbol.
178
179
  #
179
180
  # If the current value for this name has the class HexaPDF::Object (and only this, no
180
181
  # subclasses) and the given value has not (including subclasses), the value is stored inside the