如何在java中将docx文件打印到pdf [英] How do I can print docx file to pdf in java

查看:75
本文介绍了如何在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.


这篇关于如何在java中将docx文件打印到pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆