Click here to Skip to main content
15,887,936 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a server that stores pdf documents. A website is hosted from this server so users can access their documents online.
I want to be able to click a link that would normally open the document in the browser, but instead of displaying the document I want it to automatically print to the clients default printer without any printer dialog windows popping up.
I need this to work in Chrome.
I realize there may be security risks involved, but I do believe it is do-able.

What I have tried:

I have searched for hours and tried many different things.

I have tried Print.js, but it opens a dialog.

The closest I have come is using the solution in this link. Only problem is it seems to be Firefox specific.
Printing without print confirmation dialog. • mozillaZine Forums[^]
Posted
Updated 29-Apr-19 4:27am
Comments
F-ES Sitecore 29-Apr-19 10:01am    
The reason you can't find a solution despite this being a very frequently asked question is because it isn't possible. You wouldn't want a website sending files to your printer without permission, would you?
[no name] 29-Apr-19 13:06pm    
"Automatically prints to the client's default printer" ... and you don't see a problem with that? (the "default" could be a FAX)

What other "favors" are you considering? How about "automatically adjusting the angle of attack"?
CandaceJ 30-Apr-19 2:30am    
Thanks a mil to all who replied. :). Thought it was a long shot but was still a little hopeful that there would be some way around it. Guess not.

You can't: you have no direct access to any client hardware, and cannot control in any way what happens to a document you provide from the server. The client browser is in complete control of what happens to it: opened, saved, printed; it all depends on the settings the user has selected in his specific browser.

Think about it: if you could do it, so could anyone - and we had enough of spam faxes back in the day, we don't want spam website printouts ... :laugh:
 
Share this answer
 
Quote:
I realize there may be security risks involved, but I do believe it is do-able.

Short answer: it is forbidden for security reasons, otherwise any hacked page would start print garbage.
Even if you find ways to do it, it is hacker stuff and will be specific to browser and version and may disapeer anytime.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900