Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to choose a printer attached to the client?.

 
Arul Vijay
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Arul Vijay
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic