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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I issue a printout of webpage?

Status
Not open for further replies.

Mortis

Programmer
Jul 27, 2001
1
SE
Hi!

I don't know if this is really the correct forum for this question, but it seems pretty close, so I will go for this.

I want to know if there's any way to issue a printout of the current webpage just by adding a button or something similar to the webpage. Further I would like this to be done without the button being visible on the printed paper.

I tried to just issue a Print command or something like that, I don't really remember the exact name of the command, in the ASP source code, but that only printed the source code of the page and not the formatted page, which is what I would like.

Thank's for any tips.

/ Mortis
 
You can use the javascript command, window.print();

Not sure what the vbscript is for that.
penny.gif
penny.gif
 
With VBScript, I think it's the same syntax.

As far as making it so the button won't print, you put some code in your page for the window_onBeforePrint event to make it invisible; then you put code for the window_onAfterPrint event to make it visible again.

Like this:
Code:
Sub window_OnBeforePrint()
    cmdMyPrintButton.style.display = "none"
End Sub

Sub window_OnAfterPrint()
    cmdMyPrintButton.style.display = "block"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top