开发者

Is there a satisfying way of printing complex PDF-Files in Java

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 fas开发者_如何学编程t 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 :)


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜