Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCPDF open links in new tab/window

How to open links in new tab/window which is in pdf document. I tried target="_blank" but it did not work. I was found javascript solution on the internet. But how I can use javascript 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.

like image 804
Yasin Yörük Avatar asked Apr 01 '13 11:04

Yasin Yörük


1 Answers

use the below method

<a href="javascript: w=window.open('yoursite.com/LinkToThePDF.pdf'); w.print(); w.close(); ">​​​​​​​​​​​​​​​​​print pdf</a>
like image 145
Krish Avatar answered Oct 16 '22 07:10

Krish