Class: PDF::TechBook::TagXref

### Home Classes Methods

### In Files

- lib/pdf/techbook.rb

### Parent

Object

### Methods

- ::[]

### Files

- ChangeLog

### Class/Module Index

Quicksearch

- PDF
- PDF::Charts
- PDF::Charts::StdDev
- PDF::Charts::StdDev::Label
- PDF::Charts::StdDev::Marker
- PDF::Charts::StdDev::Scale
- PDF::Math
- PDF::QuickRef
- PDF::SimpleTable
- PDF::SimpleTable::Column
- PDF::SimpleTable::Column::Heading
- PDF::TechBook
- PDF::TechBook::TagTocDots
- PDF::TechBook::TagXref
- PDF::Writer
- PDF::Writer::ARC4
- PDF::Writer::Complex
- PDF::Writer::External
- PDF::Writer::FontMetrics
- PDF::Writer::Graphics
- PDF::Writer::Graphics::ImageInfo
- PDF::Writer::Graphics::ImageInfo::Formats
- PDF::Writer::Graphics::ImageInfo::Type
- PDF::Writer::Lang
- PDF::Writer::Lang::EN
- PDF::Writer::OHash
- PDF::Writer::Object
- PDF::Writer::Object::Action
- PDF::Writer::Object::Annotation
- PDF::Writer::Object::Catalog
- PDF::Writer::Object::Contents
- PDF::Writer::Object::Destination
- PDF::Writer::Object::Encryption
- PDF::Writer::Object::Font
- PDF::Writer::Object::FontDescriptor
- PDF::Writer::Object::FontEncoding
- PDF::Writer::Object::Info
- PDF::Writer::Object::Outline
- PDF::Writer::Object::Outlines
- PDF::Writer::Object::Pages
- PDF::Writer::Object::Procset
- PDF::Writer::Object::ViewerPreferences
- PDF::Writer::OffsetReader
- PDF::Writer::PolygonPoint
- PDF::Writer::State
- PDF::Writer::StateStack
- PDF::Writer::StrokeStyle

No matching classes.

# PDF::TechBook::TagXref

A stand-alone replacement callback that will return an internal link with either the name of the cross-reference or the page on which the cross-reference appears as the label. If the page number is not yet known (when the cross-referenced item has not yet been rendered, e.g., forward-references), the label will be used in any case.

The parameters are:

name | The name of the cross-reference.
label | Either `page`, `title`, or `text`. `page` will not be used for forward references; only `title` or `text` will be used.
text | Required if `label` has a value of `text`. Ignored if `label` is `title`, optional if `label` is `page`. This value will be used as the display text for the internal link. `text` takes precedence over `title` if `label` is `page`.

### Public Class Methods

[](pdf, params) click to toggle source

    # File lib/pdf/techbook.rb, line 249
    def self.[](pdf, params)
      name  = params["name"]
      item  = params["label"]
      text  = params["text"]

      xref = pdf.xref_table[name]
      if xref
        case item
        when 'page'
          label = xref[:page]
          if text.nil? or text.empty?
            label ||= xref[:title]
          else
            label ||= text
          end
        when 'title'
          label = xref[:title]
        when 'text'
          label = text
        end

        "<c:ilink dest='#{xref[:xref]}'>#{label}</c:ilink>"
      else
        warn PDF::Writer::Lang[:techbook_unknown_xref] % [ name ]
        PDF::Writer::Lang[:techbook_unknown_xref] % [ name ]
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.