Print job not work

C

cccc

Hi,
I have a big problem with lookupPrintServices method,

This code return a empty printService array.
-------------------------------
javax.print.attribute.PrintRequestAttributeSet pras=new
javax.print.attribute.HashPrintRequestAttributeSet();
javax.print.DocFlavor
flavor=javax.print.DocFlavor.INPUT_STREAM.TEXT_HTML_US_ASCII;
PrintService
printService[]=PrintServiceLookup.lookupPrintServices(flavor,pras);
---------------------------------------------

Why?

Thanks,
Carlo
 
A

Anthony Borla

cccc said:
Hi,

I have a big problem with lookupPrintServices method,

This code return a empty printService array.
-------------------------------
javax.print.attribute.PrintRequestAttributeSet pras=new
javax.print.attribute.HashPrintRequestAttributeSet();
javax.print.DocFlavor
flavor=javax.print.DocFlavor.INPUT_STREAM.TEXT_HTML_US_ASCII;
PrintService
printService[]=PrintServiceLookup.lookupPrintServices(flavor,pras);

Here is an excerpt from the relevant documentation [J2SDK 1.4]:

<quote>
lookupPrintServices

public static final PrintService[] lookupPrintServices(DocFlavor
flavor,
AttributeSet attributes)

Locates print services capable of printing the specified DocFlavor.

Parameters:

flavor - the flavor to print. If null, this constraint is not used.
attributes - attributes that the print service must support. If null
this constraint is not used.

Returns:

array of matching PrintService objects representing print services
that support the specified flavor attributes. If no services match,
the array is zero-length.

</quote>

So, no matching services are being found. Why ? Possibilities:

* No services installed, or
* Security-prevented access to said service; quoting relevant
documentation again:

<quote>
Services which are registered by registerService(PrintService)
will not be included in lookup results if a security manager is
installed and its checkPrintJobAccess() method denies access.
</quote>

I hope this helps.

Anthony Borla
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top