Class: HexaPDF::Type::Annotation
- Inherits:
-
Dictionary
- Object
- Object
- Dictionary
- HexaPDF::Type::Annotation
- Extended by:
- Utils::BitField
- Defined in:
- lib/hexapdf/type/annotation.rb
Overview
Annotations are used to associate objects like notes, sounds or movies with a location on a PDF page or allow the user to interact with a PDF document using a keyboard or mouse.
See: PDF1.7 s12.5
Direct Known Subclasses
HexaPDF::Type::Annotations::Link, HexaPDF::Type::Annotations::MarkupAnnotation, HexaPDF::Type::Annotations::Widget, IconFit
Defined Under Namespace
Classes: AppearanceDictionary, Border
Constant Summary
Constants included from DictionaryFields
DictionaryFields::Boolean, DictionaryFields::PDFByteString, DictionaryFields::PDFDate
Instance Attribute Summary
Attributes inherited from Object
#data, #document, #must_be_indirect
Instance Method Summary collapse
-
#appearance ⇒ Object
Returns the AppearanceDictionary instance associated with the annotation or
nilif none is set. -
#appearance? ⇒ Boolean
Returns
trueif the widget’s normal appearance exists. -
#must_be_indirect? ⇒ Boolean
Returns
truebecause annotation objects must always be indirect objects.
Methods included from Utils::BitField
Methods inherited from Dictionary
#[], #[]=, define_field, define_type, #delete, #each, each_field, #empty?, field, #key?, #to_h, type, #type
Methods inherited from Object
#<=>, #==, #cache, #cached?, #clear_cache, deep_copy, #deep_copy, #document?, #eql?, #gen, #gen=, #hash, #indirect?, #initialize, #inspect, #null?, #oid, #oid=, #type, #validate, #value, #value=
Constructor Details
This class inherits a constructor from HexaPDF::Object
Instance Method Details
#appearance ⇒ Object
Returns the AppearanceDictionary instance associated with the annotation or nil if none is set.
128 129 130 |
# File 'lib/hexapdf/type/annotation.rb', line 128 def appearance self[:AP] end |
#appearance? ⇒ Boolean
Returns true if the widget’s normal appearance exists.
Note that this checks only if the appearance exists but not if the structure of the appearance dictionary conforms to the expectations of the annotation.
136 137 138 139 140 141 |
# File 'lib/hexapdf/type/annotation.rb', line 136 def appearance? return false unless (normal_appearance = appearance&.normal_appearance) normal_appearance.kind_of?(HexaPDF::Stream) || (!normal_appearance.empty? && normal_appearance.each.all? {|_k, v| v.kind_of?(HexaPDF::Stream) }) end |
#must_be_indirect? ⇒ Boolean
Returns true because annotation objects must always be indirect objects.
122 123 124 |
# File 'lib/hexapdf/type/annotation.rb', line 122 def must_be_indirect? true end |