Print Services

T

Tim

I'm trying to use the Java 1.4 Print Services API for Printing, but
I'm having an issue getting the PageRanges class to populate based on
changes the user makes when the Print Dialog is shown. In the code
below, I verified that PageRanges is a supported Attribute Category,
But When I try to get the category from teh PrintService or the
PrintJobAttributeSet I get Null. Has anyone had the same problem or
do you know what I am doing wrong? I also tried a number of different
DocFlavors but with no luck.

Thanks,

Tim


public void print()
{
PrintRequestAttributeSet pras = new
HashPrintRequestAttributeSet();
DocFlavor flavor = DocFlavor.BYTE_ARRAY.JPEG;
PrintService printService[] =
PrintServiceLookup.lookupPrintServices(flavor,pras);
PrintService defaultService =
PrintServiceLookup.lookupDefaultPrintService();
int upperBound = 20;
PageRanges pr = new PageRanges(1,upperBound);
pras.add(pr);
PrintService service =
ServiceUI.printDialog(null,200,200,printService,printService[0],flavor,pras);
if (service != null)
{
Class[] c = service.getSupportedAttributeCategories();



PrintServiceAttributeSet p = service.getAttributes();


DocPrintJob job = service.createPrintJob();

PrintJobAttributeSet pjas = job.getAttributes();
 

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

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top