Forum Moderators: open

Message Too Old, No Replies

ASP Print Function

can this be done with ASP?

         

newnewbie1

12:50 pm on Oct 27, 2002 (gmt 0)

10+ Year Member



Hi! I would like to have a print function to print specific pages of the site. Basically, i would remove all toolbar icons and strip out all the page information, and when a user hits a print button, the browser would automatically start printing just like if the user hit the "print" button in the browser.

Can you do this with ASP? I'm running ASP 3.0 by the way... Or is this more of a javascript task?

korkus2000

1:16 pm on Oct 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you only want to print the page the person is currently viewing? If so, it is javascript that controls the browsers print engine. window.print() will make it work. AFAIK Asp cannot really do anything to the client. You have to leverage client side script. What you want to do is set up a printer friendly version that is linked from the page and put window.print() in the onLoad tag.

As far as printing multiple pages I really don't know how to do that with one click unless you get a pdf component on the server. These are in the 1000s of dollars so it is not a low tech solution.

Newnewbie

9:32 pm on Oct 27, 2002 (gmt 0)

10+ Year Member



Thanks Korkus! Yes, the info that I need to print will all be right there. So I will look into the javascript solution....

Thanks!

Iguana

10:19 pm on Oct 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As an extra tip - check out the <LINK media=print> use of css. If your toolbars etc are wrapped in <div> and the div class has display:none against it in the media=print css file - then they don't appear when you print. It allows you to define a different layout/style when printing rather than viewing

RossWal

10:20 pm on Oct 28, 2002 (gmt 0)

10+ Year Member




What you want to do is set up a printer friendly version that is linked from the page and put window.print() in the onLoad tag.

What about doing this in a new window, then closing the window after the print so the user ends up back where they started? Or staying in the same window and using a window.back() or window.location= to navigate back to the original page. Just thinking it might make for a smoother user experience. Maybe not.

Ross