Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Any APi for printing

 
surendar prabu
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any API available doing a printing task through java code? I want something which can help in printing using a shared printer also.

regards,
Surendar
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean something like the javax.print API?
 
surendar prabu
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I need something like the javax.print API. but the API should support printing pdf files basically and any other report generation formats. Any third party API is also fine.

regards,
Surendar
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java printing API is just a way to access print drivers programmatically. If the printer doesn't understand a format, there's nothing Java can do about that. Printers understand text files, and laser printers generally understand PostScript. For just about anything else (HTML, RTF, PDF, DOC etc.) you need to run the file through a rendering process that generates something the printer can understand.

E.g., for PDF have a look into https://pdf-renderer.dev.java.net/ which renders PDF using Java2D. As such, you can adapt it to do printing.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic