File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Job name when printing file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Job name when printing file" Watch "Job name when printing file" New topic

Job name when printing file

Paulo Carvalho
Ranch Hand

Joined: Nov 12, 2008
Posts: 57

I made a Java application which prints a file.

When the application sends the file for print, I define an attribute to give a name for the print Job so I can recognize the file being printed. To do this I have the following code:

// Monitor print job events
PrintJobManagment pjm = new PrintJobManagment(dPJ);
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
pras.add(new JobName("1.doc", null));
dPJ.print(doc, pras);

Using java 1.6, everything works fine. When I open the printer queue I can see the file ("1.doc") being printed.

Using Java 1.5 the result is not the same: When I open the printer queue I can see a file being printed but I cannot identify it by this name. It is always called "Local Document" (or something similar).

As I must use Java 1.5 and I must be able to recognize the file being printed, anaybody can give me some information about this problem? Who can I resolve it? Is there any workaround?

Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

Do the Javadocs tell you of a change to the API between 1.5 and 1.6?

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
I agree. Here's the link:
subject: Job name when printing file
It's not a secret anymore!