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();
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();