• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 832
  • Last Modified:

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!
0
amb1313
Asked:
amb1313
1 Solution
 
oobaylyCommented:
You can't control what you send to the client's printer (for obvious security reasons). At best you can use the javascript window.print() method to open the print dialog for a html page. For a PDF document, the only thing you can do is return the document to the client and hope they print it.
0
 
ChetOS82Commented:
oobayly is 100% correct (posting this so you don't sit around hoping for a second opinion).
0
 
Jens FiedererCommented:
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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
amb1313Author Commented:
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?
0
 
Jens FiedererCommented:
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.
0
 
oobaylyCommented:
@amb1313
Yes, otherwise any webserver would be able to send any data to somebody's default printer. The spamming opportunities would be fantastic!
0
 
oobaylyCommented:
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".
0
 
Jens FiedererCommented:
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.
0
 
oobaylyCommented:
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.
0
 
Jens FiedererCommented:
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?)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now