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

Printing Through ASP 1

Status
Not open for further replies.

dcusick

Technical User
Aug 9, 2000
271
US
What I would like to do is print a page off of my website with the click of a button. I would like to be able to format the page too. It's a little big to fit on one page, so I don't know if it's possible but something similar to Excel's "Fit on One Page" option would work perfectly... or at least being able to default the print to Legal size paper... Any help would be greatly appreciated.

Doug
 
There is nothing like this within ASP. ASP is a server-side script, so you can't even control the printing on the client-side. The good news is that you can do some stuff on the client-side (not much though).

First, you can put a print button or print link, e.g.
<a href=&quot;#&quot; onclick=&quot;document.print()&quot;>print me</a>

Second, you can format how the page prints by specifing two CSS definitions:
page-break-before and page-break-after. Look up MSDN help for these two items to learn their syntax.

I hope this was helpful.



---
---
 
Can you tell it to print something on the server side?
If so can you apply a CSS to it or some other kind of automatic formatting?

I ask because we have a client who prints work tickets from an intranet application. They don't like the fact that they get the box prompting for the printer and number of copies. He's worried that they'll change the number of copies and end up with multiple work tickets for the same order floating around.

Earme
 
That looks nifty, but we don't want to have to spend money on a pre-packaged solution. Any other suggestions?

Earme
 
basic version is free and it does most of the work
 
what about Php4? it runs on IIS5 now. Plenty of scripts for it if you look...
 
ActiveX enabled Browsers Support ScriptX and it works fine under Win9x/nt/2k platforms
 
I believe that in the version of ScriptX that you currently can buy, yes you can disable the printing prompt box that asks for a printer and number of copies. However, this is in the 'Advanced' printing capabilites that requires a license and runs at least $350. The basic version still gives you the prompt.

Examples of functionality:

Earme
 
I would rather suggest, the code line used/indicated by Rydel in the first reply is correct, but you can also used window.print() option too insted of document.print().
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top