Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create link in pdf with tcpdf

Tags:

html

php

tcpdf

How can I create a link with TCPDF?

When using the writeHTML() function and passing my whole html content, TCPDF doesn't make my links clickable. They are blue and underlined but I cannot click them.

Here is what I did.

$html = "<a href='www.stackoverflow.com'>stackoverflow.com</a>";
$tcpdf = new TCPDF();
$tcpdf->writeHTML($html);
$tcpdf-Output('output.pdf', 'F');
like image 711
Naelyth Avatar asked Feb 13 '13 08:02

Naelyth


1 Answers

As per the documentation, you can use the Write() method on your TCPDF object to achieve this. For example:

$tcpdf->Write(10, 'Google', 'http://www.google.com/', false, 'L', true);

Would write a line with the text Google (left-aligned and with a line break, just added for a better example).

like image 92
Oldskool Avatar answered Sep 25 '22 14:09

Oldskool