pdfrb 0.7.13 → 0.7.14

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: ebb3cb6d645dd2e4f01dbfdcfc49e51ed0857281fc996a38ddb29afb18aef4e7
4
- data.tar.gz: 9b359396f34164f661bebece73f26dd92fc9ea804c8edd802e53d80c6fccb334
3
+ metadata.gz: 29668fa0363922e98c020c762e0de36fc221ed3667407d70ab68b02bc40bf90e
4
+ data.tar.gz: 10e2c7a8f2f9dd8e43b464cab777ef54e921004ae8a59b89c3c29dfd3c0823db
5
5
  SHA512:
6
- metadata.gz: a3eb6c87f3e7b10fdb310669943b3f61cf206c10f3ad61a998673b83f94dc6aef3082a22ef8f56632dad2e75a858b39c7a969a0590779f8ae3b7320c6c78ff90
7
- data.tar.gz: 9a1453e1556d9c968b3176aa207773e4083687441f7f8025941d82b4f34394a68fba1b3f7a386b4fb73743fb4770ca7c055276f28100b9686f40f6165eb69c76
6
+ metadata.gz: 5b2e9643a1eb44228dccaf6882139060297ebb0bfec23ba33f5e10303d4c477dd562a94b98bc0027ed049f99aac94bf56eae0cf19160cd37ed78825e32422d41
7
+ data.tar.gz: c43041d9ca87df1184b44897a4f5456e3b252e1a3cd604d67d2b6d6d8a1e0c4d4327c6ee01a449f1f16f7b8527098f1b73b7f0132b8aa148393f484617d161e8
@@ -89,7 +89,7 @@ module Pdfrb
89
89
  trusted?: !trusted_certs.empty? && valid,
90
90
  error: valid ? nil : "signature verification failed",
91
91
  )
92
- rescue OpenSSL::PKCS7::PKCS7Error => e
92
+ rescue OpenSSL::PKCS7::PKCS7Error, ArgumentError => e
93
93
  VerificationResult.new(valid?: false,
94
94
  byte_range_ok?: true,
95
95
  cert_chain: [],
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # Thumbnail image stream (ISO 32000-2 §12.3.4). A small image
7
+ # XObject rendered at reduced resolution for use in viewer
8
+ # navigation panels. Attached to a page via the /Thumb key.
9
+ class Thumbnail < Pdfrb::Model::Cos::Stream
10
+ arlington_object "Thumbnail"
11
+
12
+ # /Width — required.
13
+ def width
14
+ value[:Width]
15
+ end
16
+
17
+ # /Height — required.
18
+ def height
19
+ value[:Height]
20
+ end
21
+
22
+ # /ColorSpace — required unless /ImageMask true.
23
+ def color_space
24
+ value[:ColorSpace]
25
+ end
26
+
27
+ # /BitsPerComponent — required.
28
+ def bits_per_component
29
+ value[:BitsPerComponent]
30
+ end
31
+
32
+ # /Filter — optional; a named filter or array of filters.
33
+ def filter
34
+ value[:Filter]
35
+ end
36
+
37
+ def dimensions
38
+ [width, height]
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # Timespan (ISO 32000-2 §12.7.11, PDF 1.5+). A duration with
7
+ # a unit, used in RichMedia timing, 3D animation, and
8
+ # JavaScript-embedded timelines.
9
+ class Timespan < Pdfrb::Model::Cos::Dictionary
10
+ arlington_object "Timespan"
11
+
12
+ # /Type — optional, fixed "Timespan".
13
+ def type
14
+ value[:Type]&.to_sym
15
+ end
16
+
17
+ # /S — required, fixed "S" (seconds).
18
+ def subtype
19
+ value[:S]&.to_sym
20
+ end
21
+
22
+ # /V — required, the numeric duration in seconds.
23
+ def duration
24
+ value[:V]
25
+ end
26
+
27
+ # Convenience: duration in milliseconds.
28
+ def milliseconds
29
+ v = duration
30
+ v ? v.to_f * 1000 : nil
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # UserProperty (ISO 32000-2 §14.7.5). A single property in the
7
+ # /P array of a user property list attached to structure
8
+ # elements for custom metadata.
9
+ class UserProperty < Pdfrb::Model::Cos::Dictionary
10
+ arlington_object "UserProperty"
11
+
12
+ # /N — required, the property name.
13
+ def name
14
+ value[:N]
15
+ end
16
+
17
+ # /V — required, the property value (any COS type).
18
+ def property_value
19
+ value[:V]
20
+ end
21
+
22
+ # /F — optional, a text string with the intended format of
23
+ # the value.
24
+ def format
25
+ value[:F]
26
+ end
27
+
28
+ # /H — optional, whether the property is hidden from the
29
+ # user (default false).
30
+ def hidden?
31
+ value[:H] == true
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # Viewport (ISO 32000-2 §12.7.11, PDF 1.6+). Defines a
7
+ # rectangular region of a page intended for separate display,
8
+ # used for magnifier rectangles, measurement regions, and
9
+ # zoom targets.
10
+ class Viewport < Pdfrb::Model::Cos::Dictionary
11
+ arlington_object "Viewport"
12
+
13
+ # /Type — optional, fixed "Viewport".
14
+ def type
15
+ value[:Type]&.to_sym
16
+ end
17
+
18
+ # /BBox — required, the viewport rectangle.
19
+ def bbox
20
+ value[:BBox]
21
+ end
22
+
23
+ # /Name — optional, human-readable viewport name.
24
+ def name
25
+ value[:Name]
26
+ end
27
+
28
+ # /Measure — optional indirect Measure dict (RL for rulers,
29
+ # GEO for geospatial since PDF 2.0).
30
+ def measure(document = nil)
31
+ ref = value[:Measure]
32
+ return nil unless ref && document
33
+
34
+ ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # VRI (Validation Related Information) dictionary per ETSI EN
7
+ # 319 142-1 (PAdES) §B.5. Lives in /DSS /VRI map, keyed by the
8
+ # hex-encoded SHA-1 of the signature it validates. Holds the
9
+ # certificates, CRLs, and OCSP responses relevant to one
10
+ # signature.
11
+ class Vri < Pdfrb::Model::Cos::Dictionary
12
+ arlington_object "VRI"
13
+
14
+ # /Type — optional, fixed "VRI".
15
+ def type
16
+ value[:Type]&.to_sym
17
+ end
18
+
19
+ # /Cert — array of indirect streams, each a DER-encoded
20
+ # X.509 certificate relevant to the signature.
21
+ def certificates(document = nil)
22
+ refs = value[:Cert]
23
+ return [] unless refs
24
+
25
+ resolve_refs(refs, document)
26
+ end
27
+
28
+ # /CRL — array of indirect streams, each a DER-encoded
29
+ # certificate revocation list.
30
+ def crls(document = nil)
31
+ refs = value[:CRL]
32
+ return [] unless refs
33
+
34
+ resolve_refs(refs, document)
35
+ end
36
+
37
+ # /OCSP — array of indirect streams, each a DER-encoded
38
+ # OCSP response.
39
+ def ocsp_responses(document = nil)
40
+ refs = value[:OCSP]
41
+ return [] unless refs
42
+
43
+ resolve_refs(refs, document)
44
+ end
45
+
46
+ # /TU — optional string-text with a human-readable timestamp.
47
+ def timestamp_text
48
+ value[:TU]
49
+ end
50
+
51
+ # /TS — optional indirect stream with a timestamp token.
52
+ def timestamp_token(document = nil)
53
+ ref = value[:TS]
54
+ return nil unless ref && document
55
+
56
+ ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
57
+ end
58
+
59
+ private
60
+
61
+ def resolve_refs(refs, document)
62
+ return [] unless document
63
+
64
+ arr = refs.is_a?(Pdfrb::Model::PdfArray) ? refs.value : refs
65
+ arr = [arr] unless arr.is_a?(::Array)
66
+ arr.filter_map do |r|
67
+ next r unless r.is_a?(Pdfrb::Model::Reference)
68
+
69
+ document.object(r)
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -356,6 +356,21 @@ module Pdfrb
356
356
 
357
357
  # Page-piece dictionary (s14.5).
358
358
  autoload :PagePieceInfo, "pdfrb/model/type/page_piece_info"
359
+
360
+ # PAdES validation-related information (ETSI EN 319 142-1).
361
+ autoload :Vri, "pdfrb/model/type/vri"
362
+
363
+ # Page thumbnails (s12.3.4).
364
+ autoload :Thumbnail, "pdfrb/model/type/thumbnail"
365
+
366
+ # Timespan (s12.7.11, PDF 1.5+).
367
+ autoload :Timespan, "pdfrb/model/type/timespan"
368
+
369
+ # Viewport (s12.7.11, PDF 1.6+).
370
+ autoload :Viewport, "pdfrb/model/type/viewport"
371
+
372
+ # User property (s14.7.5).
373
+ autoload :UserProperty, "pdfrb/model/type/user_property"
359
374
  end
360
375
  end
361
376
  end
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.13"
4
+ VERSION = "0.7.14"
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.13
4
+ version: 0.7.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -1149,14 +1149,19 @@ files:
1149
1149
  - lib/pdfrb/model/type/three_d_stream.rb
1150
1150
  - lib/pdfrb/model/type/three_d_units.rb
1151
1151
  - lib/pdfrb/model/type/three_d_view.rb
1152
+ - lib/pdfrb/model/type/thumbnail.rb
1153
+ - lib/pdfrb/model/type/timespan.rb
1152
1154
  - lib/pdfrb/model/type/to_unicode_cmap_stream.rb
1153
1155
  - lib/pdfrb/model/type/transition.rb
1154
1156
  - lib/pdfrb/model/type/underline_annotation.rb
1155
1157
  - lib/pdfrb/model/type/ur_transform_parameters.rb
1156
1158
  - lib/pdfrb/model/type/uri_dict.rb
1157
1159
  - lib/pdfrb/model/type/url_alias.rb
1160
+ - lib/pdfrb/model/type/user_property.rb
1158
1161
  - lib/pdfrb/model/type/variable_text_field.rb
1159
1162
  - lib/pdfrb/model/type/viewer_preferences.rb
1163
+ - lib/pdfrb/model/type/viewport.rb
1164
+ - lib/pdfrb/model/type/vri.rb
1160
1165
  - lib/pdfrb/model/type/watermark_annotation.rb
1161
1166
  - lib/pdfrb/model/type/widget_annotation.rb
1162
1167
  - lib/pdfrb/model/type/widget_appearance.rb