Class: PDF::Writer::TagIlink

Inherits:
Object
  • Object
show all
Defined in:
lib/pdf/writer.rb

Overview

A callback for creating and managing links internal to the document.

Class Method Summary collapse

Class Method Details

.[](pdf, info) ⇒ Object



2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
# File 'lib/pdf/writer.rb', line 2580

def self.[](pdf, info)
  case info[:status]
  when :start, :start_line
    @links ||= {}
    @links[info[:cbid]] = {
      :x         => info[:x],
      :y         => info[:y],
      :angle     => info[:angle],
      :descender => info[:descender],
      :height    => info[:height],
      :uri       => info[:params]["dest"]
    }
  when :end, :end_line
      # The end of the link. Assume that it is the most recent opening
      # which has closed.
    start = @links[info[:cbid]]
    pdf.add_internal_link(start[:uri], start[:x],
                          start[:y] + start[:descender], info[:x],
                          start[:y] + start[:descender] +
                          start[:height])
  end
end