• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

How to choose a printer attached to the client?.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sasparilla and fresh horses for all my men! You will see to it, won't you tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic