class PDF::Writer::Object::Annotation
An annotation object, this will add an annotation to the current page. initially will support just link annotations.
Constants
- TYPES
Attributes
action[RW]
rect[RW]
type[RW]
Public Class Methods
new(parent, type, rect, label)
click to toggle source
Calls superclass method
PDF::Writer::Object::new
# File lib/pdf/writer/object/annotation.rb 16 def initialize(parent, type, rect, label) 17 super(parent) 18 19 @type = type 20 @rect = rect 21 22 case @type 23 when :link 24 @action = PDF::Writer::Object::Action.new(parent, label) 25 when :ilink 26 @action = PDF::Writer::Object::Action.new(parent, label, type) 27 end 28 parent.current_page.add_annotation(self) 29 end
Public Instance Methods
to_s()
click to toggle source
# File lib/pdf/writer/object/annotation.rb 35 def to_s 36 res = "\n#{@oid} 0 obj\n<< /Type /Annot" 37 res << "\n/Subtype /Link" if TYPES.include?(@type) 38 res << "\n/A #{@action.oid} 0 R\n/Border [0 0 0]\n/H /I\n/Rect [" 39 @rect.each { |v| res << "%.4f " % v } 40 res << "]\n>>\nendobj" 41 end