Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I want print in my java application document that *.docx to *.pdf file,
(no with convert!!)


thanks

What I have tried:

C#
public void printToPDF (ActionEvent actionEvent) {
    File file = new File("C:\\printToPDF.docx");

      try {
          Desktop.getDesktop().print(file);
      } catch (IOException e) {
      }

}
Posted
Updated 19-Jun-16 22:05pm

1 solution

See Desktop (Java Platform SE 7 )[^]. You need to ensure that all print commands go to your PDF printer.
 
Share this answer
 
Comments
nav571 20-Jun-16 7:56am    
thank, but I used this class, now really need "to ensure that all print commands go to your PDF printer"... and my question: "How can I do it"
Richard MacCutchan 20-Jun-16 9:52am    
Configure your PDF printer to be the default.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900