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

Print dialog doesn't reflect default page size on Linux

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P4
    • 9
    • 8, 9
    • client-libs
    • 2d
    • linux_ubuntu

    Description

      Minor issue; is similar to JDK-8016485

      OS: Ubuntu 12.04 Linux
      JDK version: 8, b101
      Code to reproduce:
      //-----------------------------------------------
      import java.awt.*;
      import java.awt.event.*;
      import java.awt.print.*;
      import javax.swing.*;

      public class PrintingPageSize extends JFrame implements Printable {

          public PrintingPageSize() {

              setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

              JButton print = new JButton("Print...");
              print.addActionListener(new ActionListener() {
                  @Override
                  public void actionPerformed(ActionEvent e) { showPrintDialog(); }
              });

              getContentPane().add(print, BorderLayout.CENTER);
              pack();
          }

          @Override
          public int print(Graphics g, PageFormat f, int p) { return 0; } // dummy

          private void showPrintDialog() {
              PrinterJob printJob = PrinterJob.getPrinterJob();
              printJob.setPrintable(this);
              printJob.printDialog();
          }

          public static void main(String args[]) {
              EventQueue.invokeLater(new Runnable() {
                  @Override
                  public void run() { new PrintingPageSize().setVisible(true); }
              });
          }
      }
      //-----------------------------------------------

      Please go to "System Settings" -> "Printing", select any printer, right-click -> "Properties" -> "Printer Options" -> "Page Size" and set some value (e.g., "A4").

      Then please run the application, push "Print..." button and go to "Page Setup" tab of the print dialog: size is "Custom" instead of "A4".

      Attachments

        Activity

          People

            psadhukhan Prasanta Sadhukhan
            avstepan Alexander Stepanov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: