Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing a PDF without opening it  RSS feed

 
dinesh chanchlani
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have to silent print(without print dialogue box) a pdf file without opening it,how can this be done in java?Can itext help in this?Also if the pdf file is on the server,client is given a print button on the GUI,when button is clicked, i want the pdf to get silent printed on clients printer.How can this be achieved?Please help me on this.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you mention client and server, is this a web application?
 
Norm Radder
Ranch Foreman
Posts: 2212
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your client program can read the pdf file from the server
and if it has the classes to decode/expand the contents of the pdf
and if the client program can print, then that is how you would do it.

Part 1 would be a simple HTTP GET with some class or combos of classes like URL and openConnection and InputStream.
Part 2 - might be a package that does that. Google for it.
Part 3 - Probably would come with Part 2, otherwise write some printer code.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this discussion for various points to consider. It's hard to advise without knowing what kind of client and server you're talking about.
 
dinesh chanchlani
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response.
Yes it is a web application.Ulf i have similar(link which you mentioned) requirement,as you have mentioned it is impossible to achieve that,does that mean the pdf file should be first saved on the clients machine and then client can print it as per his wish?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's up the client. The browser may have been set to open PDFs, in which case printing is possible without explicitly saving it first.

But in general, don't presume to tell the user what to do with a file (open, save, print, delete, read, ignore, whatever). The user generally knows better than the developer what he wants to do with a file.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!