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 = "";
$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.
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.";
$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.
Share Improve this question edited Jun 3, 2015 at 5:17 royhowie 11.2k14 gold badges53 silver badges67 bronze badges asked Apr 1, 2013 at 11:49 Yasin YörükYasin Yörük 1,5397 gold badges27 silver badges56 bronze badges 8- show me you code and what have you done so far? – Krish Commented Apr 1, 2013 at 11:52
-
$text = 'bla bla bla bla bla bla bla bla<br>';
$url = "http://google.";
$links = ' <a href="javascript:open_win('.$url.');">Click me</a> <a href="'.$url.'" target="_blank">Click me</a> ';
$output = $text.$links;
$pdf->writeHTML($output);
– Yasin Yörük Commented Apr 1, 2013 at 11:57 -
I cant give break for lines. It's looking plicated. Problem; I have 2 links in pdf but these are not opens in new window. I tried
javascript
andtarget="_blank"
– Yasin Yörük Commented Apr 1, 2013 at 12:00 - Is it okay for you if it acplished by html or you must need a javascript solution? – Krish Commented Apr 1, 2013 at 12:10
- I prefer HTML solution. But If not, I can use javascript. – Yasin Yörük Commented Apr 1, 2013 at 12:22
3 Answers
Reset to default 1use the below method
<a href="javascript: w=window.open('yoursite./LinkToThePDF.pdf'); w.print(); w.close(); ">print pdf</a>
you can open a the pdf by adding a target="_blank" in your form method
<form method="post" target="_blank">
...
</form>
In short it is not possible here is SO answer that clarifies.
https://stackoverflow./a/39763562/1695062