Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Issue

Status
Not open for further replies.

DKL01

Programmer
Sep 14, 2000
233
US
Hi,

I have an asp page (page1.asp) in which I an PRINT button. PRINT buttons takes to another asp page (page2.asp) which executes the sql query, gets the result and polulates HTML table in page2.asp. User can print this page(report) by clicking on print button available on the browser.

Now I need to change the flow here. When the user clicks on PRINT button in page1.asp the system should automatically print the report. Is there any way I can implement the print command in page2.asp and then redirect back to page1.asp.

Thanks in advance
 
You can use javascript to do it -- use an onload function:

<script language=javascript>
function printRedirect(){
window.print();
setTimeout('location=&quot;prevPage.asp&quot;',5000);
}
</script>

<body onLoad=&quot;printRedirect();&quot;>

So that the page will spool to the printer, and then redirect itself after five seconds. Only drawback is that they will get the confirmation print dialog box -- but there isn't any way around that -- there isn't a way to get a webpage to spit off on the printer without any user intervention at all... they either have to push the button themselves, or they have to ok your .print() action.

:)
Paul Prewett

penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top