Class: Pdfrb::Model::Type::OptionalContentConfiguration

Inherits:
Cos::Dictionary show all
Defined in:
lib/pdfrb/model/type/optional_content_config.rb

Overview

Optional Content Configuration (s8.11.4.1). Per-view configuration of OCG visibility, intent, and locking.

Instance Attribute Summary

Attributes inherited from Object

#document, #gen, #oid, #value

Instance Method Summary collapse

Methods inherited from Cos::Dictionary

#[], #[]=, arlington_available?, arlington_default, arlington_key_to_symbol, arlington_loaded_for?, arlington_mark_loaded, arlington_object, arlington_one_type_to_ruby, arlington_required?, arlington_types_to_ruby, arlington_version, define_field, define_field_from_arlington, #delete, #each, each_field, #each_raw, #empty?, field, #initialize, #key?, #keys, lookup_type, own_fields, #pdf_type, register_type, type_map, #validate

Methods inherited from Object

#==, define_type, #deref, #indirect?, #initialize, #must_be_indirect?, #pdf_type, pdf_type

Constructor Details

This class inherits a constructor from Pdfrb::Model::Cos::Dictionary

Instance Method Details

#all_off?Boolean

Returns:

  • (Boolean)


23
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 23

def all_off?; base_state == :OFF; end

#all_on?Boolean

Returns:

  • (Boolean)


22
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 22

def all_on?; base_state == :ON; end

#base_stateObject



14
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 14

def base_state; (self[:BaseState] || :ON).to_sym; end

#creatorObject



13
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 13

def creator; self[:Creator]; end

#has_intent?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 26

def has_intent?
  !!intent
end

#intentObject



17
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 17

def intent; self[:Intent]; end

#list_modeObject



18
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 18

def list_mode; self[:ListMode]&.to_sym || :AllPages; end

#lockedObject



20
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 20

def locked; self[:Locked]; end

#locked_groups?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 46

def locked_groups?
  !!locked
end

#nameObject



12
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 12

def name; self[:Name]; end

#offObject



16
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 16

def off; self[:OFF]; end

#onObject



15
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 15

def on; self[:ON]; end

Returns:

  • (Boolean)


38
39
40
41
42
43
44
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 38

def print_intent?
  return false unless intent

  arr = intent.is_a?(Pdfrb::Model::PdfArray) ? intent.to_a : intent
  arr = [arr] unless arr.is_a?(Array)
  arr.map(&:to_sym).include?(:Print)
end

#radio_button_groups?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 50

def radio_button_groups?
  !!rb_groups
end

#rb_groupsObject



19
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 19

def rb_groups; self[:RBGroups]; end

#typeObject



11
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 11

def type; self[:Type]; end

#unchanged?Boolean

Returns:

  • (Boolean)


24
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 24

def unchanged?; base_state == :Unchanged; end

#view_intent?Boolean

Returns:

  • (Boolean)


30
31
32
33
34
35
36
# File 'lib/pdfrb/model/type/optional_content_config.rb', line 30

def view_intent?
  return true unless intent

  arr = intent.is_a?(Pdfrb::Model::PdfArray) ? intent.to_a : intent
  arr = [arr] unless arr.is_a?(Array)
  arr.map(&:to_sym).include?(:View)
end