如何在java中将docx文件打印到pdf

问题描述:

您好,



我希望在我的java应用程序文档中打印* .docx到* .pdf文件,

(不用转换!!)





谢谢



我是什么尝试过:



Hello,

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


thanks

What I have tried:

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

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

}

参见桌面(Java Platform SE 7) [ ^ ]。您需要确保所有打印命令都转到PDF打印机。
See Desktop (Java Platform SE 7 )[^]. You need to ensure that all print commands go to your PDF printer.