@Override public PrintServiceAttributeSet getAttributes() { return delegate.getAttributes(); }
String printerName = combobox.getSelectedItem().toString(); for (PrintService p: PrintServiceLookup.lookupPrintServices(null, null)) { if (p.getName().equals(printerName)) { doc.print(p.getAttributes()); break; } }
public static boolean checkAvailablePrinters() { PrintService[] ss = java.awt.print.PrinterJob.lookupPrintServices(); for (int i=0;i<ss.length;i++) { Attribute[] att = ss[i].getAttributes().toArray(); for (int j=0;j<att.length;j++) { if (att[j].equals(PrinterIsAcceptingJobs.ACCEPTING_JOBS)) { return true; } } } return false; }
AttributeSet att = printer.getAttributes();
package org.kodejava.example.print; import javax.print.PrintService; import javax.print.PrintServiceLookup; import javax.print.attribute.Attribute; import javax.print.attribute.AttributeSet; public class PrinterAttribute { public static void main(String[] args) { // // Locates the default print service for this environment. // PrintService printer = PrintServiceLookup.lookupDefaultPrintService(); if (printer != null) { // // Getting print service's attribute set. // AttributeSet attributes = printer.getAttributes(); for (Attribute a : attributes.toArray()) { String name = a.getName(); String value = attributes.get(a.getClass()).toString(); System.out.println(name + " : " + value); } } } }
jrExporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE, printService); jrExporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET, printService.getAttributes()); jrExporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.FALSE); jrExporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG, Boolean.TRUE);
PrintServiceAttributeSet pas = job.getPrintService().getAttributes(); if (pas!=null) { for (Attribute a : pas.toArray()) {