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.
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.
- duplicates
-
JDK-8101827 Promote impl_processCSS to public API
- Resolved