pdfrb 0.7.28 → 0.7.30

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: 25c630de168e6133c0d6c4609497b0597b5c49f0d53aab6f7d3d5a4eccabd590
4
- data.tar.gz: 45b3b1b3282360ed16de7def80637d4971355186c3ad73c1b3f1e692b8f980bb
3
+ metadata.gz: 83af6e7d49d84f03ca76b743164b0b4116c259d08719287cf9248afd0affd5ec
4
+ data.tar.gz: 5a4de5047f8b57c96543d73a3cafb6903cadb965f1877a4aecef42d57247a5ff
5
5
  SHA512:
6
- metadata.gz: f0e3341af81cbae71287d50d5b012f44f80fceb835019a052d50b8cf87d668ec7afd777dce003016dea285c920f18fc52bc703dae29cd01e3479bea6d631dda5
7
- data.tar.gz: a3a270489cca673f4ef25ea3c874776373b8aa516f5ce7c5163194d976a86fa1305d9fcfe22412838d5ed2119af2f15010c2b008bc0b36a1d0d811236db83339
6
+ metadata.gz: 5a99b5fc62f8f4503577e598996fdc55216a9935da101d1b2c1ab03e5d6931db606938385132b3bbe81c573dcea5439e6bbb006ed51e5ef30333626382da3f3b
7
+ data.tar.gz: 1f4b6b491db49a6852e358901e2539c40609caccf8a01a3e0948f10d3fe7fbc09f5a810947acb719c35c285bf90c7ca6d9a51a6718985b002c3b09aa3d891b46
@@ -3,13 +3,19 @@
3
3
  module Pdfrb
4
4
  module Model
5
5
  module Type
6
- # DeviceN color space (s8.6.6.4). Multiple custom colorants mapped
7
- # through a single tint-transform function. Generalises Separation.
6
+ # DeviceN attributes dictionary (s8.6.6.4, the 5th element of
7
+ # the DeviceN color space array). Names extra colorants and
8
+ # process/mixing hints.
8
9
  class DeviceN < Pdfrb::Model::Cos::Dictionary
9
- def colorants; self[:Names]; end
10
- def alternate_space; self[:AlternateSpace]; end
11
- def tint_transform; self[:TintTransform]; end
12
- def attributes; self[:Attributes]; end
10
+ arlington_object "DeviceNDict"
11
+ def subtype; self[:Subtype]&.to_sym; end
12
+ def colorants; self[:Colorants]; end
13
+ def process; self[:Process]; end
14
+ def mixing_hints; self[:MixingHints]; end
15
+
16
+ def nchannel?
17
+ subtype == :NChannel
18
+ end
13
19
 
14
20
  def colorant_count
15
21
  return 0 unless colorants
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # DeviceN Mixing Hints (s8.6.6.5). Per-colorant device hints.
7
7
  class DeviceNMixingHints < Pdfrb::Model::Cos::Dictionary
8
+ arlington_object "DeviceNMixingHints"
8
9
  def solidities; self[:Solidities]; end
9
10
  def dot_gain; self[:DotGain]; end
10
11
 
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # DeviceN Process (s8.6.6.4). Process colorant list.
7
7
  class DeviceNProcess < Pdfrb::Model::Cos::Dictionary
8
+ arlington_object "DeviceNProcess"
8
9
  def color_space; self[:ColorSpace]; end
9
10
  def components; self[:Components]; end
10
11
  end
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # IconFit (s12.5.6.19). Controls positioning/scaling of a button
7
7
  # field's icon within its rectangle.
8
8
  class IconFit < Cos::Dictionary
9
+ arlington_object "IconFit"
9
10
  register_type :IconFit
10
11
 
11
12
  def type; self[:Type]; end
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # MarkInformation (s14.7.1). Catalog /MarkInfo — flags whether
7
7
  # the document is tagged and structural metadata is reliable.
8
8
  class MarkInformation < Cos::Dictionary
9
+ arlington_object "MarkInfo"
9
10
  register_type :MarkInfo
10
11
 
11
12
  def type; self[:Type]; end
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # Measure dictionary (s11.4). Used by line/poly annotations and
7
7
  # XObjects to map PDF units to real-world units.
8
8
  class Measure < Cos::Dictionary
9
+ arlington_object "MeasureRL"
9
10
  register_type :Measure
10
11
 
11
12
  def type; self[:Type]; end
@@ -34,6 +35,28 @@ module Pdfrb
34
35
  !!area_format
35
36
  end
36
37
  end
38
+
39
+ # Geospatial Measure dictionary (s11.4, /Subtype /GEO with
40
+ # GCS/DCS). Maps geographic coordinates onto page geometry.
41
+ class GeospatialMeasure < Pdfrb::Model::Cos::Dictionary
42
+ arlington_object "MeasureGEO"
43
+
44
+ def type; self[:Type]; end
45
+ def subtype; self[:Subtype]; end
46
+ def bounds; self[:Bounds]; end
47
+ def geographic_coordinate_system; self[:GCS]; end
48
+ def projected_coordinate_system; self[:DCS]; end
49
+ def pdu; self[:PDU]; end
50
+ def gpts; self[:GPTS]; end
51
+ def lpts; self[:LPTS]; end
52
+ def pcsm; self[:PCSM]; end
53
+
54
+ def bound_count
55
+ arr = bounds
56
+ arr = arr.to_a if arr.is_a?(Pdfrb::Model::PdfArray)
57
+ arr&.size
58
+ end
59
+ end
37
60
  end
38
61
  end
39
62
  end
@@ -7,6 +7,7 @@ module Pdfrb
7
7
  # which OCGs to enable when the user views/prints/exports the
8
8
  # document.
9
9
  class OptContentUsageApplication < Pdfrb::Model::Cos::Dictionary
10
+ arlington_object "OptContentUsageApplication"
10
11
  def event; self[:Event]&.to_sym; end
11
12
  def ocgs; self[:OCGs]; end
12
13
  def category; self[:Category]; end
@@ -30,6 +31,7 @@ module Pdfrb
30
31
  # Optional Content Creator Info dict (s8.11.2.2). Attribution
31
32
  # for who created a layer.
32
33
  class OptContentCreatorInfo < Pdfrb::Model::Cos::Dictionary
34
+ arlington_object "OptContentCreatorInfo"
33
35
  def creator; self[:Creator]; end
34
36
  def subtitle; self[:Subtitle]; end
35
37
  def creator_app_version; self[:CreatorAppVersion]; end
@@ -42,6 +44,7 @@ module Pdfrb
42
44
  # Optional Content Export dict (s8.11.2.3). Specific OCG toggle
43
45
  # for the export workflow.
44
46
  class OptContentExport < Pdfrb::Model::Cos::Dictionary
47
+ arlington_object "OptContentExport"
45
48
  def export_ocgs; self[:ExportOCGs]; end
46
49
  def intent; self[:Intent]&.to_sym; end
47
50
 
@@ -57,6 +60,7 @@ module Pdfrb
57
60
  # Optional Content Print dict (s8.11.2.4). Similar to Export but
58
61
  # for the printing workflow.
59
62
  class OptContentPrint < Pdfrb::Model::Cos::Dictionary
63
+ arlington_object "OptContentPrint"
60
64
  def print_ocgs; self[:PrintOCGs]; end
61
65
  def print_state; self[:PrintState]&.to_sym; end
62
66
 
@@ -67,6 +71,7 @@ module Pdfrb
67
71
 
68
72
  # Optional Content View dict (s8.11.2.5). Per-view OCG visibility.
69
73
  class OptContentView < Pdfrb::Model::Cos::Dictionary
74
+ arlington_object "OptContentView"
70
75
  def view_name; self[:Name]; end
71
76
  def view_state_name; self[:ViewState]; end
72
77
  end
@@ -74,6 +79,7 @@ module Pdfrb
74
79
  # Optional Content Language dict (s8.11.2.6). Maps OCG to natural
75
80
  # language for preference-based visibility.
76
81
  class OptContentLanguage < Pdfrb::Model::Cos::Dictionary
82
+ arlington_object "OptContentLanguage"
77
83
  def language_string; self[:Lang]; end
78
84
  def ocgs; self[:OCGs]; end
79
85
  def preferred; self[:Preferred] || 0; end
@@ -89,6 +95,22 @@ module Pdfrb
89
95
  end
90
96
  end
91
97
  end
98
+
99
+ # /Usage /User entry (s8.11.4.4). Intended consumer of the
100
+ # group.
101
+ class OptContentUser < Pdfrb::Model::Cos::Dictionary
102
+ arlington_object "OptContentUser"
103
+
104
+ def name; self[:Name]; end
105
+ end
106
+
107
+ # /Usage /Zoom entry (s8.11.4.4). Zoom-range visibility.
108
+ class OptContentZoom < Pdfrb::Model::Cos::Dictionary
109
+ arlington_object "OptContentZoom"
110
+
111
+ def min; self[:min]; end
112
+ def max; self[:max]; end
113
+ end
92
114
  end
93
115
  end
94
116
  end
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # Opt Content Page Element (s8.11). Marks page elements for
7
7
  # automatic optional-content group creation.
8
8
  class OptContentPageElement < Pdfrb::Model::Cos::Dictionary
9
+ arlington_object "OptContentPageElement"
9
10
  def subtype; self[:Subtype]&.to_sym; end
10
11
  def ocgs; self[:OCGs]; end
11
12
 
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # Optional Content Configuration (s8.11.4.1). Per-view configuration
7
7
  # of OCG visibility, intent, and locking.
8
8
  class OptionalContentConfiguration < Cos::Dictionary
9
+ arlington_object "OptContentConfig"
9
10
  register_type :OCConfig
10
11
 
11
12
  def type; self[:Type]; end
@@ -12,6 +12,7 @@ module Pdfrb
12
12
  # Conforming readers MUST NOT interpret application-private
13
13
  # data; it survives round-trips and incremental updates intact.
14
14
  class PagePieceInfo < Pdfrb::Model::Cos::Dictionary
15
+ arlington_object "PagePiece"
15
16
  # The application-name key (e.g. :Adobe, :Pdfrb). Multiple
16
17
  # applications may each have their own entry in the same
17
18
  # /PieceInfo dict.
@@ -11,6 +11,31 @@ module Pdfrb
11
11
  def tiling?; pattern_type == 1; end
12
12
  def shading?; pattern_type == 2; end
13
13
  end
14
+
15
+ # Resources /Pattern dictionary (s7.8.5). Maps resource names
16
+ # to patterns.
17
+ class PatternMap < Pdfrb::Model::Cos::Dictionary
18
+ arlington_object "PatternMap"
19
+
20
+ def [](name)
21
+ value[name.to_sym] || value[name.to_s]
22
+ end
23
+
24
+ def add(name, pattern)
25
+ value[name.to_sym] = pattern
26
+ name.to_sym
27
+ end
28
+
29
+ def each_pattern(&)
30
+ return enum_for(:each_pattern) unless block_given?
31
+
32
+ value.each(&)
33
+ end
34
+
35
+ def names
36
+ value.keys
37
+ end
38
+ end
14
39
  end
15
40
  end
16
41
  end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Type 2 shading pattern (s8.7.4.1). Fills with a Shading dict.
7
7
  class PatternShading < Pattern
8
+ arlington_object "PatternType2"
8
9
  def shading; self[:Shading]; end
9
10
  def matrix; self[:Matrix]; end
10
11
  def ext_g_state; self[:ExtGState]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Type 1 tiling pattern (s8.7.3). Repeats a graphical cell.
7
7
  class PatternTiling < Pattern
8
+ arlington_object "PatternType1"
8
9
  def paint_type; self[:PaintType]; end
9
10
  def tiling_type; self[:TilingType]; end
10
11
  def bbox; self[:BBox]; end
@@ -7,11 +7,11 @@ module Pdfrb
7
7
  # mapped through a tint-transform function. Used for spot colors
8
8
  # like PANTONE 185 C.
9
9
  class Separation < Pdfrb::Model::Cos::Dictionary
10
- def alternate_space; self[:AlternateSpace]; end
11
- def tint_transform; self[:TintTransform]; end
12
- def colorant_name; self[:Colorant]; end
13
-
14
- def components; 1; end
10
+ arlington_object "Separation"
11
+ def color_space; self[:ColorSpace]; end
12
+ def device_colorant; self[:DeviceColorant]; end
13
+ def key; self[:Key]; end
14
+ def pages; self[:Pages]; end
15
15
 
16
16
  def resolved_tint_transform
17
17
  ref = tint_transform
@@ -0,0 +1,141 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # Common keys and type predicates shared by dict-based and
7
+ # stream-based shadings (s8.7.4.1).
8
+ module ShadingCommon
9
+ def shading_type; self[:ShadingType]; end
10
+ def color_space; self[:ColorSpace]; end
11
+ def background; self[:Background]; end
12
+ def bbox; self[:BBox]; end
13
+ def anti_alias?; self[:AntiAlias] == true; end
14
+ def domain; self[:Domain]; end
15
+ def function; self[:Function]; end
16
+
17
+ def function_based?; shading_type == 1; end
18
+ def axial?; shading_type == 2; end
19
+ def radial?; shading_type == 3; end
20
+ def free_form_gouraud?; shading_type == 4; end
21
+ def lattice_gouraud?; shading_type == 5; end
22
+ def coons_patch?; shading_type == 6; end
23
+ def tensor_patch?; shading_type == 7; end
24
+ end
25
+
26
+ class Shading < Pdfrb::Model::Cos::Dictionary
27
+ include ShadingCommon
28
+ end
29
+
30
+ # Type 1 — function-based shading (s8.7.4.2).
31
+ class ShadingType1 < Shading
32
+ arlington_object "ShadingType1"
33
+
34
+ def matrix; self[:Matrix]; end
35
+ end
36
+
37
+ # Type 2 — axial shading (s8.7.4.3).
38
+ class ShadingType2 < Shading
39
+ arlington_object "ShadingType2"
40
+
41
+ def coords; self[:Coords]; end
42
+ def extend; self[:Extend]; end
43
+
44
+ def x0; coords && coords[0]; end
45
+ def x1; coords && coords[2]; end
46
+ def y0; coords && coords[1]; end
47
+ def y1; coords && coords[3]; end
48
+
49
+ def extends_start?; extend && extend[0] == true; end
50
+ def extends_end?; extend && extend[1] == true; end
51
+ end
52
+
53
+ # Type 3 — radial shading (s8.7.4.4).
54
+ class ShadingType3 < Shading
55
+ arlington_object "ShadingType3"
56
+
57
+ def coords; self[:Coords]; end
58
+ def extend; self[:Extend]; end
59
+
60
+ # [x0 y0 r0 x1 y1 r1].
61
+ def r0; coords && coords[2]; end
62
+ def r1; coords && coords[5]; end
63
+ end
64
+
65
+ # Type 4 — free-form Gouraud-shaded triangle mesh
66
+ # (s8.7.4.6.3). Stream carrying vertex data.
67
+ class ShadingType4 < Pdfrb::Model::Cos::Stream
68
+ include ShadingCommon
69
+
70
+ arlington_object "ShadingType4"
71
+
72
+ def bits_per_coordinate; self[:BitsPerCoordinate]; end
73
+ def bits_per_component; self[:BitsPerComponent]; end
74
+ def bits_per_flag; self[:BitsPerFlag]; end
75
+ def decode; self[:Decode]; end
76
+ end
77
+
78
+ # Type 5 — lattice Gouraud-shaded triangle mesh
79
+ # (s8.7.4.6.4).
80
+ class ShadingType5 < Pdfrb::Model::Cos::Stream
81
+ include ShadingCommon
82
+
83
+ arlington_object "ShadingType5"
84
+
85
+ def bits_per_coordinate; self[:BitsPerCoordinate]; end
86
+ def bits_per_component; self[:BitsPerComponent]; end
87
+ def vertices_per_row; self[:VerticesPerRow]; end
88
+ def decode; self[:Decode]; end
89
+ end
90
+
91
+ # Type 6 — Coons patch mesh (s8.7.4.7.4).
92
+ class ShadingType6 < Pdfrb::Model::Cos::Stream
93
+ include ShadingCommon
94
+
95
+ arlington_object "ShadingType6"
96
+
97
+ def bits_per_coordinate; self[:BitsPerCoordinate]; end
98
+ def bits_per_component; self[:BitsPerComponent]; end
99
+ def bits_per_flag; self[:BitsPerFlag]; end
100
+ def decode; self[:Decode]; end
101
+ end
102
+
103
+ # Type 7 — tensor-product patch mesh (s8.7.4.7.5).
104
+ class ShadingType7 < Pdfrb::Model::Cos::Stream
105
+ include ShadingCommon
106
+
107
+ arlington_object "ShadingType7"
108
+
109
+ def bits_per_coordinate; self[:BitsPerCoordinate]; end
110
+ def bits_per_component; self[:BitsPerComponent]; end
111
+ def bits_per_flag; self[:BitsPerFlag]; end
112
+ def decode; self[:Decode]; end
113
+ end
114
+
115
+ # Resources /Shading dictionary (s7.8.4). Maps resource names
116
+ # to shadings.
117
+ class ShadingMap < Pdfrb::Model::Cos::Dictionary
118
+ arlington_object "ShadingMap"
119
+
120
+ def [](name)
121
+ value[name.to_sym] || value[name.to_s]
122
+ end
123
+
124
+ def add(name, shading)
125
+ value[name.to_sym] = shading
126
+ name.to_sym
127
+ end
128
+
129
+ def each_shading(&)
130
+ return enum_for(:each_shading) unless block_given?
131
+
132
+ value.each(&)
133
+ end
134
+
135
+ def names
136
+ value.keys
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # UR Transform Parameters (s12.8.2.3). Adobe Reader-enabled
7
7
  # usage rights — annotations, form fill-in, signatures allowed.
8
8
  class URTransformParameters < Pdfrb::Model::Cos::Dictionary
9
+ arlington_object "URTransformParameters"
9
10
  def type; self[:Type]; end
10
11
  def annotations; self[:Annots]; end
11
12
  def form; self[:Form]; end
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # URI dict (s12.5.6.5). Catalog /URI dict for base URI and
7
7
  # retriever map.
8
8
  class URIDict < Pdfrb::Model::Cos::Dictionary
9
+ arlington_object "URI"
9
10
  def base; self[:Base]; end
10
11
  def retriever_map; self[:Map]; end
11
12
 
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # URL Alias (s7.9.6). Names dictionary entry mapping friendly
7
7
  # URLs to actual URLs for collection sub-items.
8
8
  class URLAlias < Pdfrb::Model::Cos::Dictionary
9
+ arlington_object "URLAlias"
9
10
  def type; self[:Type]; end
10
11
  def alias_value; self[:U]; end
11
12
  def url; self[:URL]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # ViewerPreferences (s12.2, ISO 32000-2 7.7.2). Catalog /ViewerPreferences.
7
7
  class ViewerPreferences < Cos::Dictionary
8
+ arlington_object "ViewerPreferences"
8
9
  register_type :ViewerPreferences
9
10
 
10
11
  def type; self[:Type]; end
@@ -71,6 +71,8 @@ module Pdfrb
71
71
  autoload :OptContentLanguage, "pdfrb/model/type/opt_content_ext"
72
72
  autoload :OptContentUsageApplication, "pdfrb/model/type/opt_content_ext"
73
73
  autoload :OptContentPageElement, "pdfrb/model/type/opt_content_page_element"
74
+ autoload :OptContentUser, "pdfrb/model/type/opt_content_ext"
75
+ autoload :OptContentZoom, "pdfrb/model/type/opt_content_ext"
74
76
 
75
77
  autoload :FileSpecification, "pdfrb/model/type/file_specification"
76
78
  autoload :FileSpecEF, "pdfrb/model/type/file_spec_ef"
@@ -95,6 +97,7 @@ module Pdfrb
95
97
  autoload :VariableTextField, "pdfrb/model/type/variable_text_field"
96
98
  autoload :DocumentSecurityStore, "pdfrb/model/type/document_security_store"
97
99
  autoload :Measure, "pdfrb/model/type/measure"
100
+ autoload :GeospatialMeasure, "pdfrb/model/type/measure"
98
101
  autoload :OptionalContentConfiguration, "pdfrb/model/type/optional_content_config"
99
102
  autoload :MarkedContentReference, "pdfrb/model/type/marked_content_reference"
100
103
  autoload :AppearanceGenerator, "pdfrb/model/type/appearance_generator"
@@ -150,6 +153,19 @@ module Pdfrb
150
153
  autoload :Pattern, "pdfrb/model/type/pattern"
151
154
  autoload :PatternTiling, "pdfrb/model/type/pattern_tiling"
152
155
  autoload :PatternShading, "pdfrb/model/type/pattern_shading"
156
+ autoload :PatternMap, "pdfrb/model/type/pattern"
157
+
158
+ # Shading family (s8.7.4).
159
+ autoload :ShadingCommon, "pdfrb/model/type/shading"
160
+ autoload :Shading, "pdfrb/model/type/shading"
161
+ autoload :ShadingType1, "pdfrb/model/type/shading"
162
+ autoload :ShadingType2, "pdfrb/model/type/shading"
163
+ autoload :ShadingType3, "pdfrb/model/type/shading"
164
+ autoload :ShadingType4, "pdfrb/model/type/shading"
165
+ autoload :ShadingType5, "pdfrb/model/type/shading"
166
+ autoload :ShadingType6, "pdfrb/model/type/shading"
167
+ autoload :ShadingType7, "pdfrb/model/type/shading"
168
+ autoload :ShadingMap, "pdfrb/model/type/shading"
153
169
 
154
170
  # Font family.
155
171
  autoload :Font, "pdfrb/model/type/font"
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.28"
4
+ VERSION = "0.7.30"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdfrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.28
4
+ version: 0.7.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -1135,6 +1135,7 @@ files:
1135
1135
  - lib/pdfrb/model/type/rich_media_window.rb
1136
1136
  - lib/pdfrb/model/type/screen_annotation.rb
1137
1137
  - lib/pdfrb/model/type/separation.rb
1138
+ - lib/pdfrb/model/type/shading.rb
1138
1139
  - lib/pdfrb/model/type/sig_field_lock.rb
1139
1140
  - lib/pdfrb/model/type/sig_field_seed_value.rb
1140
1141
  - lib/pdfrb/model/type/signature.rb