Class: Pdfrb::Model::Type::Annotation

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

Instance Attribute Summary

Attributes inherited from Object

#document, #gen, #oid, #value

Class Method Summary collapse

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

Class Method Details

.for_subtype(symbol) ⇒ Object



82
83
84
# File 'lib/pdfrb/model/type/annotation.rb', line 82

def for_subtype(symbol)
  subtype_map[symbol]
end

.register_subtype(symbol, klass = self) ⇒ Object



78
79
80
# File 'lib/pdfrb/model/type/annotation.rb', line 78

def register_subtype(symbol, klass = self)
  subtype_map[symbol] = klass
end

.subtype_mapObject



74
75
76
# File 'lib/pdfrb/model/type/annotation.rb', line 74

def subtype_map
  @subtype_map ||= {}
end

Instance Method Details

#actionObject



37
# File 'lib/pdfrb/model/type/annotation.rb', line 37

def action; self[:A]; end

#additional_actionsObject



38
# File 'lib/pdfrb/model/type/annotation.rb', line 38

def additional_actions; self[:AA]; end

#appearanceObject



35
# File 'lib/pdfrb/model/type/annotation.rb', line 35

def appearance; self[:AP]; end

#appearance_stateObject



36
# File 'lib/pdfrb/model/type/annotation.rb', line 36

def appearance_state; self[:AS]; end

#borderObject



34
# File 'lib/pdfrb/model/type/annotation.rb', line 34

def border; self[:Border]; end

#colorObject



33
# File 'lib/pdfrb/model/type/annotation.rb', line 33

def color; self[:C]; end

#contentsObject



29
# File 'lib/pdfrb/model/type/annotation.rb', line 29

def contents; self[:Contents]; end

#create_appearance_streamObject



68
69
70
# File 'lib/pdfrb/model/type/annotation.rb', line 68

def create_appearance_stream
  AppearanceGenerator.for(self, document: document)&.create_appearance
end

#flagsObject



32
# File 'lib/pdfrb/model/type/annotation.rb', line 32

def flags; self[:F] || 0; end

#hidden?Boolean

---- Flag predicates ----

Returns:

  • (Boolean)


49
# File 'lib/pdfrb/model/type/annotation.rb', line 49

def hidden?; flags & 1 != 0; end

#locked?Boolean

Returns:

  • (Boolean)


55
# File 'lib/pdfrb/model/type/annotation.rb', line 55

def locked?; flags & 128 != 0; end

#locked_contents?Boolean

Returns:

  • (Boolean)


57
# File 'lib/pdfrb/model/type/annotation.rb', line 57

def locked_contents?; flags & 512 != 0; end

#modified_dateObject



31
# File 'lib/pdfrb/model/type/annotation.rb', line 31

def modified_date; self[:M]; end

#nameObject



30
# File 'lib/pdfrb/model/type/annotation.rb', line 30

def name; self[:NM]; end

#no_rotate?Boolean

Returns:

  • (Boolean)


52
# File 'lib/pdfrb/model/type/annotation.rb', line 52

def no_rotate?; flags & 8 != 0; end

#no_view?Boolean

Returns:

  • (Boolean)


53
# File 'lib/pdfrb/model/type/annotation.rb', line 53

def no_view?; flags & 16 != 0; end

#no_zoom?Boolean

Returns:

  • (Boolean)


51
# File 'lib/pdfrb/model/type/annotation.rb', line 51

def no_zoom?; flags & 4 != 0; end

#normal_appearanceObject

---- Appearance management ----



60
61
62
63
64
65
66
# File 'lib/pdfrb/model/type/annotation.rb', line 60

def normal_appearance
  ap = appearance
  return nil unless ap

  ap = document.object(ap) if ap.is_a?(Pdfrb::Model::Reference) && document
  ap && ap[:N]
end

#pageObject

---- Page reference ----



41
42
43
44
45
46
# File 'lib/pdfrb/model/type/annotation.rb', line 41

def page
  ref = self[:P]
  return nil unless ref && document

  document.object(ref)
end

#print?Boolean

Returns:

  • (Boolean)


50
# File 'lib/pdfrb/model/type/annotation.rb', line 50

def print?; flags & 2 != 0; end

#read_only?Boolean

Returns:

  • (Boolean)


54
# File 'lib/pdfrb/model/type/annotation.rb', line 54

def read_only?; flags & 32 != 0; end

#rectObject



28
# File 'lib/pdfrb/model/type/annotation.rb', line 28

def rect; self[:Rect]; end

#subtypeObject

---- Accessors ----



27
# File 'lib/pdfrb/model/type/annotation.rb', line 27

def subtype; self[:Subtype]; end

#toggle_no_view?Boolean

Returns:

  • (Boolean)


56
# File 'lib/pdfrb/model/type/annotation.rb', line 56

def toggle_no_view?; flags & 256 != 0; end