pdfrb 0.7.20 → 0.7.21

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: a799578418324e198b38930d7dce57663503478adb1b529c608d58183f84f183
4
- data.tar.gz: 94b49f8a02ce9845ad283afa39ec4224ce0ecef9240919c21909e38f18f52ccd
3
+ metadata.gz: 8fede6fc181df1691732c051b8339ee2bded64c7f393691fd9dd5b0f151082e9
4
+ data.tar.gz: a602406104c68a47a6d5ddca09fedaa12831528c9cb603a9dab0a123f171004f
5
5
  SHA512:
6
- metadata.gz: 1d2bdf98564008508094b7c6165160541419331edd629f2dd836dc4632b1f99830e0b8d3b9490cd3395ebc5e0674c40f8ce99bf42b079ff9f8ab7c3b13e8180a
7
- data.tar.gz: 984567fb69359980624147608deeeed46c9a345a0ec4f97158924629d1bf78f8c3a6be5dba5cfc1c6a36d930865a55d33a5c5d0fa17922fb4c16726d1142f037
6
+ metadata.gz: 7822801383bb40e5d381f4b10801de93b3271304ff2b748ca6a2e1182de9620c5694920c1ddfa4d4bfceb15033fa6b6e069addb76fcdc1721c3ccde104da226d
7
+ data.tar.gz: 94a2bbcb98addcb843be49ffdce5a75e693f34f7384106c8036f6247b66751c760176a55b55b6e407d24935ff26f1700512da96a827ef2d0e02ca70e8a9e48e2
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # Additional Actions on a page object (ISO 32000-2 §12.6.3.16,
7
+ # PDF 1.2+). /O fires on page open, /C on page close.
8
+ class AddActionPageObject < Pdfrb::Model::Cos::Dictionary
9
+ arlington_object "AddActionPageObject"
10
+
11
+ # /O — action(s) on page open.
12
+ def on_open(document = nil)
13
+ resolve_action(:O, document)
14
+ end
15
+
16
+ # /C — action(s) on page close.
17
+ def on_close(document = nil)
18
+ resolve_action(:C, document)
19
+ end
20
+
21
+ private
22
+
23
+ def resolve_action(key, document)
24
+ ref = value[key]
25
+ return nil unless ref && document
26
+
27
+ ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -3,13 +3,14 @@
3
3
  module Pdfrb
4
4
  module Model
5
5
  module Type
6
- # BorderEffect (s12.5.4.2). Cloudy / inset border effects for
7
- # annotations.
8
- class BorderEffect < Cos::Dictionary
6
+ # BorderEffect (ISO 32000-2 §12.5.4.2, PDF 1.5+). Cloudy /
7
+ # inset border effects for annotations, via the /BE dict.
8
+ class BorderEffect < Pdfrb::Model::Cos::Dictionary
9
+ arlington_object "BorderEffect"
9
10
  register_type :BorderEffect
10
11
 
11
12
  def type; self[:Type]; end
12
- def style; self[:S]&.to_sym; end
13
+ def style; (self[:S] || :S).to_sym; end
13
14
  def intensity; self[:I] || 0; end
14
15
 
15
16
  def cloudy?
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # BorderStyle (ISO 32000-2 §12.5.4, PDF 1.2+). The /BS dict on
7
+ # an annotation, controlling line width, style, and dash
8
+ # pattern.
9
+ class BorderStyle < Pdfrb::Model::Cos::Dictionary
10
+ arlington_object "BorderStyle"
11
+
12
+ # /W — optional, border width in points (default 1).
13
+ def width
14
+ value[:W] || 1
15
+ end
16
+
17
+ # /S — optional, border style name (default :S).
18
+ # S = solid, D = dashed, B = beveled, I = inset, U = underline.
19
+ def style
20
+ (value[:S] || :S).to_sym
21
+ end
22
+
23
+ # /D — optional, dash pattern array (only when style == :D).
24
+ def dash
25
+ value[:D]
26
+ end
27
+
28
+ def solid?; style == :S; end
29
+ def dashed?; style == :D; end
30
+ def beveled?; style == :B; end
31
+ def inset?; style == :I; end
32
+ def underline?; style == :U; end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -7,6 +7,7 @@ module Pdfrb
7
7
  # its Character ID system: registry, ordering, supplement.
8
8
  # Required for proper glyph interpretation.
9
9
  class CIDSystemInfo < Pdfrb::Model::Cos::Dictionary
10
+ arlington_object "CIDSystemInfo"
10
11
  def registry; self[:Registry]; end
11
12
  def ordering; self[:Ordering]; end
12
13
  def supplement; self[:Supplement]; end
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # Movie dictionary (s13.4). Deprecated since PDF 2.0 but still
7
7
  # appears in legacy PDFs. Use Screen + Rendition actions instead.
8
8
  class Movie < Pdfrb::Model::Cos::Dictionary
9
+ arlington_object "Movie"
9
10
  def type; self[:Type]; end
10
11
  def file_spec; self[:F]; end
11
12
  def aspect; self[:Aspect]; end
@@ -7,6 +7,7 @@ module Pdfrb
7
7
  # /R = sampling rate, /C = channels, /B = bits/sample, /E =
8
8
  # encoding (Raw, Signed, MuLaw, ALaw).
9
9
  class Sound < Pdfrb::Model::Cos::Stream
10
+ arlington_object "SoundObject"
10
11
  def type; self[:Type]; end
11
12
  def sampling_rate; self[:R]; end
12
13
  def channels; self[:C] || 1; end
@@ -4,6 +4,7 @@ module Pdfrb
4
4
  module Model
5
5
  module Type
6
6
  class WidgetAnnotation < Annotation
7
+ arlington_object "AnnotWidget"
7
8
  def field; self[:Parent]; end
8
9
  def appearance_stream; self[:AP]; end
9
10
  def highlight_mode; self[:H]; end
@@ -401,6 +401,13 @@ module Pdfrb
401
401
  # Document Part hierarchy (ISO 16612-2 PDF/VT).
402
402
  autoload :DPartRoot, "pdfrb/model/type/d_part"
403
403
  autoload :DPart, "pdfrb/model/type/d_part"
404
+
405
+ # Additional actions on page objects (s12.6.3.16).
406
+ autoload :AddActionPageObject, "pdfrb/model/type/add_action_page_object"
407
+
408
+ # Border style (s12.5.4). BorderEffect lives in its own file.
409
+ autoload :BorderStyle, "pdfrb/model/type/border_style"
410
+ autoload :BorderEffect, "pdfrb/model/type/border_effect"
404
411
  end
405
412
  end
406
413
  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.20"
4
+ VERSION = "0.7.21"
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.20
4
+ version: 0.7.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -975,6 +975,7 @@ files:
975
975
  - lib/pdfrb/model/type/action_trans.rb
976
976
  - lib/pdfrb/model/type/action_uri.rb
977
977
  - lib/pdfrb/model/type/add_action_catalog.rb
978
+ - lib/pdfrb/model/type/add_action_page_object.rb
978
979
  - lib/pdfrb/model/type/af_embedded_file.rb
979
980
  - lib/pdfrb/model/type/af_file_specification.rb
980
981
  - lib/pdfrb/model/type/alternate_image.rb
@@ -985,6 +986,7 @@ files:
985
986
  - lib/pdfrb/model/type/appearance_trap_net.rb
986
987
  - lib/pdfrb/model/type/bead.rb
987
988
  - lib/pdfrb/model/type/border_effect.rb
989
+ - lib/pdfrb/model/type/border_style.rb
988
990
  - lib/pdfrb/model/type/border_styling.rb
989
991
  - lib/pdfrb/model/type/box_color_info.rb
990
992
  - lib/pdfrb/model/type/box_style.rb