Class: RGhost::TextLinkIn

Inherits:
PsObject show all
Includes:
RubyToPs
Defined in:
lib/rghost/text_link_in.rb

Overview

It works only PDF format

Constant Summary collapse

DEFAULT_OPTIONS =
{:x=> :limit_left,:y=> :current_row, :tag => :default_font, :color => :blue,:label => "RGhost API", :url => 'http://rghost.rubyforge.org'}

Instance Method Summary collapse

Methods included from RubyToPs

#array_to_stack, #hash_to_array, #pack_string, #ps_escape, #string_eval, #to_array, #to_bool, #to_string, #to_string_array

Methods inherited from PsObject

#<<, #call, #graphic_scope, #raw, #set, #to_s

Constructor Details

#initialize(options = {}) ⇒ TextLinkIn

Options

  • :x and :y - Initial position.

  • :tag or :with - Use predefined tag.

  • :color - Override color of the tag.

  • :label - The text.

  • :url - Hyperlink.

Examples

doc=RGhost::Document.new doc.text_link “Shairon at Hashcode”, :url => “www.hashcode.eti.br”, :color => :blue, :x => 3, :y => 4, :tag => :h1

Rotating

doc.newpath do

translate :x => 3, :y=> 4
 rotate 45
 text_link "RGhost website", :url => "http://rghost.rubyforge.org", :x => 0, :y => 0, :tag => :font2

end



24
25
26
27
# File 'lib/rghost/text_link_in.rb', line 24

def initialize(options={})
  
  @options=DEFAULT_OPTIONS.dup.merge(options)
end

Instance Method Details

#psObject



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rghost/text_link_in.rb', line 29

def ps
  text=RGhost::PsObject.new
  text.set RGhost::Cursor.moveto(@options)
  text.raw RGhost::Color.create(@options[:color])  if @options[:color]
  f="_#{@options[:with] || @options[:tag] || :default_font}"
  text.raw f
  text.raw "/:link_str #{to_string(@options[:label])} def /:link_uri #{to_string(@options[:url])} def :link_make "
  text.ps
 
 
  
end