使用tcpdf创建pdf中的链接

时间:2021-08-17 09:48:33

How can I create a link with TCPDF?

如何使用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.

当使用writeHTML()函数并传递整个html内容时,TCPDF不会使链接成为可点击的。它们是蓝色和下划线的,但是我不能点击它们。

Here is what I did.

这是我所做的。

$html = "<a href='www.*.com'>*.com</a>";
$tcpdf = new TCPDF();
$tcpdf->writeHTML($html);
$tcpdf-Output('output.pdf', 'F');

1 个解决方案

#1


7  

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

根据文档,您可以在TCPDF对象上使用Write()方法来实现这一点。例如:

$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).

将使用文本谷歌(左对齐和换行,只是添加了一个更好的示例)编写一行。

#1


7  

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

根据文档,您可以在TCPDF对象上使用Write()方法来实现这一点。例如:

$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).

将使用文本谷歌(左对齐和换行,只是添加了一个更好的示例)编写一行。