Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8331601

javax.print: Support IPP output-bin attribute extension

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 23
    • client-libs
    • None
    • 2d
    • source
    • minimal
    • Minimal - new API
    • Java API
    • SE

      Summary

      Support the IPP output-bin attribute extension in the javax.print API

      Problem

      Output Bin is an IPP extension attribute https://ftp.pwg.org/pub/pwg/candidates/cs-ippoutputbin10-20010207-5100.2.pdf

      It is not defined in the core RFC on which the javax.print API was based https://www.ietf.org/rfc/rfc2911.txt so there is no javax.print API which allows an application to select a printer output tray.

      Solution

      Define a new javax.print.attribute.standard.OutputBin attribute class as specified in the 'Internet Printing Protocol (IPP): "output-bin" attribute extension' document: https://ftp.pwg.org/pub/pwg/candidates/cs-ippoutputbin10-20010207-5100.2.pdf.

      An application can then retrieve an OutputBin from the supported attributes or use one of the provided OutputBin constants to print a page to the requested output tray

              PrintService service = PrintServiceLookup.lookupDefaultPrintService();
              // check the service for null
              OutputBin[] supportedOutputBins = (OutputBin[]) service
                      .getSupportedAttributeValues(OutputBin.class, null, null);
      
              PrinterJob job = PrinterJob.getPrinterJob();
              // set the job Printable
              PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet();
              // check the supportedOutputBins size
              attrs.add(supportedOutputBins[1]);
              job.print(attrs);

      Specification

      The public sealed javax.print.attribute.standard.OutputBin class is added which extends javax.print.attribute.EnumSyntax class and implements javax.print.attribute.PrintRequestAttribute and javax.print.attribute.PrintJobAttribute interfaces:

      
      javax/print/attribute/standard/OutputBin.java
      
      +/**
      + * Class {@code OutputBin} is a printing attribute class, an enumeration, that
      + * specifies the output bin for the job.
      + * <p>
      + * Class {@code OutputBin} declares keywords for standard output bin values.
      + * <p>
      + * <b>IPP Compatibility:</b> This attribute is not an IPP 1.1 attribute; it is
      + * an attribute in the "output-bin" attribute extension
      + * (<a href="https://ftp.pwg.org/pub/pwg/candidates/cs-ippoutputbin10-20010207-5100.2.pdf">
      + * PDF</a>) of IPP 1.1. The category name returned by {@code getName()} is the
      + * IPP attribute name. The enumeration's integer value is the IPP enum value.
      + * The {@code toString()} method returns the IPP string representation of the
      + * attribute value.
      + */
      +public sealed class OutputBin extends EnumSyntax implements PrintRequestAttribute, PrintJobAttribute {
      +
      +    @Serial
      +    private static final long serialVersionUID = -3718893309873137109L;
      +
      +    /**
      +     * The top output bin in the printer.
      +     */
      +    public static final OutputBin TOP = new OutputBin(0);
      +
      +    /**
      +     * The middle output bin in the printer.
      +     */
      +    public static final OutputBin MIDDLE = new OutputBin(1);
      +
      +    /**
      +     * The bottom output bin in the printer.
      +     */
      +    public static final OutputBin BOTTOM = new OutputBin(2);
      +
      +    /**
      +     * The side output bin in the printer.
      +     */
      +    public static final OutputBin SIDE = new OutputBin(3);
      +
      +    /**
      +     * The left output bin in the printer.
      +     */
      +    public static final OutputBin LEFT = new OutputBin(4);
      +
      +    /**
      +     * The right output bin in the printer.
      +     */
      +    public static final OutputBin RIGHT = new OutputBin(5);
      +
      +    /**
      +     * The center output bin in the printer.
      +     */
      +    public static final OutputBin CENTER = new OutputBin(6);
      +
      +    /**
      +     * The rear output bin in the printer.
      +     */
      +    public static final OutputBin REAR = new OutputBin(7);
      +
      +    /**
      +     * The face up output bin in the printer.
      +     */
      +    public static final OutputBin FACE_UP = new OutputBin(8);
      +
      +    /**
      +     * The face down output bin in the printer.
      +     */
      +    public static final OutputBin FACE_DOWN = new OutputBin(9);
      +
      +    /**
      +     * The large-capacity output bin in the printer.
      +     */
      +    public static final OutputBin LARGE_CAPACITY = new OutputBin(10);
      +
      +    /**
      +     * Construct a new output bin enumeration value with the given integer
      +     * value.
      +     *
      +     * @param value Integer value
      +     */
      +    protected OutputBin(int value) ;
      +
      +    /**
      +     * Returns the string table for class {@code OutputBin}.
      +     */
      +    @Override
      +    protected String[] getStringTable() ;
      +
      + /**
      + * Returns the enumeration value table for class {@code OutputBin} .
      + */
      + @Override
      + protected EnumSyntax[] getEnumValueTable(); + + /** + * Get the printing attribute class which is to be used as the "category" + * for this printing attribute value. + * <p> + * For class {@code OutputBin} and any vendor-defined subclasses, the category + * is class {@code OutputBin} itself. + * + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} + */ + @Override + public final Class<? extends Attribute> getCategory(); + + /** + * Get the name of the category of which this attribute value is an + * instance. + * <p> + * For class {@code OutputBin} and any vendor-defined subclasses, the category + * name is {@code "output-bin"}. + * + * @return attribute category name + */ + @Override + public final String getName() ; +}

            alexsch Alexandr Scherbatiy
            prr Philip Race
            Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: