4

When I try to display a link in pdf it does not show me the link, but the php code or string text are displayed. How can I change that?

This is my code

while($fila2 = mysql_fetch_array($fila)) {
    $item = $item+1;    
    $pdf->Cell(5, 8 ,$item, 1);
    $pdf->Cell(10, 8 ,$fila2['FOLIO'], 1);
    $pdf->Cell(70, 8 ,$fila2['NOMBRE'], 1);
    $pdf->Cell(25, 8 ,date("d-m-Y",strtotime($fila2['FECHA_SOLICITUD'])), 1);
    $pdf->Cell(25, 8 ,$fila2['TIPO_AUTORIZACION'], 1);
    $pdf->Cell(25, 8 ,date("d-m-Y",strtotime($fila2['FECHA_AUTORIZACION'])), 1);
    $pdf->Cell(20,8 , '<a href="http://www.intranet.com/mb/rprh06/final.php?folio=$fila2["FOLIO"]" target="_blank">Enlace</a>',1); 
    $pdf->Ln(8);
}

And this is my result

enter image description here

I want to show something like "View Link" according to the result ID of the row. But when I pass the pointer on the link it shows the following

enter image description here

Thank You.

V-rund Puro-hit
  • 5,518
  • 9
  • 31
  • 50

1 Answers1

5

Based on the link:- http://www.fpdf.org/en/doc/link.htm

You need to write like this:-

$pdf->Link(100,10,10,10, 'http://www.intranet.com/mb/rprh06/final.php?folio='.$fila2[‌​"FOLIO"]);

Or with Cell():-

$pdf->Cell(20,8 ,'','','','',false, "http://www.intranet.com/mb/rprh06/final.php?folio=".$fila2["FOLIO"]); 

Reference:- http://www.fpdf.org/en/doc/cell.htm

Note:- change parameters values accordingly.

Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
  • Thank you. Cell works for me but the large link appears.. and dont show like a link, I read the documentation but I have many questions. Thank You. $pdf->Cell(30,8 ,"http://www.intranet.com/mb/rprh06/final.php?folio=".$fila2["FOLIO"],1); – Juan Pablo Bustamante Luna Feb 01 '17 at 06:26
  • @JuanPabloBustamanteLuna you can adjust values to make it smaller (check parameters and change the value) – Alive to die - Anant Feb 01 '17 at 06:28
  • @JuanPabloBustamanteLuna If you want link blue, try `$pdf->SetTextColor(6, 69, 173);`, afterwards return it to black with `$pdf->SetTextColor(0, 0, 0);` – Goose Mar 14 '17 at 15:57