Class: Pdfrb::Model::Type::OptContentUsageApplication

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

Overview

Optional Content Usage Application dict (s8.11.4.1). Decides which OCGs to enable when the user views/prints/exports the document.

Instance Attribute Summary

Attributes inherited from Object

#document, #gen, #oid, #value

Instance Method Summary collapse

Methods inherited from Cos::Dictionary

#[], #[]=, apply_arlington_definition, arlington_default, arlington_key_to_symbol, arlington_one_type_to_ruby, arlington_required?, arlington_scalar, 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, merged_field, own_fields, #pdf_type, register_type, type_map, #validate

Methods included from Cos::ArlingtonBacked

#arlington_object

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

#categoryObject



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

def category; self[:Category]; end

#each_ocgObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/pdfrb/model/type/opt_content_ext.rb', line 19

def each_ocg
  return enum_for(:each_ocg) unless block_given?
  return unless ocgs && document

  arr = ocgs.is_a?(Pdfrb::Model::PdfArray) ? ocgs.to_a : ocgs
  arr.each do |ref|
    obj = ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
    yield obj if obj
  end
end

#eventObject



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

def event; self[:Event]&.to_sym; end

#export_event?Boolean

Returns:

  • (Boolean)


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

def export_event?; event == :Export; end

#ocgsObject



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

def ocgs; self[:OCGs]; end

Returns:

  • (Boolean)


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

def print_event?; event == :Print; end

#view_event?Boolean

Returns:

  • (Boolean)


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

def view_event?; event == :View; end