If you want to find an easy way and fast way to print in using java any text file, you can use the desktop api to do it.(Note this is not the best approach, but can get you unstuck in certain occasions).
1: public void print() {
2: //The desktop api can help calling other applications in our machine
3: //and also many other features...
4: Desktop desktop = Desktop.getDesktop();
5: try {
6: //desktop.print(new File("DocXfile.docx"));
7: desktop.print(new File("Docfile.pdf"));
8: } catch (IOException e) {
9: e.printStackTrace();
10: }
11: }
No comments:
Post a Comment