RFR: 8314070: javax.print: Support IPP output-bin attribute extension [v9]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Mon May 20 07:21:09 UTC 2024
On Sat, 11 May 2024 17:32:37 GMT, Alexander Scherbatiy <alexsch at openjdk.org> wrote:
>> The fix adds new public `OutputBin` print attribute class which allow to set a printer output bin in a `PrinterJob` class. The corresponding internal `CustomOutputBin` class is added as well.
>>
>> - Constants used in `OutputBin` class are based on [Internet Printing Protocol (IPP): “output-bin” attribute extension](https://ftp.pwg.org/pub/pwg/candidates/cs-ippoutputbin10-20010207-5100.2.pdf) document.
>> - `CUPSPrinter.getOutputBins(String printer)` method uses PPD `ppdFindOption(..., "OutputBin")` function to get supported output bins for the given printer on native level.
>> - The fix propagates the `OutputBin` attribute from the printer job attributes to `NSPrintInfo` print settings with `OutputBin` key on macOS.
>>
>> The fix was tested on `Kyocera ECOSYS M8130cidn` printer where `ppdFindOption(..., "OutputBin")` call returns 4 output bins (text, choice):
>> - Printer settings, None
>> - Inner tray, INNERTRAY
>> - Separator tray, SEPARATORTRAY
>> - Finisher (face-down), Main
>>
>> if `Printer settings`, `Inner tray`, or `Finisher (face-down)` CustomOutputBins is set to `PrinterJob.print(...)` attributes a test page is printed to the Main tray of the `Kyocera ECOSYS M8130cidn` printer. If `Separator tray` is used a page is printed to the Separator tray. This is consistent with the printer behavior when a native print dialog is used from a native Preview app to print a document on macOS.
>
> Alexander Scherbatiy has updated the pull request incrementally with one additional commit since the last revision:
>
> Make OutputBin class sealed
src/java.desktop/share/classes/javax/print/attribute/standard/OutputBin.java line 46:
> 44: * <p>
> 45: * <b>IPP Compatibility:</b> This attribute is not an IPP 1.1 attribute; it is
> 46: * an attribute in the "output-bin" attribute extension
Are we also supporting "output-destination" attribute to specify printing to a destination as per the IPP doc
>
> Since the destination may also
> be electronic and have a method associated with it, also allow the uri attribute syntax. Probably call this
> other attribute “output-destination” with an attribute syntax of (1setOf uri | name). Or possibly the output-
> destination should be a parameter on the URL?
>
src/java.desktop/share/classes/javax/print/attribute/standard/OutputBin.java line 137:
> 135: "face-up",
> 136: "face-down",
> 137: "large-capacity",
Are we considering this from IPP doc for the internationalization of this keywords?
> Normally a client will provide localization of the keywords values of this attribute to the language of the
> user,
src/java.desktop/share/classes/javax/print/attribute/standard/OutputBin.java line 154:
> 152: FACE_UP,
> 153: FACE_DOWN,
> 154: LARGE_CAPACITY,
What about this support from IPP doc?
> ‘tray-N’: Output bins that are best identified as ‘tray-1’, ‘tray-2’, ... rather than the descriptive names
> defined in the above keyword list.
>
src/java.desktop/share/classes/javax/print/attribute/standard/OutputBin.java line 184:
> 182: */
> 183: @Override
> 184: public final Class<? extends Attribute> getCategory() {
It does not seem this PR supports
`output-bin-default` mentioned in the IPP doc, which will be returned via [getDefaultAttributeValue](https://docs.oracle.com/en/java/javase/22/docs/api/java.desktop/javax/print/PrintService.html#getDefaultAttributeValue(java.lang.Class))([Class](https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/Class.html)<? extends [Attribute](https://docs.oracle.com/en/java/javase/22/docs/api/java.desktop/javax/print/attribute/Attribute.html)> category)?
If not, what this API will return?
src/java.desktop/unix/classes/sun/print/CUPSPrinter.java line 65:
> 63: private static synchronized native String[] getMedia(String printer);
> 64: private static synchronized native float[] getPageSizes(String printer);
> 65: private static synchronized native String[] getOutputBins(String printer);
Will it return all the output-bins or only the supported ones? Iguess it's the latter, then I think it's better to rename it as "getSupportedOutputBins" as this follows "“output-bin-supported” attribute of IPP document..
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1606307018
PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1606328005
PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1606325741
PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1606310284
PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1606302826
More information about the client-libs-dev
mailing list