Re: 8246742:Inquiry about PrintDialog Properties button behavior on Linux
Philip Race
philip.race at oracle.com
Wed Mar 26 17:18:23 UTC 2025
1. 1.Is this considered an accepted platform behavior difference?
2. yes. The properties for windows is the only way to allow the user to
interact with driver extensions which NO platform API supports.
3. 2.Are there any plans to implement native printer property support
for Linux/MacOS?
4. *no, for starters there is no such thing on Linux. Different
toolkits provide a printer dialog but none of them are "native"*
5. in the same way that the windows one is.
1. 3.Would there be value in creating a feature request for this
capability?
no, because there's nothing to expose.
FYI, OpenJDK mailing lists are not for support. They are lists to
discuss the code changes being made by people contributing fixes.
-phil.
On 3/24/25 7:06 PM, last last wrote:
>
> *Dear OpenJDK Community,*
>
> I'm writing regarding an observation about the PrintDialog's
> Properties button behavior on Linux platforms. On my Ubuntu 20.04
> system (OpenJDK version: 17), I noticed that the Properties button in
> the print dialog remains disabled.
>
> Through previous research, I found this is documented in [JDK-8246742]
> ServiceUI.printDialog does not support properties dialog - Java Bug
> System <https://bugs.openjdk.org/browse/JDK-8246742> . The ticket
> suggests this behavior was intentionally implemented.
>
> But from a user perspective, this disabled state raises some concerns:
>
> 1. 1.Users familiar with Windows implementation may find this
> inconsistent
> 2. 2.Prevents access to printer-specific options that might otherwise
> be configurable
> 3. 3.Could be confusing for applications relying on this functionality
>
> Reproducer:
> import java.awt.*;
> import java.awt.print.*;
>
> public class PrintDialogExample implements Printable {
>
> public static void main(String[] args) {
> // 创建 PrinterJob 对象
> PrinterJob printerJob = PrinterJob.getPrinterJob();
>
> // 设置打印内容
> printerJob.setPrintable(new PrintDialogExample());
>
> // 显示打印对话框
> if (printerJob.printDialog()) {
> try {
> // 执行打印任务
> printerJob.print();
> System.out.println("Printing complete.");
> } catch (PrinterException e) {
> e.printStackTrace();
> }
> } else {
> System.out.println("Printing cancelled.");
> }
> }
>
> @Override
> public int print(Graphics graphics, PageFormat pageFormat, int
> pageIndex) throws PrinterException {
> // 只打印第一页
> if (pageIndex > 0) {
> return Printable.NO_SUCH_PAGE;
> }
>
> // 将 Graphics 对象转换为 Graphics2D
> Graphics2D g2d = (Graphics2D) graphics;
>
> // 设置字体和颜色
> g2d.setFont(new Font("Serif", Font.PLAIN, 12));
> g2d.setColor(Color.BLACK);
>
> // 打印文本
> String text = "Hello, this is a test print job!";
> g2d.drawString(text, 100, 100);
>
> // 返回打印成功
> return Printable.PAGE_EXISTS;
> }
> }
>
> I'd like to inquire:
>
> 1. 1.Is this considered an accepted platform behavior difference?
> 2. 2.Are there any plans to implement native printer property support
> for Linux/MacOS?
> 3. 3.Would there be value in creating a feature request for this
> capability?
>
> Additional environment details:
>
> * Desktop Environment: GNOME [3.34.3-0ubuntu1 ]
> * Default Print System: CUPS [2.3.1-9ubuntu1.4]
>
> Thank you for your insights. I'm happy to provide further testing
> support if needed.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20250326/beb1fefc/attachment-0001.htm>
More information about the client-libs-dev
mailing list