javascript - TCPDF open links in new tabwindow - Stack Overflow

How to open links in new tabwindow which is in pdf document. I tried target="_blank" but it

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 and target="_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
 |  Show 3 more ments

3 Answers 3

Reset to default 1

use 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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742420444a4440575.html

相关推荐

  • javascript - TCPDF open links in new tabwindow - Stack Overflow

    How to open links in new tabwindow which is in pdf document. I tried target="_blank" but it

    5小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信