如何在Java应用程序中打印PDF文件? [英] How to print PDF file in a Java application?
本文介绍了如何在Java应用程序中打印PDF文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从Java应用程序打印PDF文件?
How do I print a PDF file from a Java application?
推荐答案
这里有一些源代码可以让你打印任何文本文件:
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.
这篇关于如何在Java应用程序中打印PDF文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文