Nico Sevilla
Nico Sevilla

Reputation: 17

TCPDF WriteHTML() created link is not clickable

 $pdf = new TCPDF();
 $myHTML = '<a href="https://www.google.com/">TEST LINK</a>';
 $pdf->writeHTML($myHTML, true, false, true, false, '');

This is the screenshot of output in PDF from the code above but not clickable

Upvotes: 0

Views: 1703

Answers (3)

lisandro
lisandro

Reputation: 506

For me worked to use escaped double quotes

$html = "<a href=\"http://your.link.com\">Link</a>";

Upvotes: 0

sanguinarium
sanguinarium

Reputation: 39

Rather old post but if you come across this:

  1. First verify that in your setup example 6 is working fine.
  2. The also check if your link description has unicode characters. they might mess up things.

Upvotes: 1

Clueless_captain
Clueless_captain

Reputation: 430

I've struggled with this one too for a while. For me it worked to change single quotes around the link to double quotes. It's the same with using the write method on a newline character.

If I were to write:

$pdf->Write(4, '\n');

then I'd see the newline characters printed on the PDF in stead of a return

When I write:

$pdf->Write(4, "\n");

then the newline gets created.

So, do you have the same behaviour with the double/single quotes. And just for the sake of it, try changing them anyhow and/or remove the final slash from the link.

Alternatively, you can try to change your code to:

$pdf->Write(4, 'TEST LINK', 'https://www.google.com');

Upvotes: 0

Related Questions