File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Java Print Service question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Print Service question" Watch "Java Print Service question" New topic

Java Print Service question

xingxing Wang

Joined: Apr 26, 2006
Posts: 7

Did anybody use java print service before? Is it good one to print a HTML or PDF file programatically using its API? Any sample code?

Thank you in advance.
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
I'd rather use some more advanced implementations of the printing API like those offered by some open source projects such as Jasper Reports or JFreeReport

Would that help you?
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
PrintService is not the same as Jasper (and probably JFreeReport, which i dont know). Jasper is used to generate reports (in various formats as XLS, PDF, HTML, ...) while PrintService is used to get the data to the printer.
There is no direct support in java to print PDF even though there is a PDF doc flavor. (none that i am aware of)! you need a third party library (probably commercial) or go some extra miles (e.g. convert to PS first and then send this to the printer or use apache FOP to generate the PDF then you can also print it).

if you are looking for ways to generate PDF then there are some free solution that can be used like a printer where you print your document to a software printer which outputs PDF (i think iText is a solution for this)

I agree. Here's the link:
subject: Java Print Service question
jQuery in Action, 3rd edition