Class PDF::Writer::Object::Annotation
In: lib/pdf/writer/object/annotation.rb
Parent: PDF::Writer::Object
TechBook Transaction::Simple SimpleTable Complex Action FontDescriptor Procset Catalog FontEncoding Pages Destination Info Encryption Annotation Contents Outline Page Outlines Font ViewerPreferences Image Hash OHash QuickRef StdDev FontMetrics StrokeStyle ARC4 PolygonPoint ImageInfo lib/pdf/simpletable.rb lib/pdf/writer.rb lib/pdf/techbook.rb lib/pdf/quickref.rb lib/pdf/charts/stddev.rb Charts Math lib/pdf/writer/ohash.rb lib/pdf/writer/fontmetrics.rb lib/pdf/writer/strokestyle.rb lib/pdf/writer/arc4.rb lib/pdf/writer/graphics.rb lib/pdf/writer/object.rb lib/pdf/writer/object/image.rb External lib/pdf/writer/object/font.rb lib/pdf/writer/object/outlines.rb lib/pdf/writer/object/contents.rb lib/pdf/writer/object/annotation.rb lib/pdf/writer/object/destination.rb lib/pdf/writer/object/viewerpreferences.rb lib/pdf/writer/object/info.rb lib/pdf/writer/object/fontencoding.rb lib/pdf/writer/object/page.rb lib/pdf/writer/object/catalog.rb lib/pdf/writer/object/outline.rb lib/pdf/writer/object/encryption.rb lib/pdf/writer/object/procset.rb lib/pdf/writer/object/action.rb lib/pdf/writer/object/pages.rb lib/pdf/writer/object/fontdescriptor.rb Object OffsetReader EN Lang lib/pdf/writer/graphics/imageinfo.rb Graphics Writer PDF dot/m_33_0.png

An annotation object, this will add an annotation to the current page. initially will support just link annotations.

Methods

new   to_s  

Constants

TYPES = [:link, :ilink]

Attributes

action  [RW] 
rect  [RW] 
type  [RW] 

Public Class methods

[Source]

    # File lib/pdf/writer/object/annotation.rb, line 16
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

[Source]

    # File lib/pdf/writer/object/annotation.rb, line 35
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

[Validate]