pdfrb 0.7.32 → 0.7.33
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 +4 -4
- data/lib/pdfrb/model/cos/dictionary.rb +4 -1
- data/lib/pdfrb/model/type/filter_decode_parms.rb +76 -0
- data/lib/pdfrb/model/type/misc_helpers.rb +110 -0
- data/lib/pdfrb/model/type.rb +22 -0
- data/lib/pdfrb/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7df27df1b605b7360c642707bcb6496b6316d52dc7bbf9373acd7127f2098513
|
|
4
|
+
data.tar.gz: 121359ec98110dca31e4c3e6f1c11fa00a0a6a3cdf3fa70a2749d2b34566f8c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d6d55dcf0d53c4d21d6bb149affda69999eec6580177a50f8f4dbf6988df3f9933a2c67d16ba3a6acebb4c9a1b376cc05f04641ff5347cd4dd9451502c08a9fd
|
|
7
|
+
data.tar.gz: 7080ccf0f4416a5f84214b9a0b83ce673cf9722d9cd4a481998579c370b90f3aa0ce9a608ecd481d6269995221a01769f70eecef4da08b5da6ca9658f5ff28cc
|
|
@@ -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
|
|
@@ -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
|
data/lib/pdfrb/model/type.rb
CHANGED
|
@@ -330,6 +330,28 @@ module Pdfrb
|
|
|
330
330
|
autoload :DestOutputProfileRef, "pdfrb/model/type/misc_helpers"
|
|
331
331
|
autoload :OutputIntentsContainer, "pdfrb/model/type/misc_helpers"
|
|
332
332
|
autoload :CMapStream, "pdfrb/model/type/misc_helpers"
|
|
333
|
+
autoload :GammaArray, "pdfrb/model/type/misc_helpers"
|
|
334
|
+
autoload :WhitepointArray, "pdfrb/model/type/misc_helpers"
|
|
335
|
+
autoload :TrailerIDArray, "pdfrb/model/type/misc_helpers"
|
|
336
|
+
autoload :VisibilityExpressionArray, "pdfrb/model/type/misc_helpers"
|
|
337
|
+
autoload :RelatedFilesArray, "pdfrb/model/type/misc_helpers"
|
|
338
|
+
autoload :RichMediaCommandArray, "pdfrb/model/type/misc_helpers"
|
|
339
|
+
autoload :URTransformParamArray, "pdfrb/model/type/misc_helpers"
|
|
340
|
+
autoload :URTransformParamAnnotsArray, "pdfrb/model/type/misc_helpers"
|
|
341
|
+
autoload :URTransformParamEFArray, "pdfrb/model/type/misc_helpers"
|
|
342
|
+
autoload :URTransformParamFormArray, "pdfrb/model/type/misc_helpers"
|
|
343
|
+
autoload :URTransformParamSignatureArray, "pdfrb/model/type/misc_helpers"
|
|
344
|
+
autoload :UniversalArray, "pdfrb/model/type/misc_helpers"
|
|
345
|
+
autoload :UniversalDictionary, "pdfrb/model/type/misc_helpers"
|
|
346
|
+
autoload :OOAdditionalStmsArray, "pdfrb/model/type/misc_helpers"
|
|
347
|
+
|
|
348
|
+
# Stream filter /DecodeParms dictionaries (s7.4).
|
|
349
|
+
autoload :FlateDecodeParms, "pdfrb/model/type/filter_decode_parms"
|
|
350
|
+
autoload :LZWDecodeParms, "pdfrb/model/type/filter_decode_parms"
|
|
351
|
+
autoload :DCTDecodeParms, "pdfrb/model/type/filter_decode_parms"
|
|
352
|
+
autoload :CCITTFaxDecodeParms, "pdfrb/model/type/filter_decode_parms"
|
|
353
|
+
autoload :JBIG2DecodeParms, "pdfrb/model/type/filter_decode_parms"
|
|
354
|
+
autoload :CryptDecodeParms, "pdfrb/model/type/filter_decode_parms"
|
|
333
355
|
|
|
334
356
|
# Explicit destination arrays + maps (s12.3.2).
|
|
335
357
|
autoload :Destination, "pdfrb/model/type/destination"
|
data/lib/pdfrb/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.7.33
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -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
|