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

Need to way to force layout rendering before printing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • 8
    • 8
    • javafx

      Printing on non-FX thread means the layout may not be rendered correctly.
      The printing API doesn't recommend to use the FX thread but you don't have really the choice for now.

      My sample layout (see attached print-3.fxml) is made of 6 rectangles of size 200x200 each, positioned into a GridPane so that the grid size is 600x400. Border of the rectangles is red.
      In non FX thread the layout bounds value I get is 200x200, the content of one cell of the grid (!), hence a wrong computation of bounds for printing (and a non expected clipping). The rectangles are rendered black & white, the red color of the borders is lost, see attached print-3-non-fx-thread.pdf.
      In FX thread all's fine, see attached print-3-fx-thread.pdf.

        1. print-3.fxml
          2 kB
          Yves Joan
        2. print-3-fx-thread.pdf
          3 kB
          Yves Joan
        3. print-3-non-fx-thread.pdf
          6 kB
          Yves Joan
        4. selvia.fxml
          41 kB
          Yves Joan

            prr Philip Race
            yjoan Yves Joan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: