PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 22, 2022

[FIXED] Create link in pdf with tcpdf

 January 22, 2022     html, php, tcpdf     No comments   

Issue

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');

Solution

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



Answered By - Oldskool
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing