pdfrb 0.7.32 → 0.7.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1cd3d8414d6c20ce3716e042003303eb08b96a0b71c0002cbba9fd1b9a21ecd
4
- data.tar.gz: 6c40d53aadb7ead589dbf47949e73aba8c09d25750e115801f5307a1d9b82fc5
3
+ metadata.gz: 63bc7a84b2c25516f6471a8ef25aa513cd952ba83ea17b7bc3dd2c73171da943
4
+ data.tar.gz: 8b0177a111dbdf1746f4ad128ec4c1a0fcd4d8d95ca74c8f429708f3c269290e
5
5
  SHA512:
6
- metadata.gz: a8dd8f8136a9563fb5ed3da98841836026e0fca9164db0f5fa1a7379bffa09f4fd86361361fa91bcff999a97947c72a447053eacec02edfc5354c5852c2248f7
7
- data.tar.gz: e506eecbd9cb8536cc80e0d79fea1591912de2fedce5d1d5ea092311f8b8c44e013d8befc5c833d5ebb210b94140382f5121f11f0f43bc84bfd6755d90f948d3
6
+ metadata.gz: 631ee3dcb0e45ac7ac4801491ab40aed9e8aeaea85bdc966d11ab7f1f06f498654a395d7a1ddc40be63fd8dbf3338a1fe72a6eb27e47ebce1dc3cb132b0e6841
7
+ data.tar.gz: e744fa0dd1887afb443ba54f8605638a102c2f5e3e6174ab090bd6a31a970b0c07424d7ba3ce751c1f6a61b629df7f47a702152e767e7d08933e4dcff1e25140
@@ -172,7 +172,10 @@ module Pdfrb
172
172
  return raw[1..-2].split.then { |tokens| tokens.map { |t| arlington_scalar(t) } }
173
173
  end
174
174
 
175
- arlington_scalar(raw)
175
+ scalar = arlington_scalar(raw)
176
+ return scalar.to_sym if scalar.is_a?(::String) && field_def.types_raw.include?("name")
177
+
178
+ scalar
176
179
  end
177
180
  private :arlington_default
178
181
 
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # FlateDecode /DecodeParms dictionary (s7.4.4.3): predictor
7
+ # settings shared with LZWDecode.
8
+ class FlateDecodeParms < Pdfrb::Model::Cos::Dictionary
9
+ arlington_object "FilterFlateDecode"
10
+
11
+ def predictor; self[:Predictor] || 1; end
12
+ def colors; self[:Colors] || 1; end
13
+ def bits_per_component; self[:BitsPerComponent] || 8; end
14
+ def columns; self[:Columns] || 1; end
15
+
16
+ def png_predictor?; predictor >= 10; end
17
+ def tiff_predictor?; predictor == 2; end
18
+ end
19
+
20
+ # LZWDecode /DecodeParms dictionary (s7.4.4.2): adds EarlyChange.
21
+ class LZWDecodeParms < FlateDecodeParms
22
+ arlington_object "FilterLZWDecode"
23
+
24
+ def early_change; self[:EarlyChange] || 1; end
25
+ end
26
+
27
+ # DCTDecode /DecodeParms dictionary (s7.4.7): color transform.
28
+ class DCTDecodeParms < Pdfrb::Model::Cos::Dictionary
29
+ arlington_object "FilterDCTDecode"
30
+
31
+ def color_transform; self[:ColorTransform]; end
32
+
33
+ # /ColorTransform 0 = four-component YCCK/CMYK input; 1 (or
34
+ # absent) = three-component YCbCr/RGB.
35
+ def cmyk_input?
36
+ !color_transform.nil? && color_transform.zero?
37
+ end
38
+ end
39
+
40
+ # CCITTFaxDecode /DecodeParms dictionary (s7.4.6): Group 3/4
41
+ # facsimile parameters.
42
+ class CCITTFaxDecodeParms < Pdfrb::Model::Cos::Dictionary
43
+ arlington_object "FilterCCITTFaxDecode"
44
+
45
+ def k; self[:K]; end
46
+ def end_of_line; self[:EndOfLine]; end
47
+ def encoded_byte_align; self[:EncodedByteAlign]; end
48
+ def columns; self[:Columns] || 1728; end
49
+ def rows; self[:Rows]; end
50
+ def end_of_block; self[:EndOfBlock]; end
51
+ def black_is_one; self[:BlackIs1]; end
52
+ def damaged_rows_before_error; self[:DamagedRowsBeforeError]; end
53
+
54
+ def group4?; k&.negative?; end
55
+ def group3_1d?; k&.zero?; end
56
+ def group3_2d?; k&.positive?; end
57
+ end
58
+
59
+ # JBIG2Decode /DecodeParms dictionary (s7.4.7): global stream ref.
60
+ class JBIG2DecodeParms < Pdfrb::Model::Cos::Dictionary
61
+ arlington_object "FilterJBIG2Decode"
62
+
63
+ def jbig2_globals; self[:JBIG2Globals]; end
64
+ end
65
+
66
+ # Crypt /DecodeParms dictionary (s7.6.5.5): names the crypt
67
+ # filter applied to a stream.
68
+ class CryptDecodeParms < Pdfrb::Model::Cos::Dictionary
69
+ arlington_object "FilterCrypt"
70
+
71
+ def type; self[:Type]; end
72
+ def name; self[:Name] || :Identity; end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Media Clip Data stream (s13.3.3). Carries actual media payload.
7
7
  class MediaClip < Pdfrb::Model::Cos::Stream
8
+ arlington_object "MediaClipData"
8
9
  def type; self[:Type]; end
9
10
  def subtype; self[:S]&.to_sym; end
10
11
 
@@ -23,6 +24,56 @@ module Pdfrb
23
24
  document.object(ref)
24
25
  end
25
26
  end
27
+
28
+ # Media Clip Data MH/BE sub-dictionary (s13.3.3): /BU alternate
29
+ # file-by-URL used when the primary fails.
30
+ class MediaClipDataMHBE < Pdfrb::Model::Cos::Dictionary
31
+ arlington_object "MediaClipDataMHBE"
32
+
33
+ def alternate_url; self[:BU]; end
34
+ end
35
+
36
+ # Media Clip Section stream (s13.3.4): a temporal sub-section
37
+ # of a MediaClipData.
38
+ class MediaClipSection < Pdfrb::Model::Cos::Stream
39
+ arlington_object "MediaClipSection"
40
+
41
+ def subtype; self[:S]&.to_sym; end
42
+ def name; self[:N]; end
43
+ def duration; self[:D]; end
44
+ def alternates; self[:Alt]; end
45
+ def must_honor; self[:MH]; end
46
+ def best_effort; self[:BE]; end
47
+ end
48
+
49
+ # Section MH/BE sub-dictionary (s13.3.4): begin/end times.
50
+ class MediaClipSectionMHBE < Pdfrb::Model::Cos::Dictionary
51
+ arlington_object "MediaClipSectionMHBE"
52
+
53
+ def begin; self[:B]; end
54
+ def ends; self[:E]; end
55
+ end
56
+
57
+ # Media duration (s13.3.2): /T time value in seconds.
58
+ class MediaDuration < Pdfrb::Model::Cos::Dictionary
59
+ arlington_object "MediaDuration"
60
+
61
+ def seconds; self[:T]; end
62
+ end
63
+
64
+ # Media permissions (s13.3.2, Temp-File TF flags): validity
65
+ # after saving, printing, and extraction.
66
+ class MediaPermissions < Pdfrb::Model::Cos::Dictionary
67
+ arlington_object "MediaPermissions"
68
+
69
+ def temp_file_flags; self[:TF]; end
70
+
71
+ # Bit 1: media invalid after saving.
72
+ def invalid_after_save?; !temp_file_flags.nil? && temp_file_flags.nobits?(1); end
73
+
74
+ # Bit 2: media invalid after printing.
75
+ def invalid_after_print?; !temp_file_flags.nil? && temp_file_flags.nobits?(2); end
76
+ end
26
77
  end
27
78
  end
28
79
  end
@@ -108,6 +108,43 @@ module Pdfrb
108
108
  !!bit_rate
109
109
  end
110
110
  end
111
+
112
+ # Media play parameters (s13.3.2): controls for playing a
113
+ # rendition; /MH and /BE wrap the same set.
114
+ class MediaPlayParameters < Pdfrb::Model::Cos::Dictionary
115
+ arlington_object "MediaPlayParameters"
116
+
117
+ def players; self[:PL]; end
118
+ def must_honor; self[:MH]; end
119
+ def best_effort; self[:BE]; end
120
+ end
121
+
122
+ # Play parameter set for must-honor (s13.2.2): volume V,
123
+ # controls C, fit F, duration D, repeat count A, audio RC.
124
+ class MediaPlayParametersMH < Pdfrb::Model::Cos::Dictionary
125
+ arlington_object "MediaPlayParametersMH"
126
+
127
+ def volume; self[:V]; end
128
+ def fit; self[:F]; end
129
+ def duration; self[:D]; end
130
+ def repeat_count; self[:A]; end
131
+ def audio_rewrite; self[:RC]; end
132
+ end
133
+
134
+ # Play parameter set for best-effort (s13.2.2).
135
+ class MediaPlayParametersBE < MediaPlayParametersMH
136
+ arlington_object "MediaPlayParametersBE"
137
+ end
138
+
139
+ # Screen parameter set for MH/BE (s13.2.2): window W,
140
+ # background color B, opacity O, duration M, floating F.
141
+ class MediaScreenParametersMHBE < Pdfrb::Model::Cos::Dictionary
142
+ arlington_object "MediaScreenParametersMHBE"
143
+
144
+ def window; self[:W]; end
145
+ def background_color; self[:B]; end
146
+ def opacity; self[:O]; end
147
+ end
111
148
  end
112
149
  end
113
150
  end
@@ -71,6 +71,116 @@ module Pdfrb
71
71
  decoded_stream&.force_encoding(Encoding::BINARY)
72
72
  end
73
73
  end
74
+
75
+ # Gamma array [r g b] inside the CalRGB dict (s8.6.3.3).
76
+ class GammaArray < Pdfrb::Model::PdfArray
77
+ arlington_object "GammaArray"
78
+
79
+ def r; self[0]; end
80
+ def g; self[1]; end
81
+ def b; self[2]; end
82
+ end
83
+
84
+ # White point [X Y Z] inside Cal dicts (s8.6.3.1).
85
+ class WhitepointArray < Pdfrb::Model::PdfArray
86
+ arlington_object "WhitepointArray"
87
+
88
+ def x; self[0]; end
89
+ def y; self[1]; end
90
+ def z; self[2]; end
91
+ end
92
+
93
+ # Trailer /ID array [id1 id2] (s7.5.5): two 16-byte strings.
94
+ class TrailerIDArray < Pdfrb::Model::PdfArray
95
+ arlington_object "TrailerIDArray"
96
+
97
+ def id1; self[0]; end
98
+ def id2; self[1]; end
99
+ end
100
+
101
+ # Visibility expression array (s8.11.4.6):
102
+ # [operator operand*] with operators /And /Or /Not.
103
+ class VisibilityExpressionArray < Pdfrb::Model::PdfArray
104
+ arlington_object "VisibilityExpressionArray"
105
+
106
+ def operator; self[0]; end
107
+
108
+ def operands
109
+ rest = self[1..] || []
110
+ rest.is_a?(Pdfrb::Model::PdfArray) ? rest.to_a : rest
111
+ end
112
+
113
+ def and?; operator == :And; end
114
+ def or?; operator == :Or; end
115
+ def not?; operator == :Not; end
116
+ end
117
+
118
+ # FileSpec /RelatedFiles array (s7.11.3.2, deprecation era):
119
+ # alternating file-name strings and file streams.
120
+ class RelatedFilesArray < Pdfrb::Model::PdfArray
121
+ arlington_object "RelatedFilesArray"
122
+
123
+ def each_pair
124
+ return enum_for(:each_pair) unless block_given?
125
+
126
+ (0...size).step(2) do |i|
127
+ yield self[i], self[i + 1]
128
+ end
129
+ end
130
+ end
131
+
132
+ # RichMediaExecute /CMD /A arguments array (s13.6.9.6).
133
+ class RichMediaCommandArray < Pdfrb::Model::PdfArray
134
+ arlington_object "RichMediaCommandArray"
135
+ end
136
+
137
+ # UR transform permission name arrays (s7.6.5.9): lists of
138
+ # permitted operation names. One subclass per /Transform
139
+ # parameter entry.
140
+ class URTransformParamArray < Pdfrb::Model::PdfArray
141
+ arlington_object "URTransformParamDocumentArray"
142
+ end
143
+
144
+ class URTransformParamAnnotsArray < URTransformParamArray
145
+ arlington_object "URTransformParamAnnotsArray"
146
+ end
147
+
148
+ class URTransformParamEFArray < URTransformParamArray
149
+ arlington_object "URTransformParamEFArray"
150
+ end
151
+
152
+ class URTransformParamFormArray < URTransformParamArray
153
+ arlington_object "URTransformParamFormArray"
154
+ end
155
+
156
+ class URTransformParamSignatureArray < URTransformParamArray
157
+ arlington_object "URTransformParamSignatureArray"
158
+ end
159
+
160
+ # Generic catch-all array (Arlington _UniversalArray): any
161
+ # mix of PDF values.
162
+ class UniversalArray < Pdfrb::Model::PdfArray
163
+ arlington_object "_UniversalArray"
164
+ end
165
+
166
+ # Generic catch-all dictionary (Arlington _UniversalDictionary).
167
+ class UniversalDictionary < Pdfrb::Model::Cos::Dictionary
168
+ arlington_object "_UniversalDictionary"
169
+ end
170
+
171
+ # /OOAdditionalStms array [name stream]* (PDF 1.5 era
172
+ # object-order additional streams).
173
+ class OOAdditionalStmsArray < Pdfrb::Model::PdfArray
174
+ arlington_object "OOAdditionalStmsArray"
175
+
176
+ def each_pair
177
+ return enum_for(:each_pair) unless block_given?
178
+
179
+ (0...size).step(2) do |i|
180
+ yield self[i], self[i + 1]
181
+ end
182
+ end
183
+ end
74
184
  end
75
185
  end
76
186
  end
@@ -26,6 +26,40 @@ module Pdfrb
26
26
  document.object(ref)
27
27
  end
28
28
  end
29
+
30
+ # Media rendition /S /MR (s13.3.5): plays a media clip.
31
+ class RenditionMedia < Rendition
32
+ arlington_object "RenditionMedia"
33
+
34
+ def must_honor; self[:MH]; end
35
+ def best_effort; self[:BE]; end
36
+ def media_permissions; self[:P]; end
37
+ def visible_on_page?; self[:SP] != false; end
38
+ end
39
+
40
+ # Selector rendition /S /SR (s13.3.5): picks among renditions.
41
+ class RenditionSelector < Rendition
42
+ arlington_object "RenditionSelector"
43
+
44
+ def must_honor; self[:MH]; end
45
+ def best_effort; self[:BE]; end
46
+ def renditions; self[:R]; end
47
+ end
48
+
49
+ # Must-honor parameter wrapper {C: params} (s13.2.2): the
50
+ # conforming reader must satisfy these or abort.
51
+ class RenditionMH < Pdfrb::Model::Cos::Dictionary
52
+ arlington_object "RenditionMH"
53
+
54
+ def parameters; self[:C]; end
55
+ end
56
+
57
+ # Best-effort parameter wrapper {C: params} (s13.2.2).
58
+ class RenditionBE < Pdfrb::Model::Cos::Dictionary
59
+ arlington_object "RenditionBE"
60
+
61
+ def parameters; self[:C]; end
62
+ end
29
63
  end
30
64
  end
31
65
  end
@@ -311,6 +311,19 @@ module Pdfrb
311
311
  autoload :AppearanceSubDict, "pdfrb/model/type/appearance_trap_net"
312
312
  autoload :MediaClip, "pdfrb/model/type/media_clip"
313
313
  autoload :Rendition, "pdfrb/model/type/rendition"
314
+ autoload :RenditionMedia, "pdfrb/model/type/rendition"
315
+ autoload :RenditionSelector, "pdfrb/model/type/rendition"
316
+ autoload :RenditionMH, "pdfrb/model/type/rendition"
317
+ autoload :RenditionBE, "pdfrb/model/type/rendition"
318
+ autoload :MediaClipDataMHBE, "pdfrb/model/type/media_clip"
319
+ autoload :MediaClipSection, "pdfrb/model/type/media_clip"
320
+ autoload :MediaClipSectionMHBE, "pdfrb/model/type/media_clip"
321
+ autoload :MediaDuration, "pdfrb/model/type/media_clip"
322
+ autoload :MediaPermissions, "pdfrb/model/type/media_clip"
323
+ autoload :MediaPlayParameters, "pdfrb/model/type/media_offset"
324
+ autoload :MediaPlayParametersMH, "pdfrb/model/type/media_offset"
325
+ autoload :MediaPlayParametersBE, "pdfrb/model/type/media_offset"
326
+ autoload :MediaScreenParametersMHBE, "pdfrb/model/type/media_offset"
314
327
  autoload :ExDataProjection, "pdfrb/model/type/projection_annotation"
315
328
  autoload :AnnotationProjectionDict, "pdfrb/model/type/projection_annotation"
316
329
 
@@ -330,6 +343,28 @@ module Pdfrb
330
343
  autoload :DestOutputProfileRef, "pdfrb/model/type/misc_helpers"
331
344
  autoload :OutputIntentsContainer, "pdfrb/model/type/misc_helpers"
332
345
  autoload :CMapStream, "pdfrb/model/type/misc_helpers"
346
+ autoload :GammaArray, "pdfrb/model/type/misc_helpers"
347
+ autoload :WhitepointArray, "pdfrb/model/type/misc_helpers"
348
+ autoload :TrailerIDArray, "pdfrb/model/type/misc_helpers"
349
+ autoload :VisibilityExpressionArray, "pdfrb/model/type/misc_helpers"
350
+ autoload :RelatedFilesArray, "pdfrb/model/type/misc_helpers"
351
+ autoload :RichMediaCommandArray, "pdfrb/model/type/misc_helpers"
352
+ autoload :URTransformParamArray, "pdfrb/model/type/misc_helpers"
353
+ autoload :URTransformParamAnnotsArray, "pdfrb/model/type/misc_helpers"
354
+ autoload :URTransformParamEFArray, "pdfrb/model/type/misc_helpers"
355
+ autoload :URTransformParamFormArray, "pdfrb/model/type/misc_helpers"
356
+ autoload :URTransformParamSignatureArray, "pdfrb/model/type/misc_helpers"
357
+ autoload :UniversalArray, "pdfrb/model/type/misc_helpers"
358
+ autoload :UniversalDictionary, "pdfrb/model/type/misc_helpers"
359
+ autoload :OOAdditionalStmsArray, "pdfrb/model/type/misc_helpers"
360
+
361
+ # Stream filter /DecodeParms dictionaries (s7.4).
362
+ autoload :FlateDecodeParms, "pdfrb/model/type/filter_decode_parms"
363
+ autoload :LZWDecodeParms, "pdfrb/model/type/filter_decode_parms"
364
+ autoload :DCTDecodeParms, "pdfrb/model/type/filter_decode_parms"
365
+ autoload :CCITTFaxDecodeParms, "pdfrb/model/type/filter_decode_parms"
366
+ autoload :JBIG2DecodeParms, "pdfrb/model/type/filter_decode_parms"
367
+ autoload :CryptDecodeParms, "pdfrb/model/type/filter_decode_parms"
333
368
 
334
369
  # Explicit destination arrays + maps (s12.3.2).
335
370
  autoload :Destination, "pdfrb/model/type/destination"
data/lib/pdfrb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pdfrb
4
- VERSION = "0.7.32"
4
+ VERSION = "0.7.34"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdfrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.32
4
+ version: 0.7.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-08-23 00:00:00.000000000 Z
11
+ date: 2026-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -1036,6 +1036,7 @@ files:
1036
1036
  - lib/pdfrb/model/type/file_spec_rf.rb
1037
1037
  - lib/pdfrb/model/type/file_specification.rb
1038
1038
  - lib/pdfrb/model/type/file_trailer.rb
1039
+ - lib/pdfrb/model/type/filter_decode_parms.rb
1039
1040
  - lib/pdfrb/model/type/font.rb
1040
1041
  - lib/pdfrb/model/type/font_cid_type0.rb
1041
1042
  - lib/pdfrb/model/type/font_cid_type2.rb