Two Laptop Bag*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Silent Print from Servlet" Watch "Silent Print from Servlet" New topic
Author

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:

http://java.sun.com/docs/books/tutorial/2d/printing/printable.html
http://forums.sun.com/thread.jspa?threadID=216673
http://forums.sun.com/thread.jspa?messageID=2444768
http://forums.sun.com/thread.jspa?forumID=256&threadID=222201
http://forums.sun.com/thread.jspa?messageID=912588

Thanks for your time,
Crystal

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

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 7 API documentation
Scala Notes - My blog about Scala
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
Sheriff

Joined: Oct 27, 2005
Posts: 19674
    
  18

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!


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

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.


Steve
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.
 
jQuery in Action, 2nd edition
 
subject: Silent Print from Servlet