pdfrb 0.7.33 → 0.7.35

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: 7df27df1b605b7360c642707bcb6496b6316d52dc7bbf9373acd7127f2098513
4
- data.tar.gz: 121359ec98110dca31e4c3e6f1c11fa00a0a6a3cdf3fa70a2749d2b34566f8c7
3
+ metadata.gz: ad01ecf1a7f70ecba1d47e315442c0bf8f855409126d234734e15f7e577b56ee
4
+ data.tar.gz: f51fd9f743922d396f5b2126cf6ae8e5dc6be4664969dc3f5cfa175642c15309
5
5
  SHA512:
6
- metadata.gz: d6d55dcf0d53c4d21d6bb149affda69999eec6580177a50f8f4dbf6988df3f9933a2c67d16ba3a6acebb4c9a1b376cc05f04641ff5347cd4dd9451502c08a9fd
7
- data.tar.gz: 7080ccf0f4416a5f84214b9a0b83ce673cf9722d9cd4a481998579c370b90f3aa0ce9a608ecd481d6269995221a01769f70eecef4da08b5da6ca9658f5ff28cc
6
+ metadata.gz: a58c6d6ab22846f316597741a0ab027e8b9859cf31e0f59e0e1b4dc99c6c07dcbe35e2d1d6a8aad055e9f8d3287a699a008e5c123b2c65d24cdc2bfab99beafc
7
+ data.tar.gz: a212dc856e1d245030cbabf346a896136c156ba9ef5444c300732974c94dee7c5ef4cb40aed1783cc305e9745b2b6b68fea17c9f9eef3ae8d927294832dc3f54
@@ -54,6 +54,21 @@ module Pdfrb
54
54
  def small_cap?; flags&.anybits?(0x20000); end
55
55
  def force_bold?; flags&.anybits?(0x40000); end
56
56
  end
57
+
58
+ # Font descriptor for TrueType fonts (s9.6.6.2): allows
59
+ # /FontFile2 embedding.
60
+ class FontDescriptorTrueType < FontDescriptor
61
+ arlington_object "FontDescriptorTrueType"
62
+
63
+ def font_file2; self[:FontFile2]; end
64
+ def font_file3; self[:FontFile3]; end
65
+ end
66
+
67
+ # Font descriptor for Type 3 fonts (s9.6.6.2): never carries
68
+ # font-file keys.
69
+ class FontDescriptorType3 < FontDescriptor
70
+ arlington_object "FontDescriptorType3"
71
+ end
57
72
  end
58
73
  end
59
74
  end
@@ -18,6 +18,25 @@ module Pdfrb
18
18
  def type1c?; subtype == :Type1C; end
19
19
  def truetype?; subtype == :TrueType; end
20
20
  end
21
+
22
+ # FontFile3 with /Subtype /Type1C: CFF glyph program for Type 1
23
+ # fonts (s9.6.6.2).
24
+ class FontFile3Type1 < FontFile3
25
+ arlington_object "FontFile3Type1"
26
+ end
27
+
28
+ # FontFile3 with /Subtype /CIDFontType0C: CFF program for CID
29
+ # fonts (s9.7.5.2).
30
+ class FontFile3CIDType0 < FontFile3
31
+ arlington_object "FontFile3CIDType0"
32
+ end
33
+
34
+ # FontFile3 with /Subtype /OpenType: OpenType wrapper whose
35
+ # table directory offsets are relative to the stream start
36
+ # (s9.6.6.4).
37
+ class FontFile3OpenType < FontFile3
38
+ arlington_object "FontFile3OpenType"
39
+ end
21
40
  end
22
41
  end
23
42
  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
@@ -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
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # Soft-mask dictionary /SMask in an ExtGState (s11.6.5.2).
7
+ # The transfer function TR and backdrop color BC apply while
8
+ # compositing the mask group G.
9
+ class SoftMaskAlpha < Pdfrb::Model::Cos::Dictionary
10
+ arlington_object "SoftMaskAlpha"
11
+
12
+ def type; self[:Type]; end
13
+ def subtype; self[:S]; end
14
+ def group; self[:G]; end
15
+ def backdrop_color; self[:BC]; end
16
+ def transfer_function; self[:TR]; end
17
+
18
+ def alpha?; true; end
19
+ def luminosity?; false; end
20
+ end
21
+
22
+ # Luminosity soft mask (s11.6.5.3): the group's luminosity
23
+ # drives the mask.
24
+ class SoftMaskLuminosity < Pdfrb::Model::Cos::Dictionary
25
+ arlington_object "SoftMaskLuminosity"
26
+
27
+ def type; self[:Type]; end
28
+ def subtype; self[:S]; end
29
+ def group; self[:G]; end
30
+ def backdrop_color; self[:BC]; end
31
+ def transfer_function; self[:TR]; end
32
+
33
+ def alpha?; false; end
34
+ def luminosity?; true; end
35
+ end
36
+
37
+ # Resources /ExtGState dictionary (s7.8.3): name ->
38
+ # ExtGState dictionaries.
39
+ class GraphicsStateParameterMap < Pdfrb::Model::Cos::Dictionary
40
+ arlington_object "GraphicsStateParameterMap"
41
+
42
+ def [](name)
43
+ value[name.to_sym] || value[name.to_s]
44
+ end
45
+
46
+ def add(name, parameters)
47
+ value[name.to_sym] = parameters
48
+ name.to_sym
49
+ end
50
+
51
+ def names
52
+ value.keys
53
+ end
54
+ end
55
+
56
+ # Transparency group /Group dictionary (s11.2.4.5): isolation
57
+ # and knockout flags, blending color space.
58
+ class GroupAttributes < Pdfrb::Model::Cos::Dictionary
59
+ arlington_object "GroupAttributes"
60
+
61
+ def type; self[:Type]; end
62
+ def subtype; self[:S]; end
63
+ def color_space; self[:CS]; end
64
+ def isolated?; self[:I] == true; end
65
+ def knockout?; self[:K] == true; end
66
+
67
+ def transparency_group?
68
+ subtype == :Transparency
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -49,6 +49,60 @@ module Pdfrb
49
49
  arr[0] == 1 && arr[1].zero? && arr[2].zero? && arr[3] == 1 && arr[4].zero? && arr[5].zero?
50
50
  end
51
51
  end
52
+
53
+ # PostScript XObject /Subtype /PS (s8.8.2): Level-1 PostScript
54
+ # fallback rendering.
55
+ class XObjectFormPS < Pdfrb::Model::Cos::Stream
56
+ arlington_object "XObjectFormPS"
57
+
58
+ def level1; self[:Level1]; end
59
+ end
60
+
61
+ # PostScript passthrough XObject (s8.8.2, PDF 1.3 PS extension
62
+ # /Subtype2 /PS): embedded PS consumed by passthrough printers.
63
+ class XObjectFormPSpassthrough < Pdfrb::Model::Cos::Stream
64
+ arlington_object "XObjectFormPSpassthrough"
65
+
66
+ def level1; self[:Level1]; end
67
+ def postscript; self[:PS]; end
68
+ end
69
+
70
+ # Printer's mark form XObject (s14.11.4): registration styles.
71
+ class XObjectFormPrinterMark < Pdfrb::Model::Cos::Stream
72
+ arlington_object "XObjectFormPrinterMark"
73
+
74
+ def mark_style; self[:MarkStyle]; end
75
+ def colorants; self[:Colorants]; end
76
+ end
77
+
78
+ # Trap network appearance form XObject (s14.11.2):
79
+ # trapping parameters.
80
+ class XObjectFormTrapNet < Pdfrb::Model::Cos::Stream
81
+ arlington_object "XObjectFormTrapNet"
82
+
83
+ def pcm; self[:PCM]; end
84
+ def separation_color_names; self[:SeparationColorNames]; end
85
+ def trap_regions; self[:TrapRegions]; end
86
+ def trap_styles; self[:TrapStyles]; end
87
+ end
88
+
89
+ # Resources /XObject dictionary (s7.8.3): name -> XObject.
90
+ class XObjectMap < Pdfrb::Model::Cos::Dictionary
91
+ arlington_object "XObjectMap"
92
+
93
+ def [](name)
94
+ value[name.to_sym] || value[name.to_s]
95
+ end
96
+
97
+ def add(name, xobject)
98
+ value[name.to_sym] = xobject
99
+ name.to_sym
100
+ end
101
+
102
+ def names
103
+ value.keys
104
+ end
105
+ end
52
106
  end
53
107
  end
54
108
  end
@@ -64,6 +64,28 @@ module Pdfrb
64
64
  ((width * components * bits_per_component) + 7) / 8
65
65
  end
66
66
  end
67
+
68
+ # Image-mask image XObject /ImageMask true (s8.9.6.4):
69
+ # 1-bpp stencil painted with the current fill color.
70
+ class XObjectImageMask < Pdfrb::Model::Cos::Stream
71
+ arlington_object "XObjectImageMask"
72
+
73
+ def width; self[:Width]; end
74
+ def height; self[:Height]; end
75
+ def decode; self[:Decode]; end
76
+
77
+ # /Decode [0 1] = paint 1-bits; [1 0] = inverted.
78
+ def inverted?; decode && decode[0] == 1; end
79
+ end
80
+
81
+ # Soft-mask image XObject (s8.9.6.5): grayscale companion used
82
+ # as a shape/opacity mask via /SMask.
83
+ class XObjectImageSoftMask < Pdfrb::Model::Cos::Stream
84
+ arlington_object "XObjectImageSoftMask"
85
+
86
+ def color_space; self[:ColorSpace]; end
87
+ def matte; self[:Matte]; end
88
+ end
67
89
  end
68
90
  end
69
91
  end
@@ -121,6 +121,22 @@ module Pdfrb
121
121
  autoload :FontDescriptorCIDType2, "pdfrb/model/type/font_descriptor_cid_type2"
122
122
  autoload :ToUnicodeCMapStream, "pdfrb/model/type/to_unicode_cmap_stream"
123
123
  autoload :XObjectForm, "pdfrb/model/type/xobject_form"
124
+ autoload :XObjectFormPS, "pdfrb/model/type/xobject_form"
125
+ autoload :XObjectFormPSpassthrough, "pdfrb/model/type/xobject_form"
126
+ autoload :XObjectFormPrinterMark, "pdfrb/model/type/xobject_form"
127
+ autoload :XObjectFormTrapNet, "pdfrb/model/type/xobject_form"
128
+ autoload :XObjectMap, "pdfrb/model/type/xobject_form"
129
+ autoload :XObjectImageMask, "pdfrb/model/type/xobject_image"
130
+ autoload :XObjectImageSoftMask, "pdfrb/model/type/xobject_image"
131
+ autoload :FontFile3Type1, "pdfrb/model/type/font_file3"
132
+ autoload :FontFile3CIDType0, "pdfrb/model/type/font_file3"
133
+ autoload :FontFile3OpenType, "pdfrb/model/type/font_file3"
134
+ autoload :FontDescriptorTrueType, "pdfrb/model/type/font_descriptor"
135
+ autoload :FontDescriptorType3, "pdfrb/model/type/font_descriptor"
136
+ autoload :SoftMaskAlpha, "pdfrb/model/type/soft_mask"
137
+ autoload :SoftMaskLuminosity, "pdfrb/model/type/soft_mask"
138
+ autoload :GraphicsStateParameterMap, "pdfrb/model/type/soft_mask"
139
+ autoload :GroupAttributes, "pdfrb/model/type/soft_mask"
124
140
  autoload :XObjectImage, "pdfrb/model/type/xobject_image"
125
141
 
126
142
  # Function family (s8.9).
@@ -311,6 +327,19 @@ module Pdfrb
311
327
  autoload :AppearanceSubDict, "pdfrb/model/type/appearance_trap_net"
312
328
  autoload :MediaClip, "pdfrb/model/type/media_clip"
313
329
  autoload :Rendition, "pdfrb/model/type/rendition"
330
+ autoload :RenditionMedia, "pdfrb/model/type/rendition"
331
+ autoload :RenditionSelector, "pdfrb/model/type/rendition"
332
+ autoload :RenditionMH, "pdfrb/model/type/rendition"
333
+ autoload :RenditionBE, "pdfrb/model/type/rendition"
334
+ autoload :MediaClipDataMHBE, "pdfrb/model/type/media_clip"
335
+ autoload :MediaClipSection, "pdfrb/model/type/media_clip"
336
+ autoload :MediaClipSectionMHBE, "pdfrb/model/type/media_clip"
337
+ autoload :MediaDuration, "pdfrb/model/type/media_clip"
338
+ autoload :MediaPermissions, "pdfrb/model/type/media_clip"
339
+ autoload :MediaPlayParameters, "pdfrb/model/type/media_offset"
340
+ autoload :MediaPlayParametersMH, "pdfrb/model/type/media_offset"
341
+ autoload :MediaPlayParametersBE, "pdfrb/model/type/media_offset"
342
+ autoload :MediaScreenParametersMHBE, "pdfrb/model/type/media_offset"
314
343
  autoload :ExDataProjection, "pdfrb/model/type/projection_annotation"
315
344
  autoload :AnnotationProjectionDict, "pdfrb/model/type/projection_annotation"
316
345
 
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.33"
4
+ VERSION = "0.7.35"
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.33
4
+ version: 0.7.35
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
@@ -1143,6 +1143,7 @@ files:
1143
1143
  - lib/pdfrb/model/type/signature.rb
1144
1144
  - lib/pdfrb/model/type/signature_build.rb
1145
1145
  - lib/pdfrb/model/type/signature_field.rb
1146
+ - lib/pdfrb/model/type/soft_mask.rb
1146
1147
  - lib/pdfrb/model/type/software_identifier.rb
1147
1148
  - lib/pdfrb/model/type/sound.rb
1148
1149
  - lib/pdfrb/model/type/sound_annotation.rb