pdfrb 0.7.16 → 0.7.17

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: c59e3261ad38e5013f1adae6c5a5f48197ddfdc6226acd96e7fe09e6d7d9b3a5
4
- data.tar.gz: f39fadf09d0a6b8ad2a401111c12384ac3a2fab66f7bbf8c40dc55cc174f1775
3
+ metadata.gz: 67218c766df1cff2565d5020ad8089414e7892102117fc76a9413f0972c93648
4
+ data.tar.gz: 8be6840a038f7c132e10b549c3ed3f33180ea5b5b14bcc6804c01f322dac82cf
5
5
  SHA512:
6
- metadata.gz: 8cc9ef29aa8e9be785306010db555dc7bdac6ddd45c6de13107bb0cf194b5c28091d13b61a321252edc39ec41500b82eb478b338aae88480eae6c51e7861416b
7
- data.tar.gz: 14ed721ff08a6a3fc8a6ce8cd3ced4aa09edec502c870d008aef7a9f7374cddcedf8ab4472e3d48773773e4b8530b059ed73fd42ec1ba5988af7ae2cc98cece6
6
+ metadata.gz: a87239ec989b28f76e4c2f2a31e0efdc0b67a0dfb39030f51cc52b79343c2d5de42d40b7d4f816ef72ff930964b89c53f1aa4757f481eb6337f9283a4e6f5003
7
+ data.tar.gz: f4748a5236be87af4360070f8ae90f7a34a93ba1f782a347d772573118b6a63e7bb24c167220d4df8d69477c4014bfb90a32b39756dcd383cb90058a6cbb398a
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # Sound action (ISO 32000-2 §12.6.4.11, PDF 1.2, deprecated
7
+ # PDF 2.0). Plays a sound object.
8
+ class ActionSound < Pdfrb::Model::Cos::Dictionary
9
+ arlington_object "ActionSound"
10
+
11
+ # /Type — optional, fixed "Action".
12
+ def type
13
+ value[:Type]&.to_sym
14
+ end
15
+
16
+ # /S — required, fixed "Sound".
17
+ def action_type
18
+ value[:S]&.to_sym
19
+ end
20
+
21
+ # /Sound — required indirect stream with the sound data.
22
+ def sound(document = nil)
23
+ ref = value[:Sound]
24
+ return nil unless ref && document
25
+
26
+ ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
27
+ end
28
+
29
+ # /Volume — optional, -1.0 to 1.0 (default 1.0).
30
+ def volume
31
+ value[:Volume] || 1.0
32
+ end
33
+
34
+ # /Synchronous — optional, default false.
35
+ def synchronous?
36
+ value[:Synchronous] == true
37
+ end
38
+
39
+ # /Repeat — optional, default false.
40
+ def repeat?
41
+ value[:Repeat] == true
42
+ end
43
+
44
+ # /Mix — optional, default false. Whether to mix with
45
+ # existing sounds.
46
+ def mix?
47
+ value[:Mix] == true
48
+ end
49
+
50
+ # /Next — optional next action(s).
51
+ def next_action(document = nil)
52
+ ref = value[:Next]
53
+ return nil unless ref && document
54
+
55
+ ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # Additional Actions for the Catalog (ISO 32000-2 §12.6.3.17,
7
+ # PDF 1.4+). Referenced via /AA on the Catalog dict. Each entry
8
+ # is an indirect ECMAScript action triggered by the named
9
+ # document event.
10
+ class AddActionCatalog < Pdfrb::Model::Cos::Dictionary
11
+ arlington_object "AddActionCatalog"
12
+
13
+ # /DC — document close.
14
+ def document_close(document = nil)
15
+ resolve_action(:DC, document)
16
+ end
17
+
18
+ # /WS — will save.
19
+ def will_save(document = nil)
20
+ resolve_action(:WS, document)
21
+ end
22
+
23
+ # /DS — did save.
24
+ def did_save(document = nil)
25
+ resolve_action(:DS, document)
26
+ end
27
+
28
+ # /WP — will print.
29
+ def will_print(document = nil)
30
+ resolve_action(:WP, document)
31
+ end
32
+
33
+ # /DP — did print.
34
+ def did_print(document = nil)
35
+ resolve_action(:DP, document)
36
+ end
37
+
38
+ private
39
+
40
+ def resolve_action(key, document)
41
+ ref = value[key]
42
+ return nil unless ref && document
43
+
44
+ ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfrb
4
+ module Model
5
+ module Type
6
+ # AlternateImage (ISO 32000-2 §8.9.5, PDF 1.3+). An alternate
7
+ # image representation used when the primary image's color
8
+ # space isn't available (e.g. a DeviceGray fallback for a
9
+ # DeviceCMYK image on a monochrome printer).
10
+ class AlternateImage < Pdfrb::Model::Cos::Dictionary
11
+ arlington_object "AlternateImage"
12
+
13
+ # /Image — required indirect reference to the alternate
14
+ # image XObject.
15
+ def image(document = nil)
16
+ ref = value[:Image]
17
+ return nil unless ref && document
18
+
19
+ ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
20
+ end
21
+
22
+ # /DefaultForPrinting — optional, default false. When true,
23
+ # the alternate image is used for printing.
24
+ def default_for_printing?
25
+ value[:DefaultForPrinting] == true
26
+ end
27
+
28
+ # /OC — optional optional-content group controlling the
29
+ # alternate's visibility (PDF 1.5+).
30
+ def optional_content(document = nil)
31
+ ref = value[:OC]
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
@@ -385,6 +385,15 @@ module Pdfrb
385
385
 
386
386
  # Trapping (Adobe TechNote 5620).
387
387
  autoload :TrapRegion, "pdfrb/model/type/trap_region"
388
+
389
+ # Additional actions on the Catalog (s12.6.3.17).
390
+ autoload :AddActionCatalog, "pdfrb/model/type/add_action_catalog"
391
+
392
+ # Alternate image (s8.9.5).
393
+ autoload :AlternateImage, "pdfrb/model/type/alternate_image"
394
+
395
+ # Sound action (s12.6.4.11, deprecated 2.0).
396
+ autoload :ActionSound, "pdfrb/model/type/action_sound"
388
397
  end
389
398
  end
390
399
  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.16"
4
+ VERSION = "0.7.17"
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.16
4
+ version: 0.7.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -968,13 +968,16 @@ files:
968
968
  - lib/pdfrb/model/type/action_rich_media_execute.rb
969
969
  - lib/pdfrb/model/type/action_set_ocg_state.rb
970
970
  - lib/pdfrb/model/type/action_set_state.rb
971
+ - lib/pdfrb/model/type/action_sound.rb
971
972
  - lib/pdfrb/model/type/action_sound_action.rb
972
973
  - lib/pdfrb/model/type/action_submit_form.rb
973
974
  - lib/pdfrb/model/type/action_thread.rb
974
975
  - lib/pdfrb/model/type/action_trans.rb
975
976
  - lib/pdfrb/model/type/action_uri.rb
977
+ - lib/pdfrb/model/type/add_action_catalog.rb
976
978
  - lib/pdfrb/model/type/af_embedded_file.rb
977
979
  - lib/pdfrb/model/type/af_file_specification.rb
980
+ - lib/pdfrb/model/type/alternate_image.rb
978
981
  - lib/pdfrb/model/type/annotation.rb
979
982
  - lib/pdfrb/model/type/appearance.rb
980
983
  - lib/pdfrb/model/type/appearance_characteristics.rb