This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Java in General and the fly likes Print to File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Print to File" Watch "Print to File" New topic

Print to File

Brigit Ananya

Joined: Nov 19, 2006
Posts: 2
I have 2 questions about print to file with java.awt:

1) With Java 1.4, when I use setFileName in the JobAttributes class, as soon as the user clicks on Print to File, this file name shows.
However, with Java 1.5, this file name does not show, a different file name shows. The reason why I want my file name to show is that I need a specific extension.

2) With Java 1.4, if in the window that comes up after clicking on Print to File, the user selects a specific directory where to save the file, the next time the user does a Print to File, the same directory comes up.
However, with Java 1.5, the selected directory is not remembered.

I do need to use java.awt, I cannot use javax.swing, because for printing to the printer, I need to call my own paint. Also, I need to use Java 1.5.

Please help, especially for question 1)

Thanks a lot!
Brigit Ananya

Joined: Nov 19, 2006
Posts: 2
The main problem was that the file name that I set in the JobAttributes class does not show in Java1.5, although it does show in Java 1.4.

For being able to see the file name should I just use:
FileDialog fileDialog = new FileDialog(frame, "out.eps", FileDialog.SAVE)
and where would I have to put this fileDialog?
I agree. Here's the link:
subject: Print to File
It's not a secret anymore!