Class: HexaPDF::Type::OptionalContentMembership
- Inherits:
-
Dictionary
- Object
- Object
- Dictionary
- HexaPDF::Type::OptionalContentMembership
- Defined in:
- lib/hexapdf/type/optional_content_membership.rb
Overview
Represents an optional content membership dictionary.
A membership dictionary allows more complex visibility policies, like:
- Content that should be visible when a certain optional content group is off instead of on.
- Content that should be visible when all of a number of OCGs are on.
See: PDF2.0 s8.11.2.2
Constant Summary
Constants included from DictionaryFields
DictionaryFields::Boolean, DictionaryFields::PDFByteString, DictionaryFields::PDFDate
Instance Method Summary collapse
-
#ocgs ⇒ Object
Returns an array of OCGs whose states determine the visibility of content controlled by this membership dictionary.
Methods inherited from Dictionary
#[], #[]=, define_field, define_type, #delete, #each, each_field, #empty?, field, #key?, #to_hash, type, #type
Instance Method Details
#ocgs ⇒ Object
Returns an array of OCGs whose states determine the visibility of content controlled by this membership dictionary.
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/hexapdf/type/optional_content_membership.rb', line 62 def ocgs if (ve = self[:VE]) ocgs = ve.to_ary.flatten.map! {|entry| document.deref(entry) } ocgs.reject! {|entry| entry.kind_of?(Symbol) || entry.nil? || entry.null? } ocgs.uniq! ocgs else Array(self[:OCGs]).compact.uniq end end |