Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Changing the user owner of a PrintJob

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi There,

In reference of Changing the printjob owner , i'm trying to set the JobOriginatingUserName of a PrintJob.

I set my Attribute like this:
HashPrintJobAttributeSet aset = new HashPrintJobAttributeSet();
aset.add(new JobOriginatingUserName("myusername", null));

I can set it to a PrintService like this:
    PrintService[] services = PrintServiceLookup.lookupPrintServices(null, aset);

But I can't set it to a docPrintJob:
job.print(myDoc, jobAttrSet);

Did somebody have some documentation on it ? My goal is to see my PrintJob in the printer manager running with the name "myusername" and not thename of the user who start the Java process....
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, there's no way to set the user of a print job. JobOriginatingUserName is really only intended to be used to query (not set) the user name, which is why you can't assign a value for a PrintRequestAttributeSet.

As far as documentation on this goes, I believe this would be the most relevant page I can find offhand: Attribute Roles.

Basically what it says is that not every attribute is valid in every context.
 
Samuel Etterlen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your precise answer...

In an other way, did you think that it's possible to instanciate a class on behalf of an other user ?
I saw that it's possible to do this in .net like this:



 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic