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');
Advertisement
Answer
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).