Method: TCPDF#addHtmlLink

Defined in:
lib/tcpdf.rb

Output anchor link.

@param string :url

link URL or internal link (i.e.: <a href=“#23”>link to page 23</a>)

@param string :name

link name

@param int :fill

Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.

@param boolean :firstline

if true prints only the first line and return the remaining string.

@param array :color

array of RGB text color

@param string :style

font style (U, D, B, I)

@param boolean :firstblock

if true the string is the starting of a line.

@return

the number of cells used or the remaining text if :firstline = true

@access public


7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
# File 'lib/tcpdf.rb', line 7800

def addHtmlLink(url, name, fill=0, firstline=false, color='', style=-1, firstblock=false)
  if !empty_string(url) and (url[0, 1] == '#')
    # convert url to internal link
    page = url.sub(/^#/, "").to_i
    url = AddLink()
    SetLink(url, 0, page)
  end
  # store current settings
  prevcolor = @fgcolor
  prevstyle = @font_style
  if color.empty?
    SetTextColorArray(@html_link_color_array)
  else
    SetTextColorArray(color)
  end
  if style == -1
    SetFont('', @font_style + @html_link_font_style)
  else
    SetFont('', @font_style + style)
  end
  ret = Write(@lasth, name, url, fill, '', false, 0, firstline, firstblock, 0)
  # restore settings
  SetFont('', prevstyle)
  SetTextColorArray(prevcolor)
  return ret
end