Reputation: 2563
as I am new to Javascript you guys might save me some time answering this simple question.
How to make Javascript functionality that prints linked document(not the current window).
Lets say that www.example.com/print/index.html
contains button
that I want to print www.example.com/print/example.html
content.
Solution I have found so far opens 2 new windows(content itself & print preview) and that hurts me, as I want print preview
only
window.open('www.example.com/print/example.html').print();
Thank you
Upvotes: 2
Views: 8499
Reputation: 153
If you are open to jquery here is a plugin that does what you need:
http://www.position-absolute.com/articles/printing-web-pages-a-new-jquery-printing-plugin/
You can always do the same in javascript as well, the idea is to get the content of page2.html in an hidden iframe on page1.html from where you want to trigger the print, here is a discussion on the same, look at the solution from Trace.
Upvotes: 1
Reputation: 176896
There is no solution that you can print page2 by putting print button on page1 here are some solution that might help you to achieve your task easily : How to print a web page without opening a popup window?
Upvotes: 2