File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Silent Print from Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Silent Print from Servlet" Watch "Silent Print from Servlet" New topic

Silent Print from Servlet

Crystal Bazil
Ranch Hand

Joined: Sep 28, 2004
Posts: 38
Hello -

I have been researching how to setup silent printing and I am thouroughly confused and overwhelmed with the information I have read. Below you will see the code I have at the moment. I have tried various examples but cannot get anything to print or even open the print dialouge prompt.

I am hoping someone would be kind enough to point me in the right direction or provide some new links. So far I have referenced the following:

Thanks for your time,

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15092

Do you realize that when you do this in a servlet, the printing will happen on the server and not on the client's computer, and that if a dialog will be shown, it will show on the server's screen, and not the user's computer?

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Crystal Bazil
Ranch Hand

Joined: Sep 28, 2004
Posts: 38
Nope, I hadn't even considered that point. Doh. Well atleast now you know what level of expertise you are dealing with =)

I would like the ability to silently print(to a named client printer) when a user updates a record from my web application. I am just not sure how to intergrate this into my existing structure.

Could you help guide me?
Rob Spoor

Joined: Oct 27, 2005
Posts: 20276

Are you sure you want to do that? Without letting the user even know you're going to print something?

If that were possible it would be a great way to mess around with people. They hit your site: BAM! 1000 prints coming up!

How To Ask Questions How To Answer Questions
Steve Luke

Joined: Jan 28, 2003
Posts: 4181

You would have to use client side code, like an Applet or a WebStart application.

I am not sure what access an un-signed applet would have to a printer. I think in most cases you will have to have some client interaction, even if it is just to say "Yes you are allowed to run that code".

You can use JavaScript to start an interactive print job, but not a silent one AFAIK.

Crystal Bazil
Ranch Hand

Joined: Sep 28, 2004
Posts: 38
The end user would expect the print job. Let me explain, I have built a crib function which allows crib attendants to issue tooling to the floor. Once they issue a tool it will need a new calibration sticker. They might issue multiple items in one batch therefore my thought process was to silently print so they would not get prompted for each sticker.
Crystal Bazil
Ranch Hand

Joined: Sep 28, 2004
Posts: 38
Sorry Steve I didnt see your response before my last post.
I agree. Here's the link:
subject: Silent Print from Servlet
It's not a secret anymore!