### Home Classes Methods

### In Files

- lib/prawn/document/annotations.rb

### Methods

- #annotate
- #link_annotation
- #text_annotation

### Files

- COPYING
- HACKING
- LICENSE
- README

### Class/Module Index

Quicksearch

- Prawn
- Prawn::Core
- Prawn::Document
- Prawn::Document::Annotations
- Prawn::Document::BoundingBox
- Prawn::Document::ColumnBox
- Prawn::Document::Destinations
- Prawn::Document::GraphicsState
- Prawn::Document::Internals
- Prawn::Document::PageGeometry
- Prawn::Document::Snapshot
- Prawn::Encoding
- Prawn::Errors
- Prawn::Font
- Prawn::Font::AFM
- Prawn::Font::DFont
- Prawn::Font::TTF
- Prawn::Graphics
- Prawn::Graphics::CapStyle
- Prawn::Graphics::Color
- Prawn::Graphics::Dash
- Prawn::Graphics::JoinStyle
- Prawn::Graphics::Transformation
- Prawn::Graphics::Transparency
- Prawn::Images
- Prawn::Images::JPG
- Prawn::Images::PNG
- Prawn::Measurements
- Prawn::Outline
- Prawn::Stamp
- Prawn::Text
- Prawn::Text::Box
- Prawn::Text::LineWrap
- File
- Numeric

No matching classes.

# Prawn::Document::Annotations

Provides very low-level support for annotations. These extensions are mainly for use by prawn-format, so be sure to check that out if all you need is basic internal or external links.

### Public Instance Methods

annotate(options) click to toggle source

Adds a new annotation (section 8.4 in PDF spec) to the current page. `options` must be a Hash describing the annotation.

    # File lib/prawn/document/annotations.rb, line 22
    def annotate(options)
      page.dictionary.data[:Annots] ||= []
      options = sanitize_annotation_hash(options)
      page.dictionary.data[:Annots] << ref!(options)
      return options
    end

link_annotation(rect, options={}) click to toggle source

A convenience method for creating Link annotations. `rect` must be an array of four numbers, describing the bounds of the annotation. The `options` hash should include either :Dest (describing the target destination, usually as a string that has been recorded in the document's Dests tree), or :A (describing an action to perform on clicking the link), or :PA (for describing a URL to link to).

    # File lib/prawn/document/annotations.rb, line 45
    def link_annotation(rect, options={})
      options = options.merge(:Subtype => :Link, :Rect => rect)
      annotate(options)
    end

text_annotation(rect, contents, options={}) click to toggle source

A convenience method for creating Text annotations. `rect` must be an array of four numbers, describing the bounds of the annotation. `contents` should be a string, to be shown when the annotation is activated.

    # File lib/prawn/document/annotations.rb, line 33
    def text_annotation(rect, contents, options={})
      options = options.merge(:Subtype => :Text, :Rect => rect, :Contents => contents)
      annotate(options)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.