[Printing] Illegal argument exception for HARDWARE_MINIMUM margin when printing

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 8u20
    • Affects Version/s: 8u5, 8u20
    • Component/s: javafx
    • Environment:

      OS X Mavericks
      Same on 8u5 and 8u20b14

      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");
              }

            Assignee:
            Philip Race
            Reporter:
            Mikael Grev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: