Is there a satisfactory way to print complex PDF files in Java

I have a black and white image with multiple images and printable text inside Java. The usual approach of rendering to a graphic object and sending it to a printer on java.awt.print or org.eclipse.swt.print leads to either a fuzzy result or takes several minutes to print (the rendering process is fast). I have already tried many openview rendering tools (PDFBox, jpod, PDF Renderer) or commercial products (crionics JPDF, Gnostice PDFOne, ...). It seems that all these libraries somehow use the java.awt.print API and display a PDF file for internal graphics. I am looking for a more direct approach, for example, converting pdf to a postscript (or another for a more readable printer format), and then printing it directly, without the need to create it in the first place).It should work for most printers, and for Win / MacOsX / Linux :)

+3
source share
1 answer

The trick I use in one of my applications is to execute an OS command using Runtime.exec (). It works great on Mac OS X and Linux with the lp command. On Windows, the command will be AcroRd32.exe / t, but the acrobat reader must be installed, and the .exe file must be somehow (by placing the directory in PATH, for example).

-1
source

Source: https://habr.com/ru/post/1757216/


All Articles