Link to home
Start Free TrialLog in
Avatar of amb1313
amb1313

asked on

Printing a PDF from ASP.NET app to client's printer

I have to print a PDF document to a printer from a web application written in ASP.NET.   The document needs to print to the client's printer (person visiting the site), NOT to the printer attached to the server where the website is running.  Does anyone know how to send a PDF to a client's printer?   I am currently trying to use itextsharp for this but no luck yet.   Any help would be greatly appreciated!
ASKER CERTIFIED SOLUTION
Avatar of oobayly
oobayly
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oobayly is 100% correct (posting this so you don't sit around hoping for a second opinion).
The experts that have already spoken are correct in the general case (if your page is visible by the world).

The exception would be if you have control of your end-users, and can force them to (for example) install an ActiveX control on their (Windows, InternetExplorer) clients.  This can open up the security hole you need to control them.
Avatar of amb1313
amb1313

ASKER

So even if I wanted to bring up the Printer Dialog box so they had to "confirm" the webpage's request before it actually got sent to the printer, there is no way to do that?
As oobayly said, you can use window.print() in an html page.
While you cant do that in a pure .PDF page, there is nothing stopping you from loading a PDF in a frame of an html page.
@amb1313
Yes, otherwise any webserver would be able to send any data to somebody's default printer. The spamming opportunities would be fantastic!
If it's a closed system, then go with a 3rd party tool, but if the site is for public consumption you can't be guaranteed it'll work. If it's an ActiveX object, it will only work for Internet Exploder, but IE7 doesn't enable ActiveX by default.

If I encounter a website that tells me "You need to install this plugin to continue" my reaction is "Go Jump".
I'm not going to click the "Object" button because it's really up to oobayly to do that, but your question WAS answered correctly, and requesting a deletion just because your question was not answered the way you would LIKE makes your "any help would be greatly appreciated" look very sad.
I'm afraid I am going to object. Unless you can come back and say I've use X component that allows me to get the user's browser to print a PDF automatically, another EE user will end up going through this process again only to be given the same answers we have provided.

Three people have given the same answer. Unfortunately the correct answer is sometimes "It's just not possible".

If you do find a component that allows to do what you want, post where you found it and accept that as your answer. I won't object to that as you will have answered your own question and it will be of use for future EE users.
PAQ'ing (closing) http:#a24268656

(is that right?  I'm trying to indicate the questing should be packed with oobayly's first response accepted, but your format recommendation is a bit cryptic - it does not make clear how to actually recommend.  Is there a link to an explanation of how to do this?)