| Author |
Print Preview instead of print page
|
Sahana Hegde
Ranch Hand
Joined: Jan 27, 2008
Posts: 67
|
|
Hi guys, Is there any way in which I can get the print preview of the page using a javascript. I am using this function now. Can I get the print preview of this instead of print? Thanks
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
JavaScript just has window.print() out of the box so nope. You could look into ActiveX, but that limits you to IE only. Eric
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56229
|
|
|
The browser provides print preview (as provided by the print architecture of the underlying OS). Why do you need something more than the browser provides?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Sahana Hegde
Ranch Hand
Joined: Jan 27, 2008
Posts: 67
|
|
If thats not possible then I have another question. When I open the content in the above code in a new window. It keeps loading.The loading of the page does not stop. When I try to go to print preview from the menu it hangs. Sometimes it does not hang, when I go to print preview gives message "Please try after the page loads" How can I correct this? [ December 01, 2008: Message edited by: Sahana Hegde ]
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
When the window is hanging are you removing the line myWin.document.close();? That line is important and does not close the browser window. You should swap the print line too: to Eric
|
 |
Sahana Hegde
Ranch Hand
Joined: Jan 27, 2008
Posts: 67
|
|
I tried retaining only this code to check if it finishes loading. Still the same, keeps loading the page.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
You did not close the document like I said had to be done in my last post. You need the myWin.document.close() in there. Eric
|
 |
Sahana Hegde
Ranch Hand
Joined: Jan 27, 2008
Posts: 67
|
|
|
works thanks a lot.
|
 |
 |
|
|
subject: Print Preview instead of print page
|
|
|