views:

638

answers:

4

Hi,

I am having a J2EE based application, where I am using a reporting tool to generate outputs in PDF format. I need a utility/ tool in Java which can help me convert my PDF file to postscript format so that I can print it to a printer... My application will be running on a variety of OS (i.e. Windows / Linux / AIX) hence a platform independant solution is essential. My reporting tool does not support outputs in PS format. Please advice...

A: 

Maybe consider using jasper reports.

It will allow you to generate a report in a variety outputs (PDF, Html, RTF).

You can also export the report to a printer.

Edit:

Here is a quick example I found to export to a printer using JRPrintServiceExporter as opposed using a PDF exporter. It looks like it will do the job.

Gordon
Here's a link that *might* be useful for generating PS from Jasper: http://forums.codecharge.com/posts.php?post_id=57257
Kevin Day
Thanx Gordon for your help... I am infact using Jasper Reports for output generation, but I am not able to find any option to export the output to the printer... and the default supported formats do not include PS
Aniket Bharambe
+1  A: 

There are AFAIK no fool proof pure Java solutions for this, but if the conversion is to be done server-side, I would recommend you to use Ghostscript's pdf2ps converter. Even if you have to install a platform specific version of Ghostscript, you should find one for all the mentioned platforms.

jarnbjo
Ghostscript is free, and runs on all platforms. In the absence of good pure Java pdf->ps converters, this is the way to go.
Charles Stewart
A: 

There are several PDF libraries which can print PDFs. If you print to a Postscript Printer and use the print to file option, you could end up with Postscript.

mark stephens
A: 

Another solution "exe based", like Ghostscript, is Xpdf.PdfToPS
PdfToPs is a pure commandline application. Runs on Win, Linux and Solaris.
http://www.foolabs.com/xpdf/

Fabrizio