Print from server side code in ASP.net?

  • Thread starter Thread starter Luis Esteban Valencia
  • Start date Start date
L

Luis Esteban Valencia

Print from server side code in ASP.net? is that possible I think without
using Javascript. Can u tell me a tutorial bout this: I saw somewhere
usiing the printdocumento bject
 
Luis Esteban Valencia said:
Print from server side code in ASP.net? is that possible I think without
using Javascript. Can u tell me a tutorial bout this: I saw somewhere
usiing the printdocumento bject

Print what? Print to where?

John Saunders
 
Luis Esteban Valencia said:
web pages !! obviously to the printer!!¡¡¡

To the client printer, or a server printer?

Besides, the answer is, the best you could do is write some JavaScript which
would print to the user's printer. Even then, client-side security might
prevent you from doing it without the user asking for the print.

John Saunders
 
web pages !! obviously to the printer!!¡¡¡
I don't believe John was trying to be mean, just trying to be polite to
explain (without as many words), it sounds like you are trying to code
something up which decides for the user to print something out, but it's
difficult to predict "where" to print to. This comes up every once in a
while in a client/server environment. The "where" means if you want to
force the client to print something, which client printer do you (the server
code) pick? Do you use the default printer, do you give the user a choice?
Either way, you may/most likely will have security implications. If you
want to print on the server end (highly unlikely but I've seen this happen),
then you can go ahead and do it, but the client might have to wait for the
hard copy to be sent to them. :>

If you want to totally control the user experience from the server end, you
could create a client control which your server code could talk to, in which
you send that control the doc to print and it controls it. But I've seen
this suggested in the past, and it's a bit more involved than what you are
probably looking for. Mabye?

You may want to change your scenario slightly. I've seen this where the
webpage provided a Print button and you either use JS to print the current
page (make sure it fits in the margins for the default printer), or goto
another page specifically designed for printer output.

Another solution I just saw two weeks ago, is to play with CSS with a
printer section, but I'm a bit ignorant on this area. I'm sure a google
search will clear things up if this sounds like what you want.

Good luck.
 
Back
Top