Jump to content
Changes to the Jaspersoft community edition download ×

How to set advanced printing option?


imation3m

Recommended Posts

When i send a request to printer, i want to set printer's advanced printing options also, like:

 

-Paper size

-Cut Mode

 

How can i set these advanced printing options?

 

I am trying the following code to get printer attributes, but its not returning advanced printing options, only normal printing options.

 

Code:

PrinterJob job = PrinterJob.getPrinterJob();

// Create an array of PrintServices
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);

int selectedService = 0;

// Scan found services to see if anyone suits our needs
for(int i = 0; i < services.length;i++){
if(services.getName().toUpperCase().equalsIgnoreCase(KioskFrame.PRINTER_MINI)){
//If the service is named as what we are querying we select it
selectedService = i;
}
}

try {
job.setPrintService(services[selectedService]);
} catch (PrinterException ex) {
ex.printStackTrace();
}

PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();

// For Testing purpose start
//setPrintRequestAttributes(printRequestAttributeSet);
PrintServiceAttributeSet set = services[selectedService].getAttributes();
Attribute[] attrib = set.toArray();
System.out.println("Size> " + set.size() + " length= " + attrib.length);
for(int i=0; i < attrib.length; i++)
System.out.println( attrib.getName() + "=" + attrib.getCategory());

 

Post edited by: imation3m, at: 2007/08/13 08:40

Post edited by: imation3m, at: 2007/08/13 08:42

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...