class HexaPDF::Type::Annotation
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
Public Instance Methods
appearance(type = :normal)
click to toggle source
Returns the annotation's appearance stream of the given type (:normal, :rollover, or :down) or nil
if it doesn't exist.
The appearance state is taken into account if necessary.
# File lib/hexapdf/type/annotation.rb, line 135 def appearance(type = :normal) entry = appearance_dict&.send("#{type}_appearance") if entry.kind_of?(HexaPDF::Dictionary) && !entry.kind_of?(HexaPDF::Stream) entry = entry[self[:AS]] end return unless entry.kind_of?(HexaPDF::Stream) if entry.type == :XObject && entry[:Subtype] == :Form entry elsif (entry[:Type].nil? || entry[:Type] == :XObject) && (entry[:Subtype].nil? || entry[:Subtype] == :Form) && entry[:BBox] document.wrap(entry, type: :XObject, subtype: :Form) end end
Also aliased as: appearance?
appearance_dict()
click to toggle source
Returns the AppearanceDictionary
instance associated with the annotation or nil
if none is set.
# File lib/hexapdf/type/annotation.rb, line 127 def appearance_dict self[:AP] end
must_be_indirect?()
click to toggle source
Returns true
because annotation objects must always be indirect objects.
# File lib/hexapdf/type/annotation.rb, line 121 def must_be_indirect? true end
Private Instance Methods
raw_flags()
click to toggle source
Helper method for bit field getter access.
# File lib/hexapdf/type/annotation.rb, line 154 def raw_flags self[:F] end
raw_flags=(value)
click to toggle source
Helper method for bit field setter access.
# File lib/hexapdf/type/annotation.rb, line 159 def raw_flags=(value) self[:F] = value end