How to open a link new tab with print command?

65,955

Solution 1

You could try something like this:

<a href="javascript: w=window.open('http://yoursite.com/LinkToThePDF.pdf'); w.print(); w.close(); ">​​​​​​​​​​​​​​​​​print pdf</a>

Solution 2

This method works well for me.

<a href="/url/" onclick="window.open(this.href).print(); return false">

Solution 3

There is no way for a website to cause a browser to load a third party website and display the print dialog for it automatically.

Solution 4

<img src="print.png" style="cursor:hand" onclick="window.frames['pact'].print();"><iframe name="pact" src="pact.pdf" width="0" height="0" frameborder="0"></iframe>
Share:
65,955
Sandy
Author by

Sandy

Updated on October 28, 2021

Comments

  • Sandy
    Sandy over 2 years

    I have a hyperlink with contains third party website link. I want to open this link in new tab with print command. How can i do this? Suppose:

    <a href="www.google.com" target="_blank">Print</a>
    

    Note: I know how to open a link in new TAB/Window. I want to know how to open with PRINT DIALOG.