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

How can I print PDFs using Java??  RSS feed

 
Travis Gibson
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Fellow Ranchers,
Once again I am looking for a little assistance. I am trying to figure out how to Print PDFs using Java. I found an API for creating PDFs at www.etymon.com However producing these files and printing them are two different animals. I don't know enough about the PDF language to understand how to decode it so I can use one of my print routines to print it.
Help!
Travis Gibson, SCJP
 
John Bateman
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I can't tell you how to do this actaly but if you check out http://www.javaworld.com they are running a series of (6 I think) articles on doing complex printing in Java.
Hope this helps.
 
Travis Gibson
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
I actually had already check out the Java World Articles, however they want you to write your own PDF implementation.
I actually found a way to use the Acrobat Reader in Windows by using the following:
String command = "AcroRd32.exe /p /h C:/TestPDF.pdf";
Runtime.getRuntime().exec(command);
It passes the pdf file to the Reader which prints it in the background with no pop-up window. The only problem is I cannot get it to work in a servlet. Go any ideas?
Regards,
Travis M Gibson, SCJP
 
sandeep singla
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Travis,
I am also looking for the same solution.I want to generate the pdf files with the help of java API.I will definately research on this and will share with you.I will appreciate if you keep on updating regarding the same.Well have you been able to get some success in this, please tell.
Thanking you in anticipation,
Sandeep Singla.
[This message has been edited by sandeep singla (edited March 14, 2001).]
[This message has been edited by sandeep singla (edited March 15, 2001).]
 
John Bateman
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Travis Gibson:
John,
It passes the pdf file to the Reader which prints it in the background with no pop-up window. The only problem is I cannot get it to work in a servlet. Go any ideas?

Since your servlet runs ON the server (and not the client like an application) I wonder if you really can do this with a servlet. Any commands you issue like using "Runtime" will be executed on the server and not on the machine that is connected to your site.
I'm not sure if you can print a pdf from a servlet but I will keep my eyes open for anything that may help.
Sorry.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!