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

[Printing] Illegal argument exception for HARDWARE_MINIMUM margin when printing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8u20
    • 8u5, 8u20
    • javafx
    • OS X Mavericks
      Same on 8u5 and 8u20b14

    Description

      PrinterJob printerJob = PrinterJob.createPrinterJob();
      Printer printer = Printer.getDefaultPrinter();
      PageLayout pageLayout = printer.createPageLayout(Paper.A4, PageOrientation.LANDSCAPE, Printer.MarginType.HARDWARE_MINIMUM);

      All other margin types work fine.

      Throws:

      java.lang.IllegalArgumentException: Illegal parameters
      at javafx.print.PageLayout.<init>(PageLayout.java:104)
      at javafx.print.Printer.createPageLayout(Printer.java:302)
      at wing.reports_new.print.PrintTestApp.start(PrintTestApp.java:74)


      Relevant code in your code base:

          PageLayout(Paper paper, PageOrientation orient,
                     double leftMargin, double rightMargin,
                     double topMargin, double bottomMargin) {

              if (paper == null || orient == null ||
                  leftMargin < 0 || rightMargin < 0 ||
                  topMargin < 0 || bottomMargin < 0) {
      here-> throw new IllegalArgumentException("Illegal parameters");
              }

      Attachments

        Issue Links

          Activity

            People

              prr Philip Race
              mgrev Mikael Grev
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: