How to print PDF file in a Java application?

java, pdf, printing

Solution

Here some source code that will allow you print any text file:

public void print() {
    //The desktop api can help calling other applications in our machine
    //and also many other features...
    Desktop desktop = Desktop.getDesktop();
    try {
    //desktop.print(new File("DocXfile.docx"));
        desktop.print(new File("Docfile.pdf"));
    } catch (IOException e) {           
        e.printStackTrace();
    }
}

Maybe it suit your needs since you did not give more details.

Problem

How do I print a PDF file from a Java application?

Original source