I have a grayscale pdf with a few images and Text to print inside of Java. The usual approach via rendering to a graphics object and sending to a printer per java.awt.print or org.eclipse.swt.print results either in a blurred output or takes several minutes to print (The rendering process is fast though). I have already tried many opensource renderer (PDFBox, jpod, PDF Renderer) or commercial products (crionics JPDF, Gnostice PDFOne,...). It seems all these libraries are using in some way the java.awt.print API and render the pdf File to the internal graphics. I'm looking for a more direct approach, like converting the pdf to postscript (or another, for the printer more readable format) and then printing it directly, without the need of rendering it first). It should work for most printers and on Win/MacOsX/Linux likewise :)
A:
The trick I am using in one of my applications, is to execute an OS command with Runtime.exec(). It works fine on Mac OS X and Linux with the command lp . On Windows the command would be AcroRd32.exe /t , but the acrobat reader must be installed and the .exe file must be located somehow (by putting the directory in the PATH for instance).
Maurice Perry
2010-07-30 12:23:07