View Full Version : printing

10-19-2003, 03:11 AM

Need to print a document like a invoice. Does it take client side only?


10-19-2003, 05:57 AM
You can generate the page with ASP and then have the user hit print. You can even go as far as using javascript to open the print dialog up but you can't go any farther than that, there is no way to automatically cause something to print; at least with a web browser. (good thing too)

10-19-2003, 07:43 PM
So I can never have clients printing the invoices of this intranet?
What about that javascript code. With that I could build a client invoice page and have that print dialog open for the client. What do you think? Can you show me that code?

10-19-2003, 09:42 PM
Yeah so your ASP page builds the page and sends it to the client and then you can use the following code to bring up the print dialog box for them to print it.

<script type="text/javascript">
window.onload = PrintPage;

function PrintPage()

10-21-2003, 03:02 AM

10-21-2003, 03:23 AM
I did something like that using FSO too, where .txt file is formatted automatically (using spaces for formatting instead of tables, etc.) and opened by the browser, and then the user can print to their heart's content.

Then I delete it on Session_End using the global.asa file...

... it seems to work pretty well, allowing that you've made the user login using cookies or a session variable.

Seems like the above solution worked ok for you too though, and mine was more of a successful intranet experiment than anything else! :)

10-21-2003, 04:07 AM
didn't get you, whammy

10-21-2003, 04:19 AM
Ahh! Well as long as you have it working, great.

I didn't implement any specific JavaScript/CSS- controlled printing on this stuff, just made sure it was downloaded locally as a text file. I could tell you how to do it, but really it depends on your needs and I'd need to know more of what you're trying to accomplish with your end result. :)

10-26-2003, 07:43 AM
last month I found myself trying to print an invoice as well...
The results were not what we expected since it was hard to format the tables in order to make it look as the invoice they were using before coming from a print shop.
We ended up using a pdf component to generate a pdf document and then print from there...
It worked out great!