Esempio n. 1
0
 function _link(&$link)
 {
     if (empty($link->text)) {
         $link->text = preg_replace('/:-:(.*?):-:/e', '$this->pres->\\1', $link->href);
     }
     if (!empty($link->leader)) {
         $leader = preg_replace('/:-:(.*?):-:/e', '$this->pres->\\1', $link->leader);
     } else {
         $leader = '';
     }
     if (!empty($link->text)) {
         $this->pdf_cy = pdf_get_value($this->pdf, "texty", null) + 10;
         pdf_set_font($this->pdf, $this->pdf_font, -12, 'winansi');
         $fnt = pdf_findfont($this->pdf, $this->pdf_font, 'winansi', 0);
         if (strlen($leader)) {
             $lx = pdf_stringwidth($this->pdf, $leader, $fnt, -12);
         } else {
             $lx = 0;
         }
         $dx = pdf_stringwidth($this->pdf, $link->text, $fnt, -12);
         $cw = pdf_stringwidth($this->pdf, 'm', $fnt, -12);
         // em unit width
         switch ($link->align) {
             case 'center':
                 $x = (int) ($this->pdf_x / 2 - $dx / 2 - $lx / 2);
                 break;
             case 'right':
                 $x = $this->pdf_x - $this->pdf_cx - $dx - $lx - 15;
                 break;
             case 'left':
             default:
                 $x = $this->pdf_cx;
                 break;
         }
         if ($link->marginleft) {
             $x += (int) ((double) $link->marginleft * $cw);
         }
         pdf_add_weblink($this->pdf, $x + $lx, $this->pdf_y - $this->pdf_cy - 3, $x + $dx + $lx, $this->pdf_y - $this->pdf_cy + 12, $link->text);
         pdf_show_xy($this->pdf, strip_markups($leader) . strip_markups($link->text), $x, $this->pdf_cy);
         pdf_continue_text($this->pdf, "");
     }
 }
Esempio n. 2
0
 function add_link($left, $top, $width, $height, $url)
 {
     pdf_add_weblink($this->pdf, $left, $top - $height, $left + $width, $top, $url);
 }
Esempio n. 3
0
 function add_link($url, $caption)
 {
     $oh = pdf_get_value($this->pdf, 'texty', 0);
     pdf_show($this->pdf, $caption);
     $y = pdf_get_value($this->pdf, 'texty', 0);
     $w = pdf_get_value($this->pdf, 'textx', 0);
     $ow = pdf_get_value($this->pdf, 'textx', 0) - pdf_stringwidth($this->pdf, $caption);
     pdf_set_border_style($this->pdf, 'dashed', 0);
     pdf_add_weblink($this->pdf, $ow, $oh, $w, $oh + 12, $url);
 }