On Wed, 13 Dec 2023 15:58:03 GMT, Alexander Scherbatiy <alex...@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: > > Add output bins support to the common print dialog The common print dialog is updated to show supported output bins. - `OutputPanel` is added to the `ServiceDialog` to show list of supported output bins in the ComboBox. - `order.output` and `label.outputbins` properties are added to `serviceui.properties`. - `CPrinterJob.nsPrintInfoToJavaPrinterJob()` method is updated to add the selected output bin from the native print dialog to the printer job attributes. - `OutputBinAttributePrintDialogTest` manual test that checks only printing to the first and the last supported output bins with common and native print dialog is added. Common print dialog with the fix which shows list of supported output bins on macOS: <img src="https://github.com/openjdk/jdk/assets/23520046/ce66ab7d-9783-4e4f-93b9-207bad836541" width="50%"> The same dialog with disabled output trays when the list of output bins is empty: <img src="https://github.com/openjdk/jdk/assets/23520046/be50f92b-e346-4a42-9f52-bf4089e30e5f" width="50%"> The same dialog without the fix: <img src="https://github.com/openjdk/jdk/assets/23520046/904d60b3-d7a1-4235-a415-317b7dcba300" width="50%"> There is the comment on `social.msdn.microsoft.com` forum that wingdi does not support setting output bin attribute programmatically: "'Output tray" is a printer-specific property (note that you will only see such an option in the printing interface for certain printers). There is no way to programmatically set an output tray, since there is no generic way of doing it via .NET (or even Win32 via the DEVMODE structure). The only way to set it is to allow the user to choose it via the provided printer dialog for the few printers that provide this capability (just as you must do via IE or Word). It is sometimes possible to do this programmatically (without the dialog) for a specific printer if you know exactly how that printer driver implements the change...but that is unsupported except possibly from the printer manufacturer. https://social.msdn.microsoft.com/Forums/en-US/b15eda2f-5353-41fc-b935-078ed0960aee/printing-into-a-specific-output-bintray-net That is why `OutputPanel` is excluded from the `ServiceDialog` on Windows. ------------- PR Comment: https://git.openjdk.org/jdk/pull/16166#issuecomment-1854213300