TCPDF open links in new tab/window
10,486
use the below method
<a href="javascript: w=window.open('yoursite.com/LinkToThePDF.pdf'); w.print(); w.close(); ">print pdf</a>
Author by
Yasin Yörük
Hi, I'm passionate developer. I love to working with VueJS. I mostly work on frontend developement also I have experience backend part. PHP is my favorite for backend part, I love use laravel or lumen.
Updated on June 12, 2022Comments
-
Yasin Yörük almost 2 years
How to open links in new tab/window which is in pdf document. I tried
target="_blank"
but it did not work. I was foundjavascript
solution on the internet. But how I can usejavascript
in tcpdf.I tried the following:
$text = 'bla bla bla bla bla bla bla bla<br>'; $url = "http://google.com"; $links = ' <a href="javascript:open_win('.$url.');">Click me</a> <a href="'.$url.'" target="_blank">Click me</a> '; $output = $text.$links; $pdf->writeHTML($output);
But it did not work.