File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes How to choose a printer attached to the client?. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "How to choose a printer attached to the client?." Watch "How to choose a printer attached to the client?." New topic
Author

How to choose a printer attached to the client?.

Arul Vijay
Greenhorn

Joined: Apr 07, 2009
Posts: 2
In the web application i am working on, i need to print a pdf file to the local printer of the user. When i execute the code the print dialog box appears on the server system instead of the client. Can anyone assist me on how to print the file to a local printer of the user.

Thanks,
Arul
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39552
    
  27
Welcome to JavaRanch.

I'm confused - you're posting this in the Applet forum, so I'm guessing the code runs as part of an applet? If so, then it's not possible that the GUI would be shown on the server.

If, on the other hand, the code currently is part of a web app, then it would make sense that the print dialog is shown on the server (and thus useless). In that case, why not stream the PDF to the client, and let the user decide what to do with it - open it, save it, print it, whatever?


Ping & DNS - updated with new look and Ping home screen widget
Arul Vijay
Greenhorn

Joined: Apr 07, 2009
Posts: 2
Hi Dittmer,

Thanks for your immediate response

As you have said, currently my code is part of the web application.

My project requirement is that whenever a product comes to the warehouse, i have to generate a barcode and show a print dialog box to the user so he can select which printer to print to.

I have generated the barcodes in a PDF File. I have initially coded to stream the PDF file to the GUI but the client has told me not to display the contents of the PDF file in the GUI to the user, they just want me to show a print dialog box.

In the forum i read that using applets we can do this, but it was not clear. Is there any other way of achieving this.

Thanks,
Arul
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39552
    
  27
Well, a web app can't initiate action on the client, so whatever you end up doing will have to wait until the client next accesses the server.

What about a web page that shows the barcode as an image, and calls the JavaScript "print" method in the onLoad handler?
 
 
subject: How to choose a printer attached to the client?.
 
Similar Threads
Printing through a web application
How to print different file formats (pdf, word, txt, img , xls...) in java ?
transparent printing in java
Printing a text file on remote IP
how to print server file from client side